https://issues.dlang.org/show_bug.cgi?id=15060
--- Comment #10 from Jacob Carlborg <d...@me.com> --- (In reply to ponce from comment #9) > If this need back-end support, maybe Walter could implement global ctor/dtor > like in LDC? DMD already does what's necessary for ELF (Linux, FreeBSD). Just do the same for Mach-O and OS X. > FWIW, I'm having problem with the workaround (calling > dyld_register_image_state_change_handler crash). It's as if > dyld_register_image_state_change_handler has a different signature or > calling convention in 32-bit. The declaration of dyld_register_image_state_change_handler is available here [1]. The declaration of "dyld_image_info" [2] and "mach_header" [3]. Looking at your implementation, both the function pointer for the callback and the function it points to need to be declared as extern(C). [1] http://www.opensource.apple.com/source/dyld/dyld-96.2/include/mach-o/dyld_priv.h [2] http://opensource.apple.com/source/dyld/dyld-132.13/include/mach-o/dyld_images.h [3] http://www.opensource.apple.com/source/xnu/xnu-1456.1.26/EXTERNAL_HEADERS/mach-o/loader.h --