On Wed, 23 Nov 2011 21:04:04 +0100, mta`chrono <[email protected]> wrote:

It actually needs a tiny patch on windows (nonvirtual_fun is mangled as
static function). Unfortunately I did not find a way to sensibly declare
member "a" in D. There is another bug that a derived class is using a
wrong virtual function table offset, but that should be fixable.

It's very important that dmd will be able to call C++'s non virtual
functions and it's ctors/dtors. But there must be some significant
reasons why Walter didn't accept the patch.


Forget about ctor/dtors, even if C++ object construction boiled down to
a function call, you would need the size of a struct/class. C++ interfacing
will rather only ever work with references. It should be possible to simply
create smart pointers that wrap C++ classes in D though.

extern(C++)
{
  interface Foo
  {
     // using convention names
     static Foo* construct();
     static void destruct(Foo*);

     int blah1();
     final void blah2();
  }
}

alias DSmartPtr!(Foo) DFoo;

Reply via email to