On Thursday, 7 April 2016 at 02:01:31 UTC, Mike Parker wrote:
On Thursday, 7 April 2016 at 01:50:31 UTC, Yuxuan Shui wrote:
[...]
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
static this/static ~this should work, right?