Matching an array-type of a C++ function signature in D, without using a D-array-type, because the compiler crashes otherwise

kinke noone at nowhere.com
Sat Mar 23 13:04:10 UTC 2019


On Saturday, 23 March 2019 at 11:35:45 UTC, Simon wrote:
> Is there any way to end up with the correct mangled function 
> signature, using only pointer types?

The problem is that the C++ compiler uses head-const for the 
array param (`float * const`), which cannot be represented in D.
What you can do is specify the mangle manually, e.g.:

pragma(mangle, "?ColorEdit4 at ImGui@@YA_NPEBDQEAMH at Z")
extern(C++) bool ColorEdit4(const(char)* label, float* col, int 
flags = 0);


More information about the Digitalmars-d-learn mailing list