How does inheritance and vtables work wrt. C++ and interop with D? Fns w/ Multiple-inheritance args impossible to bind to?

Ola Fosheim Grostad ola.fosheim.grostad at gmail.com
Sun May 23 20:16:17 UTC 2021


On Sunday, 23 May 2021 at 19:44:01 UTC, Gavin Ray wrote:
> So one of the problems with generating D code for bindings to 
> C++ is that there's no true/direct multiple inheritance.
>
> If anyone happens to understand well how vtables work and the 
> way the compiler treats these things, is there a way to hackily 
> make semantically-equivalent objects?

I believe Clang and MSVC are using different layouts.
If I am not wrong clang/gcc are using the Itanium ABI, but I 
could be wrong.

https://itanium-cxx-abi.github.io/cxx-abi/abi.html#vtable

Maybe ask in the LDC forum as they follow Clang? In my opinion MI 
ought to be supported for binding, but... not sure if anyone has 
considered it.


More information about the Digitalmars-d-learn mailing list