DLL函数调用出错:未将对象引用设置到对象的实例
[DllImport("Attend3X.dll",SetLastError = true)]
private static extern int GetRecordEx(
int nPort,int nAddress,long nRecordAddress,ref UInt32 nCardNo,ref DateTime tDateTime,
ref string PBackData,ref int nBackDataLen)
.....
调用时
int nPort = 1;
int nAddress = 1;
long nRecordAddress = 0L;
DateTime tRecordDateTime = new DateTime(DateTime.Now.Year,DateTime.Now.Month,
DateTime.Now.Day);
string sBackData = "";
int nBackDataLen = 0;
int nRet = GetRecordEx(nPort,nAddress,nRecordAddress,ref nCardNo,ref tRecordDateTime,
ref sBackData,ref nBackDataLen)
出错:未将对象引用设置到对象的实例
该动态库其他函数调用正常
动态库为DELPHI所写,
函数声明为
function GetRecordEx(Port,Address:byte;RecordAddress:LongInt;var CardNo:longword;
var DateTime:TDateTime;var PBackData:PChar;var BackDataLen:integer):integer;stdcall;
external 'Attend.dll';
private static extern int GetRecordEx(
int nPort,int nAddress,long nRecordAddress,ref UInt32 nCardNo,ref DateTime tDateTime,
ref string PBackData,ref int nBackDataLen)
.....
调用时
int nPort = 1;
int nAddress = 1;
long nRecordAddress = 0L;
DateTime tRecordDateTime = new DateTime(DateTime.Now.Year,DateTime.Now.Month,
DateTime.Now.Day);
string sBackData = "";
int nBackDataLen = 0;
int nRet = GetRecordEx(nPort,nAddress,nRecordAddress,ref nCardNo,ref tRecordDateTime,
ref sBackData,ref nBackDataLen)
出错:未将对象引用设置到对象的实例
该动态库其他函数调用正常
动态库为DELPHI所写,
函数声明为
function GetRecordEx(Port,Address:byte;RecordAddress:LongInt;var CardNo:longword;
var DateTime:TDateTime;var PBackData:PChar;var BackDataLen:integer):integer;stdcall;
external 'Attend.dll';
...全文
相关推荐
未将对象引用设置到对象的实例--可能出现的问题总结
1、ViewState 对象为Null。 2、DateSet 空。 3、sql语句或Datebase的原因导致DataReader空。 4、声明字符串变量时未赋空值就应用变量。 5、未用new初始化对象。 6、Session对象为空。 7、对控件赋文本值时,值不存在。 8、使用Request.QueryString()时,所获取的对象不存在,或在值为空时未赋初始值。 9、使用FindControl时,控件不存在却没有做预处理。 10、重复定义造成未将对象引用设置到对象的实例错误.
asp.net运行提示未将对象引用设置到对象的实例错误解决方法
asp.net运行提示未将对象引用设置到对象的实例错误解决方法,需要的朋友可以参考下
java用JNA调用dll实例,包含各种参数调用
实例中演示了各种参数形式的DLL函数调用,如:基本数据类型、基本数据类型的指针和引用、结构体、结构体的指针和引用、函数指针和回调函数、字符串指针、输入数组、输出数组等,非常实用。
msdbg2.dll(为解决VS2005调试时出错:dll msdbg2.dll 未正确安装)
解决调试器 dll msdbg2.dll 未正确安装的dll文件。含64、86的7.0、8.0、9.0等多版本,按需安装即可
dll文件及Python调用方法(实例)addTest.dll
dll文件及Python调用方法(实例)利用Python对addTest.dll示例dll进行调用测试。



