State of interfacing with c++

jmh530 via Digitalmars-d digitalmars-d at puremagic.com
Fri Mar 18 08:29:55 PDT 2016


On Friday, 18 March 2016 at 14:26:31 UTC, ZombineDev wrote:
> The important thing to remember is that the Druntime must be 
> initialized (see http://wiki.dlang.org/Runtime_internals and 
> http://dlang.org/phobos/core_runtime.html#.rt_init for more 
> info), before you call D functions that use the garbage 
> collector. If all your D code is @nogc nothrow, you shouldn't 
> need to do any initialization.

You mean if you call D functions in C++, you have to use rt_init 
to enable the garbage collector. I don't see that mentioned on 
the Interfacing to C++ page. Probably worth adding.

Other suggestions:
1) Split up the C++ templates section of that page, instead of 
just being big blocks of code.
2) In the memory allocation section, it mentions for ways to 
ensure D garbage is collected properly by C++. Might provide a 
simple example of each technique.


More information about the Digitalmars-d mailing list