Just tried building a shared library on linux with dmd (and calling it from C).

It works! Holy crap, it even runs my static constructors and unittests! I only had to screw with the linking process a little bit!

It doesn't work for x64, though. Gives me

/usr/bin/ld: /usr/lib64/dmd/libphobos2.a(object__c_58c.o): relocation R_X86_64_32 against `_D10TypeInfo_m6__initZ' can not be used when making a shared object; recompile with -fPIC
/usr/lib64/dmd/libphobos2.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
--- errorlevel 1

Though why it doesn't do this for x32 is beyond me. Those object files don't appear to be -fPIC either.

Reply via email to