Status D dynamic libs?

e-t172 e-t172 at akegroup.org
Sat Apr 19 13:44:56 PDT 2008


Frank Benoit a écrit :
> If i want to put dwt into a dynamic lib, then i have those components
> 
> - D runtime (tango)
> - dwt (either dwt-win or dwt-linux, depends on tango)
> - dwt-addons (optionally, dependending on dwt-win/dwt-linux and tango)
> - application code, depending on all above.
> 
> What i want to do is, to put all dwt and dwt-addons stuff into two libs.
> 
> I hope to get shorter build times and smaller executables.
> 
> Is that possible on win/linux?
> What are the problems?

On Windows, I don't know. On Linux, I have already compiled a D shared 
library with no problems whatsoever. I'm using GDC, but if DMD supports 
PIC you should be just fine.

Just remember not to include Phobos/Tango when creating your shared 
library (it won't work, because Phobos/Tango is not compiled PIC). With 
GDC you can avoid linking to Phobos/Tango using the -nophoboslib switch. 
I don't know for DMD. Of course, you still have to link to Phobos/Tango 
when building the actual application.

However, when maintaining shared libraries, automatic function inlining 
might cause problems. See the "library standardization" thread for details.



More information about the Digitalmars-d mailing list