DSO with DMD 2.052 on Linux?

Jonathan M Davis jmdavisProg at gmx.com
Mon May 2 14:10:19 PDT 2011


> 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.

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

- Jonathan M Davis


More information about the Digitalmars-d mailing list