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);
Not able to pass s
in the function
char[] s = new char[2];
getSerialNumber(s);
Shouldn't this work? Why or why not?