David James wrote:
--unit-path=DIR:DIR:... search path for other units, i.e. not those shipped with GPC (they should be found automatically) and not in the current directory --
I still have a problem here ... for me GPC (20010306) is not finding units in the current directory at link-time.
For example:
helunit.p
unit helunit;
interface
procedure writeit;
implementation
procedure writeit;
begin writeln('Hello from unit'); end;
end.
useunit.p
program useunit(output);
uses helunit;
begin writeln('Hello world, and now ... from the unit'); writeit; writeln(' ... and back in main'); end. ======== If I say
gpc -c helunit.p
and then
gpc useunit.p
I get:
/tmp/cc2caGt51.o: In function `pascal_main_program': /tmp/cc2caGt51.o(.text+0x32): undefined reference to `Writeit' /tmp/cc2caGt51.o: In function `init_pascal_main_program': /tmp/cc2caGt51.o(.text+0x7f): undefined reference to `init_Helunit' collect2: ld returned 1 exit status
From what you say above, I would have expected this to work, and it
*did* work with GPC 19991030.
Is this the expected behaviour?
Basically yes. Without `--automake', GPC tries to behave as "dumb" as a C compiler, i.e. require all files to be linked to be mentioned on the command line. `gpc useunit.p helpunit.o' should work then. Though I don't actually see the point in not using `--automake'...
(I could set --unit-path to include the current directory, but you seem to be saying that should not be necessary.)
Nope. The unit path is for automake only, I think.
Frank