Thread overview
C++ binding issues with "overloading" pragma mangle
June 22
Using DMD I can "overload" extern C++ function signatures, but this does not work with LDC:

C++ Function:
bool cppFunc( float[3] color );

D binding:
extern(C++):
pragma( mangel, cppFunc.mangleof ) bool cppFunc( ref float[3] color );
pragma( mangel, cppFunc.mangleof ) bool cppFunc( float* color );

LDC Error: Function type does not match previously declared function with the same mangled name: cppFunc.mangleof

Is this some precaution or is unique mangling really necessary? If not, could this requirement be removed?


June 22
On 22 Jun 2017, at 15:53, ParticlePeter via digitalmars-d-ldc wrote:
> Is this some precaution or is unique mangling really necessary? If not, could this requirement be removed?

It is merely a precaution – the requirement could be removed by having LDC insert bitcasts as appropriate on the LLVM IR level.

 — David
June 22
On Thursday, 22 June 2017 at 15:03:05 UTC, David Nadlinger wrote:
> On 22 Jun 2017, at 15:53, ParticlePeter via digitalmars-d-ldc wrote:
>> Is this some precaution or is unique mangling really necessary? If not, could this requirement be removed?
>
> It is merely a precaution – the requirement could be removed by having LDC insert bitcasts as appropriate on the LLVM IR level.
>
>  — David

Thanks, I'll post an issue on github and link this thread.