Bug on C/C++ library to D, parameters suddenly becomming null or invalid

Hipreme msnmancini at hotmail.com
Mon Oct 19 17:49:24 UTC 2020


On Saturday, 17 October 2020 at 20:43:03 UTC, Avrina wrote:
> On Saturday, 17 October 2020 at 18:03:45 UTC, Hipreme wrote:
>> [...]
>
>
>
> You have to look at more than the declaration. The ABI depends 
> on the types being passed as well. Unfortunately C++/C aren't 
> direct translations with D and you hav to sometimes do hacks so 
> that a D type is passed the same way as a C++ type. I'd 
> investigate whether the type is POD or not. By the looks of it, 
> it is being passed as a register.


So, I have finally solved the issue:

I asked for help to the binding mantainer and it seems that when 
the C++ file gets compiled on MSVC it turns into a non-POD 
struct, while on MinGW and GCC it turns into a POD, so it was 
quite strange, it was solved by creating a function on the C side 
which would receive a pointer to this POD-mutating struct instead 
of returning and assigning its value on this _out parameter.

The void* being the real parameter was related for some missing 
extern(System)


More information about the Digitalmars-d mailing list