Easiest would be to not unload the library.
I don't control what the host program does.
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
Looks good.
