On Wednesday, 8 January 2020 at 19:05:29 UTC, H. S. Teoh wrote:
On Wed, Jan 08, 2020 at 06:12:01PM +0000, Stefan via
Digitalmars-d-learn wrote: [...]
But you can easily do the initialization in your D code, by
calling
rt_init() and rt_term(), like this:
[...]
extern(C) int rt_init();
extern(C) int rt_term();
extern(C) __gshared bool rt_initialized = false;
[...]
if(!rt_initialized)
rt_init();
rt_initialized = true;
I believe the rt_initialized flag is unnecessary, because
rt_init/rt_term use an atomic counter to keep track of how many
times they were called. So you just have to call rt_init and
make sure you have a matching call to rt_term, and it should
Just Work(tm).
T
What is going on here? The original post date appears as to be of
2005 :D.
And a reminder that druntime must be linked along with phobos
when it is a library.