dynamic library building and loading

Rob T rob at ucora.com
Sun Sep 30 00:02:53 PDT 2012


On Friday, 28 September 2012 at 21:26:47 UTC, Iain Buclaw wrote:
> The way I intend to address it is to have each module handle 
> it's own
> gshared/thread data and pass the information to the D runtime 
> during
> the module construction stage (.ctor) - there is already 
> something
> done this way for _Dmodule_ref - so it may end up being that 
> two new
> fields will be tacked onto it; void[] tlsdata, void[] 
> gsharedata;

I re-built libgphobos and libgdruntime with -fPIC and I can now 
successfully create dynamically loaded D libs. I have 
successfully linked a dynamic D lib to a C++ app, executing some 
test code successfully. I have not yet tried to dlopen a dynamic 
D lib from C++, but I will try maybe tomorrow.

My simple dynamic lib test seems to run fine, but I understand 
that there may be problems, such as the GC failing to work 
properly, and perhaps more can/will go wrong as per Jacob's post
http://forum.dlang.org/post/k4219f$uft$1@digitalmars.com

Any idea when/if you will get around to implementing a fix? Wish 
I could help but I've only just started looking at the source 
code, so whatever I try to fix will probably cause more harm than 
good for a while (but it's a start).

--rt



More information about the Digitalmars-d mailing list