On 02/10/2013 11:11 PM, Nick Ulle wrote:
What's the current status of dynamic loading (and/or linking) for D
libraries?

No dynamic loading in sight yet. We need to extend the GC, find semantics/techniques for TLS initialization, provide tools to load symbols ... What is on the way but will take some more weeks is link-time support for shared libraries.
https://github.com/D-Programming-Language/druntime/pull/395

I've been playing with this a bit in hopes of calling a D shared library
from R through the C ABI, and noticed that on Windows it seems fine, but
on Linux dmd won't build my library unless it includes main(), and it
segfaults if I call writeln().

The reasons for your crashes are missing initialization.
You could experiment with calling rt_init/rt_term which are exported from your shared library, but only if you're not threaded.

What I gather is that right now, DLLs work on Windows, but on *nix,
shared libraries cannot yet use anything from Phobos.

Yes, there is rudimentary support on Windows, but you'll inevitably run into ODR issues.
http://d.puremagic.com/issues/show_bug.cgi?id=7020#c4

Am I correct that it's safe to dynamically load a D library on Windows?
How out-of-date is the information in the tutorial for making DLLs on
dlang?

AFAIK it should work.

Is supporting dynamically loadable libraries a priority for the
developers, or something that might not happen for a while?

It's a huge priority but also a huge undertaking.

Reply via email to