Question about calling D method from C/C++
Eric
eric at makechip.com
Sun Jun 2 21:32:29 PDT 2013
If I use "new" inside a D method that is called from a c++ program
it causes a segmentation fault. For example:
C++ code:
#include "dcode.h"
int main(int argc, char *argv[]) {
hello();
return(0);
}
D code:
class X {
private int x;
this() { x = 5; }
public int getX() { return(x); }
}
extern (C++) void hello() {
X x = new X();
}
This will crash when the line "X x = new X()" is executed.
Is this to be expected?
More information about the Digitalmars-d-learn
mailing list