Shared library with C API

Dan Olson via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Thu Jun 5 22:52:20 PDT 2014


"Ellery Newcomer" <ellery-newcomer at utulsa.edu> writes:

> On Wednesday, 4 June 2014 at 15:18:22 UTC, Dan Olson wrote:
>>
>> LDC also uses global ctors to build the ModuleInfo list.  A problem
>> with
>> calling rt_init() in a global ctor means that ModuleInfo is probably
>> incomplete, meaning some or no module ctors (static this) are
>> called.  I
>> thought perhaps the LDC_global_crt_ctor optional priority arg could
>> help, but makes no difference on OSX at least.
>
> haven't noticed this on linux. I have noticed that druntime does not
> like it when you call rt_init or rt_term more than once, which kind of
> precludes multiple shared libs with this scheme.

Hmmm, rt_init/rt_term source looks like it is designed to be called
multiple times.  Is it because LDC currently only has runtime as static
lib so each of your shared libs has own copy of runtime?  I bet it will
work once LDC has shared lib runtime/phobos.

http://forum.dlang.org/post/mailman.94.1396646137.19942.digitalmars-d-ldc@puremagic.com


More information about the digitalmars-d-ldc mailing list