求助C#如何调用C++字符串
本人编程渣渣。。网上教程看不懂
我把代码贴出来
C++中的dll函数原型是
extern "C" __declspec(dllexport) const char *Add(const char *x)
{
return x;
}
C#声明是()
[DllImport("Algorithm.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.Cdecl)]
public static extern string Add(string x);
我现在在窗口上想把字符串输出到textbox上
textbox.Text = CPPDLL.Add("fdsfdf");
一运行就显示vshost32.exe已停止运行
脑袋都要大了求救啊