dynamic library building and loading

Jacob Carlborg doob at me.com
Mon Oct 1 05:34:21 PDT 2012


On 2012-10-01 12:42, Johannes Pfau wrote:

> There are some reasons for dynamic libraries linked at compile time,
> one is that we have to start somewhere and they are required for
> plugins / dynamically loaded libraries as well ;-)
>
> So I started a small test suite for GDC (could be adapted to other
> compilers). It currently only tests compile time linking of dynamic
> libraries, but adjusting the test to use runtime loading should be
> easy. But it's pointless as long as we have no runtime support.
> https://github.com/jpf91/dso-test
>
> It should also be enhanced to test multiple shared libraries.
>
> The good news:
> * Exception handling is working
> * ModuleInfos are working
> * unit tests are working
> * Static variables, gshared variables, tls variables are working
> * Object.factory is working
> * Calling functions, passing function pointers, passing classes between
>    dso/app is working

That's good. Have you tested this with DMD?

> The bad news:
> * The GC doesn't scan TLS/__gshared/static data in dynamic libraries,
>    it only scans the main app.

That should be fairly trivial on Mac OS X. But I'm suspecting it won't 
be that easy on Linux.

BTW, is the runtime and phobos statically linked both with the dynamic 
library and the executable?

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list