Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with DLL

Status
Not open for further replies.

EricDraven

Programmer
Jan 17, 2002
2,999
GB
Hi

I have just written my first DLL using the examples both in the delphi help pages and in past posts on these boards (many thanks McMerfy). I have it working fine using the following code.

hLib := LoadLibrary('C:\MyFolder\Reports.dll');
if (hLib <> 0) then
begin
try
@MyProc := GetProcAddress(hLib, PChar('MyProc'));
if Assigned(MyProc)then
MyProc(1,1);
finally
FreeLibrary(hLib);
end;
end;

I have added a form to the DLL which I create at the top of the MyProc procedure and then free at the end. The form contains several tables and a quickreport. The report previews fine but after closing the dll, I receive an EAbort exception error???

Does anybody have any ideas??? Arte Et Labore
 
hi Eric,

I always close my forms which are inside a DLL because unloading a DLL with a form open sometimes caused exceptions.

So what I did is exporting another procedure, e.g. named &quot;ExitMyProc&quot;, which closes the form. Call this procedure before unloading the DLL.

Maybe you could also try closing the form in the finalization part of the DLL.

best regards
Roderich
 
Thanks for the response. I tidied up my code a little and the problem seems to have stopped with me still not being 100% sure what it was.

As for your suggestion of closing everything, I already am! I never seem to encounter the straight forward problems! Arte Et Labore
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top