c的dll声明函数如下
void test(char data[][4096])
{
printf(data[0]);
if (strcmp(data[0],"hello") == 0)
{
strcpy(data[0], " hi");
}
if (strcmp(data[1], "hello") == 0)
{
strcpy(data[1], " en");
}
}
c# 来调用
[DllImport("test.dll", EntryPoint = "test", CallingConvention = CallingConvention.Cdecl)]
public static extern char test(char[,] ms);
char[,] ms = new char[2, 4096];
ms[0, 0] = 'h';
ms[0, 1] = 'e';
ms[0, 2] = 'l';
ms[0, 3] = 'l';
ms[0, 4] = 'o';
ms[1, 0] = 'h';
ms[1, 1] = 'e';
ms[1, 2] = 'l';
ms[1, 3] = 'l';
ms[1, 4] = 'o';
test(ms);
值是传递过去了,但是那边strcpy拷贝的数据并没有回来,不知道为啥,感觉像是值传递了,怎么解决,应该怎么调用