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

Gavin Ray gavinray at site.com
Tue May 25 18:12:27 UTC 2021


On Tuesday, 25 May 2021 at 18:03:00 UTC, evilrat wrote:
> That last one with someInt is what I warned about. D ctor 
> messed up class layout, in this simple case where class data 
> isn't used it almost works, but will be practically unusable in 
> real scenarios.

Ah =/
You have this in your code example:
```d
static assert(Derived.someInt.offsetof == 16); // that's 
important otherwise D ctor will mess up everything
```

Would this fix it, or is it just not super viable to hack around 
C++ multiple inheritance in D?

Maybe generating some wrapper C++ code to be linked could help 
too?
I'm not sure though/don't really know enough to say



More information about the Digitalmars-d-learn mailing list