I have a working VS2010 solution that has a C# program passing an array to a C++ DLL using this syntax:
In the C++ file:
void MyClass::MyFunction( array< Byte >^% byteArray, unsigned int size )
Where the first parameter is a pointer to the array and the second is the number of elements in it.
In the C# file I call this function like so:
MyClass myClass = new MyClass();
byte[] bArray = new byte[8];
myClass.MyFunction(ref bArray, 8)
This all works. But I am now trying to port the code to a VS2015 solution and the C++ code is failing to compile.
In the C++ project VS puts a red squiggle under the trailing >
in the function definition, and the message seems to be too few arguments for class template "std::array"
My guess is that either the std::array template definition changed between VS2010 and VS2015, or the compiler itself changed (and is now more strict)
This question seems to back up my guess and points that the std::array
needs an additional size parameter. However I am trying to pass in an array of an arbitrary size.
So my question is: can I achieve the same functionality in VS2015? If so, how?