Calling C++ "void foo(Klass&)"

Johan Engelen via Digitalmars-d digitalmars-d at puremagic.com
Tue Aug 8 11:51:19 PDT 2017


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:
https://forum.dlang.org/post/tvohflgtaxlynpzedqky@forum.dlang.org

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

At the very least, we should add information about this to the 
C++ interfacing page, https://dlang.org/spec/cpp_interface.html .

- Johan



More information about the Digitalmars-d mailing list