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).
It also seems that any unit that uses another unit calls the init routines for the used unit in its initialization, is that correct? So they are idempotent presumably?
Yes, they use a flag so they return immediately when called again.
Frank