有一个DLL文件里有这么一个函数:ERRCODE jSetSerialNo(const char * pcszSerialNo)
这个函数返回二种值,正确的话为ERR_NONE,错误的话为ERR_SECURITY
我想在C#中使用该函数代码如下:
[DllImport("j_MA.dll")]
public static extern string jSetSerialNo(string pcszSerialNo);
jSetSerialNo(textBox7.Text);
可我这里如果正确则返回空值,不正确程序就会出错,怎么才能像原始程序一样有两种返回值怎么获得呢?
我转换成string类型对吗?为什么会和源程序不一样的结果呢?得不到其他字符串结果
这个函数返回二种值,正确的话为ERR_NONE,错误的话为ERR_SECURITY
我想在C#中使用该函数代码如下:
[DllImport("j_MA.dll")]
public static extern string jSetSerialNo(string pcszSerialNo);
jSetSerialNo(textBox7.Text);
可我这里如果正确则返回空值,不正确程序就会出错,怎么才能像原始程序一样有两种返回值怎么获得呢?
我转换成string类型对吗?为什么会和源程序不一样的结果呢?得不到其他字符串结果
public static extern int jSetSerialNo(string pcszSerialNo);
public static extern int jSetSerialNo(string pcszSerialNo);正解。