I have a C++ .DLL and C# application. In DLL I have a function like:
namespace Sample
{
public ref class SampleClass
{
public:
int f(int arr[], int length);
};
}
How can I call it from C# application? Problem is that in C++ I can use only int* argument and cannot declare int[], and only int[] variable in c#.
I have tried to declare int*[] type in C# but it is impossible due to
Cannot take address of a managed type
error. I have no idea how can I put an array into this function.
Upd: trying to dllimport like
[DllImport("samplelib.fll", EntryPoint = "Sample.SampleClass.f")]
but that seems to be wrong.