shared libs for OSX
Martin Nowak via Digitalmars-d
digitalmars-d at puremagic.com
Mon May 25 13:58:59 PDT 2015
On Monday, 25 May 2015 at 19:40:52 UTC, bitwise wrote:
> 1) _dyld_register_func_for_add_image should be taken care of
> with the above two fixes
You still cannot unregister the callback, so it can't be used for
dynamically loading druntime. Last time we talked about this
problem, we found some undocumented function that could be
deregistered.
> 2) __attribute__((constructor/destructor)) can be added to
> druntime when building for osx like in the file dylib_fixes.c
> [1]
For linux we let the compiler emit comdat constructors into every
D object, so you'll end up with exactly a single function for any
binary containing D code.
I don't think you need ctors/dtors on OSX if you already have the
dylib callback.
> 3) copy paste rt_init/rt_term, rename them to
> dylib_init/dylib_term and remove everything except whats needed
> to initialize a shared lib's image.
Not sure what you want to copy, but for sure you need to extend
sections_osx to handle multiple dylibs. It should be very similar
to _d_dso_registry for ELF, except that you iterate over the
sections of a dylib image to get EH tables and ModuleInfo.
More information about the Digitalmars-d
mailing list