How do I call a C++ struct default constructor from D?

evilrat via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Feb 8 03:26:21 PST 2017


On Tuesday, 7 February 2017 at 14:26:11 UTC, MGW wrote:
> On Tuesday, 7 February 2017 at 13:37:01 UTC, Atila Neves wrote:
>
> Here still example
> https://pp.vk.me/c636630/v636630885/46579/neSdIip1ySI.jpg

I'm sorry for being offensive, but...

Of course, and the next step will be pragma mangle on D function 
to map it to correct ctor, then we call malloc(oops, how do we 
know correct class instance size?), then we call placement new 
from C++ RT on malloc'd memory, easy. Oh and then we also should 
call pragma mangled dtor, we do want no mem leaks, right?

Now, sorry for being sarcastic but this is not the way, just 
imagine making all this new wrappers for every ctor manually for 
any serious project like Qt, PhysX, Bullet Physics, or FBX or 
Alembic SDK... Ok, and then we are standing at the point of 
supporting the future releases and changes


More information about the Digitalmars-d-learn mailing list