Static
declarations require the DLL to be present when the app is first run. I think it
loads the DLL then. Typically if the DLL is missing the exeption message "A
required DLL xxx.DLL was not found" or similar.
LoadLibrary calls let you find out if the DLL is present yourself, and
respond accordingly. You can also control the memory usage by only loading the
DLL when you actually need to.
Example: Database Desktop uses a number of DLLs present in the directory
where it is installed. If some of these DLLs are not present, certain functions
are disabled.
Example 2: You write a functionality into your program to add some
plugins, each being implemented in a DLL. At runtime it checks which DLL plugins
are present and offers them to the user if they are there, or not as the case
may be.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Jeremy Coulter
Sent: Sunday, 7 October 2001 23:07
To: Multiple recipients of list delphi
Subject: [DUG]: Best way to load a DLLHI all.I am wondering what is the best way to load/use a dll from an app.Currently, I am doing something similar to this :-Function GetSomoething(iIndex:integer):smallint;stdcall; external 'mydll.dll';This works fine, but what I am unsure about IS, is it better to do the above, or use LoadLibrary ?By declaring the function to the above keep the DLL in memory the whole time the app. is running? or does it load the dll when the function is called?Some thoughts and suggestions welcome.Thanks, Jeremy Coulter