很不理解,请高手帮助
//定义读卡程序
[DllImport("Mwic_32.dll",EntryPoint="asc_asc",CallingConvention=CallingConvention.StdCall)]
public static extern int asc_asc(ref string source, ref string dest, ulong length);
[DllImport("Mwic_32.dll",EntryPoint="asc_hex",CallingConvention=CallingConvention.StdCall)]
public static extern int asc_hex(ref string ascc, ref string hex ,ulong length);
[DllImport("Mwic_32.dll",EntryPoint="hex_asc",CallingConvention=CallingConvention.StdCall)]
public static extern int hex_asc(string hex,ref string ascc, ulong length);
定义以上的读卡程序后,下面进行读卡时就提示错误
//测试一下程序
string ls_hex;
ls_hex="123456";
string ls2="FFFFFF";
int ic_re=100;
ic_re=hex_asc(ls_hex,ref ls2,3);
MessageBox.Show(ls_hex);
MessageBox.Show(ls2);
MessageBox.Show(ic_re.ToString());
错误提示:
未处理的“System.NullReferenceException”类型的异常出现在 WindowsApplication1.exe 中。
其他信息: 未将对象引用设置到对象的实例。
很不明白!!