I would like to call this C++ function from my C# code:
void GetArrayOfNames(char** names, int nbOfNames);
To call it in C++, I just define an array of char*:
char* aNames[20];
And allocate each name in a loop:
for(int i-0; i<20; i++)
{
aNames[i] = new char[50];
}
Then call:
GetArrayOfNames(aNames, 20);
In my C# code, I have:
[DllImport("MyDLL.dll")]
unsafe static extern void GetArrayOfNames(char** ppNames, int nbOfNames);
Now, how do I do the memory allocation and call GetArrayOfNames? Also, any way of not having to declare my function as "unsafe"?