On Thursday, 25 October 2012 at 17:20:40 UTC, Rob T wrote:
On Thursday, 25 October 2012 at 02:15:41 UTC, Jakob Ovrum wrote:
You can even share the same GC between dynamic libraries and the host application (if both are D and use GC, of course) using the GC proxy system.

What is the GC proxy system, and how do I make use of it?

--rt

There's a function Runtime.loadLibrary in core.runtime that is supposed to load a shared library and get the symbol named `gc_setProxy` using the platform's dynamic library loading routines, then use that to share the host GC with the loaded library.

I say "is supposed to" because I checked the code and it's currently a throwing stub on POSIX systems, it's only implemented for Windows (the source of the function can be found in rt_loadLibrary in rt/dmain2.d of druntime).

When it comes to gc_setProxy - GDC exports this symbol by default on Windows, while DMD doesn't. I don't know why this is the case. I haven't built shared libraries on other OS' before so I don't know how GDC and DMD behave there.


Reply via email to