C++ Interfacing:'static' array function parameter contradiction
ParticlePeter via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Apr 28 08:56:17 PDT 2017
C++ Function:
bool cppFunc( float[3] color );
D binding:
extern(C++) bool cppFunc( float[3] color );
Using with:
float[3] my_color;
cppFunc( my_color );
-> Error: Internal Compiler Error: unable to pass static array to
extern(C++) function.
Error: Use pointer instead.
Using with:
cppFunc( my_color.ptr );
-> Error: function cppFunc( float[3] color ) is not callable
using argument types (float*)
Altering D binding:
extern(C++) bool cppFunc( float* color );
Using with:
cppFunc( my_color.ptr );
-> error LNK2001: unresolved external symbol "bool __cdecl
cppFunc(float *)" Binding.exe : fatal error LNK1120: 1 unresolved
externals
Error: linker exited with status 1120
dmd failed with exit code 1120.
So what next? How can I interface to the cpp function?
More information about the Digitalmars-d-learn
mailing list