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 to link together all the object files into a bundle, which does not have any concept of a main program. So I'm still not sure the initialization routines are being called - I suspect all the non-"root" units (any that use any others) are being "called" from the initialization routines in the "root" units, but I suspect the init routines in those "root" units are not getting called and so none of them are being called.
Is there an easy way to test that they are being called? 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.
Thanks, Peter.