C#获取dll char*返回值
C:
extern "C" __declspec(dllexport) char * Show2()
{
unsigned char output[32] = { '1','2','3','4','5','6','7','8','9' };
unsigned char *show = &output[0];
char * show2 = (char *)show;
return show2;
}
C#
[DllImport(@"C:\Users\HJD\Documents\Visual Studio 2015\Projects\CUseDll\CUseDll\bin\Debug\DLLCPP.dll", CharSet = CharSet.Ansi, ExactSpelling = false)]
public static extern string Show2();
string receive = Show2();
执行到这里就崩溃了 求解。