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

ParticlePeter via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun May 21 13:46:13 PDT 2017


On Sunday, 21 May 2017 at 19:58:32 UTC, Stefan Koch wrote:
> On Sunday, 21 May 2017 at 19:33:06 UTC, ParticlePeter wrote:
>> I am statically linking to ImGui [1] on Win 10 x64, quite 
>> successfully till this issue came up. The noticed error so far 
>> comes when an ImGui function returns an ImVec2, a simple POD 
>> struct of two float members. I can use this struct as argument 
>> to functions but when it is returned from a function I get a 
>> 0xC0000005: Access violation reading location 
>> 0xFFFFFFFFFFFFFFFF. I can even debug the process with Visual 
>> Studion, mixed d and c++ sources. The functions I tested 
>> return data from some internal global ImGui data, which I can 
>> fully examine, the crash happens on the return statement. 
>> Moreover, some functions have variations which return only one 
>> component from that ImVec2 POD, which do work as expected, 
>> e.g.:
>>
>> [...]
>
> are you aware of https://github.com/Extrawurst/DerelictImgui ?

Yes I am, its (understandably) not being updated too regularly, 
it goes the route of creating a C binding, and a D binding on 
top, lot of work. We should be able to bind the C++ variant 
directly by now I think.


More information about the Digitalmars-d-learn mailing list