On 2017-08-08 20:51, Johan Engelen wrote:
Hi all,
   Currently, it is not possible to call the C++ function "void
foo(Klass&)" when Klass is an extern(C++) _class_ on the D side. You
have to declare Klass as a D _struct_, otherwise there is no way to get
the correct mangling. When Klass has virtual functions, you're hosed.

For more context (involving "const"), see:

Is this problem on anybody's radar?
What are the ideas to resolve this issue, or are we content never to
solve it?

One way to do it, that might be a bit confusing, is to force the declaration of the function to explicitly specify a pointer or a reference. Currently it looks like it's an implicit pointer.

extern (C++) class Klass {}
void foo(Klass*); // ok
void foo(ref Klass); // ok
void foo(Klass); // error

Of course, there's always pragma(mangle) as well.

/Jacob Carlborg

Reply via email to