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

Simon simon.vanbernem at yahoo.de
Sat Mar 23 15:46:29 UTC 2019


On Saturday, 23 March 2019 at 13:04:10 UTC, kinke wrote:
> 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);

I didn't know specifying the mangle was possible, thanks!


More information about the Digitalmars-d-learn mailing list