[Issue 17359] C++ Interfacing: function with 'static' array parameter cannot be linked (x64)
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat Apr 29 02:57:19 PDT 2017
https://issues.dlang.org/show_bug.cgi?id=17359
--- Comment #3 from kinke at gmx.net ---
So the proper workaround for MSVC targets would be:
C++:
bool cppFunc(float color[3])
{
for (int i = 0; i < 3; ++i) color[i] *= 2;
return true;
}
D:
pragma(mangle, "?cppFunc@@YA_NQEAM at Z")
extern(C++) bool cppFunc(ref float[3] color);
void main()
{
float[3] my_color = [ 1, 2, 3 ];
cppFunc(my_color);
assert(my_color == [ 2, 4, 6 ]);
}
--
More information about the Digitalmars-d-bugs
mailing list