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 01:03:07 PDT 2017
On Monday, 22 May 2017 at 07:24:20 UTC, evilrat wrote:
> On Monday, 22 May 2017 at 06:33:37 UTC, ParticlePeter wrote:
>> On Monday, 22 May 2017 at 01:39:04 UTC, evilrat wrote:
>>>
>>> And this is actually D problem. In fact first bug report on
>>> this thing was dated back to 2014. Still not fixed.
>>
>> Thanks for your reply, do you have any links to some bug
>> report of that issue?
>>
>
> Just search for "c++ struct"
> https://issues.dlang.org/buglist.cgi?quicksearch=c%2B%2B%20struct
>
> https://issues.dlang.org/show_bug.cgi?id=13207
> https://issues.dlang.org/show_bug.cgi?id=16527
That's really old, and of essential requirement I would assume.
Thanks, I will comment the bug.
>>
>> Actually, your example would work just fine, my problem and
>> possible solution is the other way around :-). First I'll try
>> to force a copy with a wrapper func and same sig.
>
> You mean from D to C++? Well, that sucks.
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);
----------------------------------
More information about the Digitalmars-d-learn
mailing list