From: Mike Ainsworth ma@praxis-cs.co.uk To: "'gpc@hut.fi'" gpc@hut.fi Subject: External references in GNU Pascal Date: Thu, 1 Apr 1999 11:50:23 +0100
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!
[...]
Well, I don't know much about Extended Pascal modules, but GPC does support Borland Pascal ("BP") "units".
Here is my conversion of your example (using a BP-style unit). Others will be able to give you examples using EP "modules".
With my example below, compile "what.pas" with this command line;
"gpc what.pas -o what.exe --automake"
Example;
-- foobar.pas -- unit foobar;
interface
type footype = integer; procedure setfoo(f : footype); function getfoo : footype;
implementation
var foo : footype;
procedure setfoo(f : footype); begin foo := f; end;
function getfoo : footype; begin getfoo := foo; end;
end.
-- what.pas -- program what(output);
uses foobar;
begin setfoo(999); writeln(getfoo); end.
BTW: if you are moving your code to the Windows platform, why not use the mingw32 version of GPC, instead of djgpp ?
Best regards, The Chief -------- Dr. Abimbola A. Olowofoyeku (The African Chief) Email: laa12@keele.ac.uk Homepage: http://ourworld.compuserve.com/homepages/African_Chief/ Author of: Chief's Installer Pro v5.00 for Win32 ftp://ftp.simtel.net/pub/simtelnet/win95/install/chief500.zip