Sven Barth wrote:

The only other alternative would be to add the RTL initialization code to each exported function. I don't consider this a viable alternative.

Which is more or less what Reinier's working code did. I'd hate that to be an implicit default.

Note: Dynamic packages won't have this problem, because:
- for packages linked at compile time the initialization is run as part of the program initialization AFTER the OS has initialized the library (which doesn't do much in case of a package)
- for packages loaded at runtime it's done as part of the LoadPackage call
That's however only possible, because dynamic packages are very different from simple libraries (and stuffed with compiler magic).

Is it possible for code in a unit to determine what sort of project it's part of, i.e. a standalone program, a library etc.? Could the RTL have a flag indicating that initialisation (or finalisation?) blocks were currently being run, and anything called should assume that facilities were restricted?

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to