Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > Apps

Lost Password?

Thread Tools Display Modes
Old 04-06-2010, 11:33 AM
joejoe79sa joejoe79sa is offline
Junior Member
Join Date: May 2008
Posts: 5
Default dll load and unload

Hi all

I have a problem loading dll more than once. i have 2 functions (just the raw idea of it below )

function LoadDLL(DLL_FileName: string): Boolean;
Result := FALSE;
DLLHandle := LoadLibrary(PChar(DLL_FileName)) ;
Result := true;

function UnloadDLL: Boolean;

Result := FALSE;
if DLLHandle <> 0 then

Result := TRUE;


some reports are dll's so i just call the dll to do a report. so i call a dll as follow

LoadDLL(ExtractFilePath(Application.ExeName) + '\Reports\Client.dll');

this works fine for this report but as soon as i try to run the next dll report for instance

LoadDLL(ExtractFilePath(Application.ExeName) + '\Reports\Accounts.dll');

the application terminates. If i dont run the unloaddll function then i can open the next report but not the same one i allready opened before.

Any ideas?
Reply With Quote
Old 04-06-2010, 12:09 PM
Norrit Norrit is offline
Join Date: Aug 2001
Location: Landgraaf
Posts: 7,333

You're using 1 global variable to store the id of multiple dll's... This cannot be done this way, either store them in a list or just use them as local variables...
Furthermore, you validate if the dll is loaded in the unloadDll, but not in the loadDll...
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 11:02 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.