C++ Interfacing:'static' array function parameter contradiction
kinke via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Apr 28 10:15:54 PDT 2017
On Friday, 28 April 2017 at 15:56:17 UTC, ParticlePeter wrote:
> So what next? How can I interface to the cpp function?
*** C++:
bool cppFunc(float (&color)[3])
{
color[0] = 1;
color[1] = 2;
color[2] = 3;
return true;
}
*** D:
extern(C++) bool cppFunc(ref float[3] color);
void main()
{
float[3] my_color;
cppFunc(my_color);
assert(my_color == [ 1, 2, 3 ]);
}
More information about the Digitalmars-d-learn
mailing list