C++ binding issues with C++ function returning a simple POD struct.

ParticlePeter via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon May 22 11:51:43 PDT 2017


On Monday, 22 May 2017 at 14:01:56 UTC, Jerry wrote:

> IIRC the problem is that it isn't a POD type. ImVec2 has its 
> own default constructor. The problem now is that because it no 
> longer is POD, Window's ABI handles it different and doesn't 
> put the value in a register. Now with D is that you aren't 
> allowed to specify your own default constructor, so there's no 
> equivalent way for it to know that it isn't a POD. A way around 
> this is to specify your own destructor or copy constructor in 
> the D ImVec2. I forget what the rules are for it, but I think 
> that should do it.

Thanks, with any of them, ~this or this(this) (both can be 
empty), the functions work as expected, nice.

Also replying your next post, extern(C++) is on for the whole 
module:
https://github.com/ParticlePeter/imgui_lib/blob/master/source/imgui/types.d#L39

but I learned how to link to github lines from your post :-)



More information about the Digitalmars-d-learn mailing list