digitalmars.D - Does D support plugins with dll written in D ?
- chmike (10/10) May 27 2014 Hello,
- Kagamin (1/1) May 27 2014 http://wiki.dlang.org/Win32_DLLs_in_D - maybe, it's of some help
- Olivier Pisano (6/6) May 27 2014 Hello :)
- Benjamin Thaut (15/24) May 27 2014 No, DLL support on windows is very limited at the moment. Basically you
Hello, note that D is still very new to me. The documentation for a bit too terse to answer my question. I would like to know if it would allow to use Object.factory() with the classes defined in the loaded library and if the GC would manage data allocated with new in the code of the library. Does the loaded dll need to be defined as a module or something like that ?
May 27 2014
http://wiki.dlang.org/Win32_DLLs_in_D - maybe, it's of some help
May 27 2014
Hello :) AFAIK, Higher-level library support is planned for next release (v2.066) [1]. Meanwhile, you'll have to rely on your own exported factory functions to create objects instead of Object.factory(). 1 : http://wiki.dlang.org/Agenda#high-level_shared_library_support
May 27 2014
Am 27.05.2014 11:56, schrieb chmike:Hello, note that D is still very new to me. The documentation for too terse to answer my question. I would like to know if it would allow to use Object.factory() with the classes defined in the loaded library and if the GC would manage data allocated with new in the code of the library. Does the loaded dll need to be defined as a module or something like that ?No, DLL support on windows is very limited at the moment. Basically you can create D-DLLs which have a C-interface. Exporting anything but functions does not or only partially work. The biggest problem on Windows is that there is no shared version of druntime/phobos. Which means you have to link a full version of druntime/phobos into each of your dlls. This not only increases binary size, it also leads to problems. E.g. if you create a phobos class in one dll and pass it to another you can no longer cast it (because the type infos exist twice). There are lot more fun problems, so I would advice against using DLLs for anything else then C-library like projects. This DIP might give you a good overview of whats currently broken with DLLs: http://wiki.dlang.org/DIP45 Kind Regards Benjamin Thaut
May 27 2014