Peter N Lewis wrote:
At 3:47 AM +0200 10/7/03, Frank Heckenbach wrote:
Peter N Lewis wrote:
I checked the docs, but could not find any reference to who actually calls the initialization routines like _init_Myunit?
The initializers of importing units (as you noted) and of the main program.
It seems if I "link" with gpcgcc, they get called, but I'm not sure.
It doesn't have anything to do with how it's linked (as long as all parts are linked, but otherwise you get linking errors).
Ok, but in this case I am using gpcgcc
What's gpcgcc actually?
to link together all the object files into a bundle, which does not have any concept of a main program.
OK, so you have the main programm written in C, I suppose. In this case, please look at demos/gpc_c_*
Is there an easy way to test that they are being called?
Put a `WriteLn' or something in an (explicit) unit initializer (which is merged with the automatic initializations).
ie, what are they actually used for? I tried some structured "constant" variables, but they all seem to be initialized, but maybe that happens with other linker magic.
Yes, they're initialized automatically (placed in the initialized data segment). You could declare a string (without explicit initializer) and see if it's capacity gets set, but a `WriteLn' (see above) is probably easier.
Frank