On Friday, 17 October 2014 at 16:35:46 UTC, Jeremy DeHaan wrote:
I remember reading something(but my googlefu is weak today) about having to initialize the runtime if you are using D inside another language. Can anyone confirm this is the case?

Yeah, unless the main() is in D, you need to run initialization functions.

The way I recommend doing it is to write your own extern(C) MyLib_Init and MyLib_Term functions. Then have their implementations call the import core.runtime; Runtime.initialize()

http://dlang.org/phobos/core_runtime.html#initialize

This way, you can do other init stuff for your lib too without the user worrying about those details. Furthermore, having to call a library init function is somewhat normal for C libs, so the user shouldn't think much of it.

Reply via email to