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 04:25:31 PDT 2017


On Monday, 22 May 2017 at 08:25:45 UTC, evilrat wrote:
> On Monday, 22 May 2017 at 08:03:07 UTC, ParticlePeter wrote:
>>
>> No, no, this (other) way around :-), still C++ to D. It 
>> actually works btw:
>>
>> -------- HACK -------------------
>> // original C++
>> ImVec2 GetCursorPos();
>>
>> // C++ helper
>> void GetCursorPos(ImVec2& result) {
>>   result = GetCursorPos();
>> }
>>
>> // bind with
>> extern(C++)
>> void GetCursorPos(ref ImVec2 result);
>> ----------------------------------
>
> My proposed hack is purely D side though O_-

Then I am not getting your hack, this function here, does not 
exist on the C++ side.
-------- HACK -------------------
// extern(C++) of course
void GetCursorPos(ImVec2* v);

How is it supposed to work then if there is no definition?



More information about the Digitalmars-d-learn mailing list