Current status of DLLs
Benjamin Thaut
code at benjamin-thaut.de
Wed Nov 7 02:24:25 PST 2012
Am 07.11.2012 03:04, schrieb Matt:
> The DLL page on the main D site is out of date in its example, importing
> module std.gc, which doesn't exist. Has connecting to DLLs become
> easier, harder, or just plain different? And in what ways should I go
> about doing so? My personal requirement is dynamic loading, so any help
> would be much appreciated.
AFAIK dlls are possible without problems if you only have a C-Style
interface. As soon as you want to have a D-Interface to a dll things get
really ugly / near impossible.
For example: Exporting the Module init symbol is not supported, so every
module that only exists in a dll will generate a linker error. Also I
had some cases where even the vtable symbol did not get exported
(despite the that the class was declared as export) and caused yet
another linker error. Also there are quite some issues with thread local
storage and data symbols are not supported at all by dmd. The only thing
that truly works is exporting C-Style functions or COM.
Also its not possible to build druntime as a shared dll, nor phobos, so
you would have to duplicate all the functionality in there for every dll
you have.
I decided to link everything statically until the situation dramatically
improves.
Kind Regards
Benjamin Thaut
More information about the Digitalmars-d-learn
mailing list