Problem using shared D library from C shared library

rikki cattermole via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Apr 6 20:19:58 PDT 2016


On 07/04/2016 3:18 PM, Yuxuan Shui wrote:
> 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?

They execute when the runtime is started.


More information about the Digitalmars-d-learn mailing list