Problem using shared D library from C shared library

Yuxuan Shui via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Apr 6 21:24:48 PDT 2016


On Thursday, 7 April 2016 at 03:37:39 UTC, Yuxuan Shui wrote:
> On Thursday, 7 April 2016 at 03:19:58 UTC, rikki cattermole 
> wrote:
>> On 07/04/2016 3:18 PM, Yuxuan Shui wrote:
>>> On Thursday, 7 April 2016 at 02:01:31 UTC, Mike Parker wrote:
>>>> [...]
>>>
>>> static this/static ~this should work, right?
>>
>> They execute when the runtime is started.
>
> So now I add call rt_init in the C shared library. Now the D 
> library no longer gets SIGSEGV, but throws no memory exception 
> when it tries to allocate.

Back trace:

(gdb) bt
#0  0x00007fffe19e006c in _d_throwdwarf () from 
/lib64/libphobos2.so.0.70
#1  0x00007fffe19af2ab in onOutOfMemoryErrorNoGC () from 
/lib64/libphobos2.so.0.70
#2  0x00007fffe19cbfa3 in 
gc.gc.GC.__T9runLockedS47_D2gc2gc2GC12mallocNoSyncMFNbmkKmxC8TypeInfoZPvS21_D2gc2gc10mallocTimelS21_D2gc2gc10numMallocslTmTkTmTxC8TypeInfoZ.runLocked() () from /lib64/libphobos2.so.0.70
#3  0x00007fffe19c4f66 in gc.gc.GC.malloc() () from 
/lib64/libphobos2.so.0.70
#4  0x00007fffe19cda18 in gc_qalloc () from 
/lib64/libphobos2.so.0.70
#5  0x00007fffe19e17dd in rt.lifetime.__arrayAlloc() () from 
/lib64/libphobos2.so.0.70
#6  0x00007fffe19e6445 in _d_arrayappendcTX () from 
/lib64/libphobos2.so.0.70
#7  0x00007fffe19e5b47 in _d_arrayappendT () from 
/lib64/libphobos2.so.0.70



More information about the Digitalmars-d-learn mailing list