"Moritz Maxeiner" wrote in message
news:nadswyordziiiixwa...@forum.dlang.org...
That sounds very cool, I've had a look at [1] and [2], which seem to be
the two files with the new C++ class interfacing. As far as I could tell,
you need to create any instances of C++ classes with C++ code / you don't
bind to the constructors directly from D and the new instance will not be
managed by D's GC? Because if I used this new interfacing for e.g. llvm-d,
I need to be sure, that D's GC won't touch any of the instances under any
circumstances, since they are freed by LLVM's internal logic they GC
cannot track.
This is correct, if you want to construct a class implemented in C++ you
will need to call a factory function also implemented in C++, and the same
for the other direction.
If you are using 'new' in C++ it will not use D's GC heap, unless you
overrode the global 'new' operator or something.
The simplest model is to do all lifetime management in the original language
and ensure that objects stay alive while there are live references in the
other language.