Desperately looking for a work-around to load and unload D shared libraries from C on OSX

bitwise via Digitalmars-d digitalmars-d at puremagic.com
Thu Sep 17 09:17:10 PDT 2015


On Thursday, 17 September 2015 at 10:12:57 UTC, Walter Bright 
wrote:
> On 9/16/2015 11:40 PM, ponce wrote:
>> On Wednesday, 16 September 2015 at 23:24:29 UTC, bitwise wrote:
>>>
>>> I was trying to solve this one myself, but the modifications 
>>> to DMD's backend
>>> that are needed are out of reach for me right now.
>>>
>>> If you're willing to build your own druntime, you may be able 
>>> to get by.
>>
>> I'd prefer a solution that works with existing compilers, but 
>> maybe building a
>> custom LDC is possible if I figure it out.
>
> I seriously doubt this issue has anything to do with the 
> compiler's code generator back end. It's more likely the 
> problem is in druntime.

Based on previous posts you've made, it seems you already know 
that Martin's solution involves having DMD's back end add linux 
style ctors/dtors to the COMDAT section of every compiled D file, 
so I'm not sure what you mean by this.

If a callback provided to _dyld_register_func_for_add_image does 
not call sections_osx_onAddImage, then it must be called somehow.

    Bit



More information about the Digitalmars-d mailing list