Problem using shared D library from C shared library

Yuxuan Shui via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Apr 6 19:30:54 PDT 2016


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

Thanks a lot.

I wish this can be better documented, though.


More information about the Digitalmars-d-learn mailing list