【发布时间】:2012-12-02 10:06:11
【问题描述】:
C++ win32dll1.dll:
extern "C" __declspec(dllexport) int getSerialNumber(char* outs)
{
char s[2];
s[0]='0';
s[1]='1';
for(int i=0; i < 2; ++i){
outs[i] = s[i];
}
return 1;
}
C#:
[DllImport("win32dll1.dll")]
public unsafe static extern int getSerialNumber(char* ss);
无法在函数中传递s
char[] s = new char[2];
getSerialNumber(s);
这不应该吗?为什么或为什么不?
【问题讨论】: