April 16, 2014
"Moritz Maxeiner"  wrote in message news:nadswyordziiiixwaywi@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. 

April 16, 2014
"monnoroch"  wrote in message news:kqjrnqecnfejmiwnkwom@forum.dlang.org... 

> What about namespaces?

Zero support currently.
April 16, 2014
On Wednesday, 16 April 2014 at 17:16:07 UTC, Daniel Murphy wrote:
> If you are using 'new' in C++ it will not use D's GC heap, unless you overrode the global 'new' operator or something.

Which, if you did, would enable you to use C++ classes from D somewhat transparently, no?
April 17, 2014
"John Colvin"  wrote in message news:qbwxwxekffpegmbckejx@forum.dlang.org...

> Which, if you did, would enable you to use C++ classes from D somewhat transparently, no?

Potentially, yes.  You'd need to be very careful that there was always a gc-visible reference to the class to keep it alive, so no using malloc for arrays of class pointers etc in the C++ code.  This is done in DDMD by using a wrapper which forwards to GC.malloc. 

1 2
Next ›   Last »