ورود

View Full Version : اجرای فایل DLL و پیغام خطا حافظه



spicirmkh
سه شنبه 22 شهریور 1384, 12:30 عصر
سلام دوستان

من توی برنامه ام از چندین فایل DLL استفاده می کنم بصورت دینامیک اما بعد از چند بار اجرا پیغام خطا زیر را می دهد به نظر من حافظه تخصیص داده شده آزاد نمی شود

پیغام خطا :



instruction at "0x05bf3a42" referenced memory at "0x0622f26c" the memory could not be " read"


تابع که DLL را فرا می خواند



procedure TFormMain.Label1Click(Sender: TObject);
var
LibHandle: THandle;
SFCustomer : TSFCustomer;
begin
if datam.DBofficeCustomerID.Value=0 then exit ;
DBLCustomer.Refresh ;

LibHandle := LoadLibrary('DCustomer.dll');

try
if LibHandle = HINSTANCE_ERROR then
raise EDLLLoadError.Create('Unable to Load DLL');
@SFCustomer := GetProcAddress(LibHandle, 'SFCustomer');
if not (@SFCustomer = nil) then
SFCustomer(datam.DBofficeCompanyID.Value,datam.DBo fficeCustomerID.Value) ;
FreeLibrary(LibHandle);
finally
FreeLibrary(LibHandle);
end;
end;





یکی از دوستان توی تاپیک کفت که بعد خروج باید فرم آزاد کنیم مثل Formmain.Free اما بهد خروج پیغام خطا می دهد