Convert C# Matrix to c++ FLOAT*
See the question and my original answer on StackOverflowThis is how you could do declare it in C++ to be usable by C# (see p/invoke tutorials):
extern "C" {
__declspec( dllexport ) void STDMETHODCALLTYPE Go(float* pMatrix);
void Go(float* pMatrix) {
// do your stuff here. assume the matrix has 16 elements
}
}
and in C#:
[DllImport("myDll.dll")]
public static extern void Go(float[] matrix);
Sample C# code:
Matrix m = myMatrix;
Go(m.ToArray());
EDIT: if you use a C++/CLI managed assembly, then you could declare the function like this:
using namespace System;
public ref class Class1
{
public:
void Go(array<float> ^ pFloat)
{
...
}
};