dynamic library building and loading

Etienne etcimon at gmail.com
Mon Mar 24 09:44:33 PDT 2014


On Tuesday, 18 June 2013 at 20:23:42 UTC, 1100110 wrote:
> On 06/18/2013 10:14 AM, Bottled Gin wrote:
>>
>>> Actually, I seriously doubt everything is working as 
>>> expected. For
>>> example, what happens when an application loads (via dlopen or
>>> similar) a D dynamic library:
>>>
>>> * Are exception handlers registered
>>> * Are module infos properly registered
>>> * What happens if I call Object.factory, will that find a 
>>> class in the
>>> dynamic library
>>> * Are GC sections registered
>>> * What happens when the library is unloaded, will all of the 
>>> above be
>>> unregistered and cleaned up
>>>
>>
>> Hello D Experts
>>
>> I am replying to an old thread since I want to know if and how 
>> the
>> situation has improved over the past few months. In particular 
>> I want to
>> link and call fairly complex D functions from a C++ 
>> application.
>>
>> I am exclusively using Linux. Can somebody please guide me if 
>> I should
>> expect things to work with current DMD master from github?
>>
>> Regards
>> - Puneet
>
> There's a DConf talk about shared libraries in D.
>
> Perhaps there's useful information there?
> http://www.youtube.com/watch?v=i63VeudjZM4
>
> (I'm watching it now so I don't know how detailed it is.)

Hello all,

I'm wondering if this has been resolved to date. I get this error 
on master:

/usr/bin/ld: generated/linux/release/64/libphobos2.so.0.66.o: 
relocation R_X86_64_32 against `.rodata' can not be used when 
making a shared object; recompile with -fPIC
generated/linux/release/64/libphobos2.so.0.66.o: could not read 
symbols: Bad value
collect2: error: ld returned 1 exit status

even though I've built with fPIC:

cc -c  -m64 -fPIC -O3 etc/c/zlib/trees.c 
-ogenerated/linux/release/64/etc/c/zlib/trees.o
cc -c  -m64 -fPIC -O3 etc/c/zlib/uncompr.c 
-ogenerated/linux/release/64/etc/c/zlib/uncompr.o
cc -c  -m64 -fPIC -O3 etc/c/zlib/zutil.c 
-ogenerated/linux/release/64/etc/c/zlib/zutil.o

etc...


More information about the Digitalmars-d mailing list