C#调用C++编写的dll函数参数为指针
如题,c#调用c++编写的dll,其中函数为char*,如何传递参数值.
举例:c++函数原型为bool Test(char*,input,char* output);其中返回值为真表示函数调用成功,假表示调用失败,参数output是我们最终要的结果。如果是c++里调用此dll函数十分简单,没有任何问题,可在c#里就不知道如何操作了,我试了
[DllImport("****.dll",EntryPoint = "Test")]
static extern bool Test(string input, ref string output);
这样的调用,程序出错:“尝试读取或写入受保护的内存”
static extern bool Test(string input, ref char[] output);
这样的调用,程序出错:“System.ExecutionEngineException”
c#没怎么搞过,望高手指点!