DSO with DMD 2.052 on Linux?

Jacob Carlborg doob at me.com
Tue May 3 00:15:44 PDT 2011


On 2011-05-02 23:10, Jonathan M Davis wrote:
>> Is dynamic linking supported on Linux with DMD 2.052 (and D2 in general)?
>>
>> I am not talking about Phobos, just modules which I want to compile as DSO.
>>
>> There is -fPIC switch to DMD - does it work as intended?
>>
>> PS: gdc is not an option...
>
> The short answer: no.
>
> As for the long answer, someone else could answer far better than I could.
> IIRC, the main problem is the runtime. It has issues when you try and split
> your D code with .so files (I believe that you end up with multiple instances
> of the runtime). It _might_ work if you don't use the garbage collector at
> all, but there could be other issues. I don't remember exactly what all of the
> problems are. But regardless, don't expect shared libraries to work at the
> moment.

This is a showstopper for shared libraries on Linux: 
http://d.puremagic.com/issues/show_bug.cgi?id=4583
A few things in the runtime need to be changed as well.

> Getting shared libraries to work is near the top of the TODO list, but it
> hasn't been done yet.
>
> - Jonathan M Davis

Shared libraries have been working for Tango on Mac OS X from quite some 
time now. Almost all of the same patches are applied to druntime as 
well. Just one small change to actually enable the changes.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list