On Thursday, 7 April 2016 at 01:50:31 UTC, Yuxuan Shui wrote:
On Thursday, 7 April 2016 at 01:42:54 UTC, rikki cattermole
wrote:
On 07/04/2016 1:38 PM, Yuxuan Shui wrote:
[...]
Have you started D's runtime?
How to start D's runtime? I followed the examples found here:
https://dlang.org/dll-linux.html#dso9, which doesn't say
anything about starting the runtime.
The runtime is needed if you are going to use any of its
features, like the GC. If you restrict yourself strictly to C in
D (and that means avoiding thinks like builtin AAs, array
concatenation, and anything that touches the runtime) you can do
without it.
The functions you want are core.runtime.rt_init for
initialization and core.runtime.rt_term for cleanup [1]. On
Windows, you can guarantee these will be called by adding a
DLLMain checking for DLL_PROCESS_ATTACH and DLL_PROCESS_DETACH.
On other platforms, you'll need to work out something else.
[1] http://dlang.org/phobos/core_runtime.html#.rt_init