Linking...

Frank Heckenbach frank at g-n-u.de
Mon Mar 3 13:22:16 CET 2003


Grant Jacobs wrote:

> 1. The compiler won't make .o files for units that are found in a
> directory other than the one you're compiling from.
> 
> I have three directories and I compile from within one of them. The 
> units in the other two directories are located using --unit-path 
> compiler option. Reading the docs, I'm under the impression its 
> supposed to default to placing the .o files into the directory you 
> compile from for all units,

Yes, I think that's how it should be (and seems to be in my test).

> regardless where the units are located
> unless you play with the compiler options. The .gpi files *are* made 
> correctly. (I'm using --autobuild, btw.)

Sorry, but your description is not really clear to me. Are no .o
files created, or in which directories are they created, and what
about the gpi files? Which compiler options did you use, and which
files are located where?

> 2. (Less important: I suspect this will resolve itself once the above
> issue is dealt with.) The linker its looking for a lot of init_* 
> references, which I presume are initialisation routines. The docs 
> indicate that units don't need to supply an initialisation part. Does 
> linker simply "do away" with these references, or are empty 
> initialisation routines required?

The problem is that while compiling the interface, it is not known
whether the unit has an initialisation part (or any variables that
need initialization, or uses any units that have an initializer,
...). So if you wanted to convey the information whether there's one
to the user of the unit, the GPI file would have to be updated
later.

Even worse, with circular unit references (which I don't like, but
we have to support them), things get even trickier. I could
construct some example if you really care ...

AFAICS, improving it would cost much effort and gain very little
(the costs of a redundant empty initalizer is almost always
negligible).

Frank

-- 
Frank Heckenbach, frank at g-n-u.de, http://fjf.gnu.de/, 7977168E
GPC To-Do list, latest features, fixed bugs:
http://www.gnu-pascal.de/todo.html
GPC download signing key: 51FF C1F0 1A77 C6C2 4482  4DDC 117A 9773 7F88 1707




More information about the Gpc mailing list