Struct default constructor - need some kind of solution for C++ interop
Ethan Watson via Digitalmars-d
digitalmars-d at puremagic.com
Wed Sep 7 05:07:56 PDT 2016
On Wednesday, 7 September 2016 at 11:42:40 UTC, Dicebot wrote:
> If it is so, I'd call it a major extern(c++) bug.
The documentation seems to be correct. I can't extern( C++, class
) or extern( C++, struct ) on an object, even in DMD
2.071.2-beta3.
But ignoring that. My first member is offset by 8 bytes, even in
an extern( C++ ) class. I assume it's just blindly sticking a
vtable in there regardless of if I actually define virtual
functions or not.
But regardless. Making it a class is still a bad idea since in
this exact example it needs to exist on the stack/within an
objects scope, which means you then need to further hack around
with emplacement and wrappers and blah.
Binary matching, non-trivial constructors, and treating C++
objects like the value types they are will be required to make
Binderoo work effortlessly. I've got two out of three of those.
Not having any one of those is something of a deal breaker unless
I get an effective workaround.
More information about the Digitalmars-d
mailing list