Thank you for looking at this.
I am enclosing a gzipped tar file of 5 very small example files, (test.tar.gz.)
This is the example code:
unit env;
interface
procedure proc1;external;
procedure proc2;external;
procedure proc3;external;
implementation
end.
unit unit1;
interface
uses env;
procedure proc1;
implementation
procedure proc1;
begin
writeln("running proc1");
end;
end.
unit unit2;
interface
uses env;
procedure proc2;
implementation
procedure proc2;
begin
writeln("running proc2");
end;
end.
unit unit3;
interface
uses env;
procedure proc3;
implementation
procedure proc3;
begin
writeln("running proc3");
proc1;
proc2;
end;
end.
program main;
uses unit1, unit2, unit3;
begin
proc1;
proc2;
proc3;
end.
Digital Pascal allows this "structure" of the code via [global] modules, and this code worked
in the last release.
In the current release, I am getting the following error messages:
> gpc --automake -o main main.p
unit3.o(.text+0x52): In function `Proc3':
: undefined reference to `proc1'
unit3.o(.text+0x57): In function `Proc3':
: undefined reference to `proc2'
collect2: ld returned 1 exit status
Before I start completely re-orgarnizing 3000+ modules, I would like to have confirmation
that there currently is no alternative.
Thanks,
- Inga
Mingeborg(a)aol.com wrote:
> I have tried using the unit / uses syntax, (specifying that each unit âusesâ
> this environment module,) but I still cannot get these units linked. The
> compiler is complaining about several hundreds of âundefined referencesâI
> am now assuming that it is expecting the âimportedâ modules to contain the
> code for all of the procs/funcs called by each unit, rather than just the
> âexternalâ definition. Is this correct, or might I be misunderstanding what
> is happening? (I am currently running gpc-20040516, gcc-3.3.3, on Suse
> Linux. I had previously run some tests using the last Gnu Pascal release
> system running on cygwin.)
>
> I am hoping to avoid having to analyze dependencies and completely
> re-organize the modules. Is there any other way?
I don't know if you've already got an answer, so here's mine:
Could you send a detailed error message from the compiler? It's especially
interesting which references remain unresolved.
My guess is that you are using some of the GPC standard units, and that you
didn't add the according linking statements to the command line. For example,
if you're compiling a source that "uses Crt", your command line will have to
look like this:
gpc foo.pas -o foo -lncurses -lpanel
... since crt.pas is based upon the shared libraries libncurses and libpanel.
Regards,
Markus