全部博文(788)
分类:
2009-06-10 14:03:07
我的程序是这样的
TreturnDbname=function():String;stdcall;
procedure TForm1.Button1Click(Sender: TObject);
var
returnDbname : TReturnDbname;
AHandle: THandle;
begin
CoInitialize(nil);
AHandle:=LoadLibrary('CreatePro.dll');
try
if AHandle<>0 then
@returnDbname:=GetProcAddress(AHandle,'returnDbName');
if not(@returnDbname=nil) then
begin
dbname:=returnDbname();
showmessage('dbname='+dbname);
end;
finally
freeLibrary(AHandle);
end;
end;
我把freeLibrary(AHandle);注释掉程序执行完了关闭窗口时,但是整个project1却没有关闭依然在内存里运行着;而加上freeLibrary(AHandle);在程序运行完毕连showmessage('dbname='+dbname);也执行对了点击showmessage出现的窗口后就出现这样的错误:Access violation at address 00403F7E in module 'project1.exe'.Read of address 0168B792C.请问这是什么原因啊,该怎么解决,谢谢!