S
shiwee
Unregistered / Unconfirmed
GUEST, unregistred user!
我的代码是这样的:
1。外部声明:
function GetDatabaseDBTagID(TagDBInfo: PTagDBInfo; var dwErrorcode: DWORD):Integer;
cdecl external 'cxaccess.dll';
2。调用dll
procedure TForm1.BtnTestClick(Sender: TObject);
var
dwError: Cardinal;
TagInfo: PTAgDBInfo;
begin
{TagInfo初始化。。}
GetDatabaseDBTagID(TagInfo, dwError); {调用dll提供的函数}
end;
3。dll定义
function GetDatabaseDBTagID(var TagDBInfo: PTagDBInfo; var dwErrorcode: DWORD):Integer;
var
condition, TableName, FieldName: string;
HistorySQLStatementInsertTagsStr: string;
RecordCount: Integer;
Fields: TFields;
begin
Result := -1;
dwErrorCode := DATABASE_SUCCESS;
Fields := TFields.Create(nil);
TableName := 'tags';
FieldName := 'DBTagID';
Condition := Format(ConditionStr, [TagDBInfo^.TagName, TagDBInfo^.TagType, TagDBInfo^.TagAddress,
TagDBInfo^.DeviceName, TagDBInfo^.DeviceZero, TagDBInfo^.DeviceSpan]);{出错之处}
。。。。。。。。
end;
错误信息:
Project XX.exe raise exception class EAccess Voilation with message ' Access Violation at
address 002b5c3f in module 'cxaccess.dll' .Read of address 00000039'
通过对dll源码加showmessag,发现每次运行到代码中{出错之处}时,就会出错,估计是内存地址
的问题。改如何改呢。
我已经很穷了,不要嫌弃。。。。。
1。外部声明:
function GetDatabaseDBTagID(TagDBInfo: PTagDBInfo; var dwErrorcode: DWORD):Integer;
cdecl external 'cxaccess.dll';
2。调用dll
procedure TForm1.BtnTestClick(Sender: TObject);
var
dwError: Cardinal;
TagInfo: PTAgDBInfo;
begin
{TagInfo初始化。。}
GetDatabaseDBTagID(TagInfo, dwError); {调用dll提供的函数}
end;
3。dll定义
function GetDatabaseDBTagID(var TagDBInfo: PTagDBInfo; var dwErrorcode: DWORD):Integer;
var
condition, TableName, FieldName: string;
HistorySQLStatementInsertTagsStr: string;
RecordCount: Integer;
Fields: TFields;
begin
Result := -1;
dwErrorCode := DATABASE_SUCCESS;
Fields := TFields.Create(nil);
TableName := 'tags';
FieldName := 'DBTagID';
Condition := Format(ConditionStr, [TagDBInfo^.TagName, TagDBInfo^.TagType, TagDBInfo^.TagAddress,
TagDBInfo^.DeviceName, TagDBInfo^.DeviceZero, TagDBInfo^.DeviceSpan]);{出错之处}
。。。。。。。。
end;
错误信息:
Project XX.exe raise exception class EAccess Voilation with message ' Access Violation at
address 002b5c3f in module 'cxaccess.dll' .Read of address 00000039'
通过对dll源码加showmessag,发现每次运行到代码中{出错之处}时,就会出错,估计是内存地址
的问题。改如何改呢。
我已经很穷了,不要嫌弃。。。。。