I've just started using GNU Pascal to port some legacy code across to Windows95/NT. I'm using DJGPP with the 19990118 beta copy of GPC.
Everything appears to be working fine until I get to the linking stage. I'm getting unresolved references to Pascal procedures declared externally.
I suspect I must be getting something fairly basic wrong, but I can't even get an example from the GPC documentation to build successfully!
Suggestions would be gratefully received.
Mike Ainsworth
Example: -- foobar.pas -- module foobar;
type footype = integer; var foo : footype;
procedure setfoo(f : footype); begin foo := f; end;
function getfoo : footype; begin getfoo := foo; end;
end.
-- what.pas -- program what(output);
type footype = integer;
procedure setfoo(f : footype); external; function getfoo : footype; external;
begin setfoo(999); writeln(getfoo); end.
-- Output -- gpc -o modtest.exe foobar.o what.o -lm -lgpc Error: what.o: In function `program_What': what.pas(8) Error: undefined reference to `Setfoo' what.pas(10) Error: undefined reference to `Getfoo'
========================================================================== Mike Ainsworth Praxis Critical Systems Limited, 20 Manvers Street, Bath BA1 1PX Tel: +44 1225 466991 Fax: +44 1225 469006 Email: ma@praxis-cs.co.uk ======= Software Engineering Safety-Critical Systems =======