On Thu, Jan 15, 2009 at 7:35 AM, William Newbery <wnewb...@hotmail.co.uk> wrote: > Jarrett Billingsley Wrote: > >> On Wed, Jan 14, 2009 at 2:58 PM, William Newbery <wnewb...@hotmail.co.uk> >> wrote: >> > 5)Support for classes in dynamic libaries, and the ability to dynamicaly >> > load these libaries. >> >> You're on Windows, so no. Well, for the most part, no. SOs on Linux >> work perfectly. DLLs on Windows are not sufficient for what D needs >> to do proper dynamic linking. Namely, there are issues with TypeInfo >> - the runtime type information that the D runtime uses to perform all >> sorts of useful things, like throwing exceptions and sorting arrays >> and doing downcasts. What ends up happening is that the RTTI is >> duplicated in both the EXE and the DLL, and the runtime does no >> stitching up or removing of redundancy in those situations, leading >> to.. odd behavior. The GC and DLLs also have strange interactions - >> it's entirely possible to set up the GC to collect data inside the >> DLL, but unloading the DLL sometimes results in a segfault for reasons >> behind my understanding. >> >> You do have options. DDL is a project which aims to perform dynamic >> linking on Windows, and it works damn well. It also has a lot of >> useful utility functions to i.e. look up symbols and types by name in >> the dynamic library. There's also another project unrelated to D >> called EDLL which more or less does the same things that DDL does; I >> don't know if anyone has successfully used it with D. > > Is there some way around this, I dont really care if D needs to use its own > dynamic libary format rather than the windows dll, I just want some external > file that D can load and execute (ie it doesnt need to be able to contain > resources, or have its own HINSTANCE, or any of the other things dlls can > have beyond simply containing classes, functions, etc), and they dont have to > be compatible with anything outside of D at all.
Yes DDL is exactly that way to work around it. See this very interesting presentation about it here: http://petermodzelewski.blogspot.com/2008/11/tango-conference-2008-ddl-talk.html --bb