On 2015-09-17 00:29, ponce wrote:
Context: On OSX, a C program can load a D shared library but once
unloaded the next dlopen will crash, jumping into a callback that
doesn't exist anymore.

I've filed it here: https://issues.dlang.org/show_bug.cgi?id=15060


It looks like this was known and discussed several times already:
http://forum.dlang.org/post/[email protected] (2015)
https://github.com/D-Programming-Language/druntime/pull/228 (2012)


Any idea to work-around this problem would be awesome.

I'm not looking for something correct, future-proof, or pretty. Any shit
that still stick to the wall will do. Anything!

The only case I need to support is: C host, D shared library, with
runtime statically linked.

Please help!

Easiest would be to not unload the library. If that doesn't work, replace "_dyld_register_func_for_add_image" [1] with "dyld_register_image_state_change_handler" [2].

[1] https://github.com/D-Programming-Language/druntime/blob/master/src/rt/sections_osx.d#L76

[2] http://www.opensource.apple.com/source/dyld/dyld-353.2.3/include/mach-o/dyld_priv.h

--
/Jacob Carlborg

Reply via email to