[Issue 15060] Can't load a D shared library first, then load a C shared library
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Oct 1 19:12:18 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=15060
--- Comment #12 from bitwise <nicolas.jinchereau at gmail.com> ---
(In reply to Jacob Carlborg from comment #10)
> (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.
>> DMD already does what's necessary for ELF (Linux, FreeBSD). Just do the same
>> for Mach-O and OS X.
That's easier said than done ;)
Making druntime compile as a shared lib and making it support multiple images
is the easy part. Modifying DMD to output the ctors/dtors properly is much more
difficult than it sounds.
The current solution outputs the ctors/dtors by manually outputting byte codes:
https://github.com/D-Programming-Language/dmd/blob/master/src/backend/elfobj.c#L3183
This is why I was saying we should just add some(or one special one) pragmas
that will allow this to be done in the front end.
>> @bitwise: how much would you take to do it? :))
Wish I knew how =/
--
More information about the Digitalmars-d-bugs
mailing list