On 2013-12-19 18:59, David Nadlinger wrote:

That is pretty much how it is done in DMD and LDC as well. The only
difference is that instead of modifying the linker scripts to
accommodate this, we emit the ModuleInfo references to custom sections.
The GNU toolchain (and we are in highly system-specific territory here
anyway) never changes the order of custom sections, which you can also
verify using __attribute__((section("...))) in GCC. Thus, if you emit
your relevant symbols into three sections like this,

Does that really work reliably? As far as I remember, the trick with brackting sections doesn't work on Mac OS X. DMD had some problems with that. It basically broke on every new major release of Mac OS X, the linker changed all the time. If I recall correctly it either removed the empty sections or reordered the sections.

But the dynamic linker on Mac OS X has an API to access these sections easily anyway.

--
/Jacob Carlborg

Reply via email to