What    |Removed                     |Added
                 CC|                            |[EMAIL PROTECTED]
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID

------- Comment #1 from [EMAIL PROTECTED]  2008-11-30 14:54 -------
That's not supposed to work, see  Scroll down to "Calling
C++ Virtual Functions From D" on that page.  C++ functions have to be either
global or virtual, and you need to create an interface on the D side.  C++
struct virtual methods won't work, since the name mangling is different than
for classes.  And you need to instantiate and delete C++ objects in C++ code,
not D code.

This works, at least on Windows:

foo.cpp file:
class Board{ public: virtual void clear(){} };

Board* createBoard() { return new Board; }
void freeBoard(Board* b) { delete b; }

bar.d file:
extern(C++) interface Board
    void clear();

extern (C++) Board createBoard();
extern (C++) void freeBoard(Board b);

void main()
  Board b = createBoard();


Reply via email to