Markus Gerwinski wrote:
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.
It shouldn't have to (if you're using automake or GP) since the units contains the `{$L}' directives (appropriately ifdef'ed -- the version above only applies to Unix/terminal, also it needs crtc.c).
Mingeborg@aol.com wrote:
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.
Digital Pascal allows this "structure" of the code via [global] modules, and this code worked in the last release.
Well, you declare procedures `proc' in `env' and `unit1', and these two do not necessarily have any relationship, except that they have the same name (but in different units).
In fact, I wonder how the other compiler does it -- I suppose either it doesn't support using the same identifier in different units for different purposes completely (GPC doesn't either, but will soon, with Waldek's qualified identifier changes), or it treats them as separate and throws them together at link time.
Well, GPC can do the latter as well, but you have to tell it to explicitly:
[env] procedure proc1; external name 'proc1';
[unit1] procedure proc1; attribute (name = 'proc1');
I still don't consider it very nice.
The "real" solution would, of course, be to declare all routines in the interface of that unit which implements it, and get rid of your `env' unit.
Then, each unit can import (`uses') all other units (or only those that it actually needs) in the implementation part, so you can compile all interfaces first, then all implementations (or use GP which will do this automatically).
Frank