C++ Interfacing:'static' array function parameter contradiction

via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Apr 29 11:54:36 PDT 2017


On Saturday, 29 April 2017 at 08:08:27 UTC, ParticlePeter wrote:
> On Saturday, 29 April 2017 at 00:31:32 UTC, Nicholas Wilson 
> wrote:
>>
>> If you are having problems with the linker with Ali's you can 
>> do
>> ```
>> extern(C++) bool cppFunc( float[3] color ); // correct 
>> signature, but causes compiler error
>>
>> pragma(mangle, cppFunc.mangleof)
>> float cppFunc(float * color); // compatible signature but 
>> wrong mangling overridden with pragma(mangle,...)
>
> Thanks for that hint! I got it to work. Side note, 
> cppFunc.mangleof cannot be used as it is unknown. I guess your 
> intention was to get the C++ mangling from somewhere else, I 
> got it from dependency walker.

But still, this needs to be fixed, copy pasting the name mangling 
is in my opinion just a hack for your specific cpp compiler on 
your specific platform.


More information about the Digitalmars-d-learn mailing list