DelphiFAQ Home Search:

DLLs: Import dynamic or static

 

comments3 comments. Current rating: 5 stars (2 votes). Leave comments and/ or rate it.

Both techniques have their advantages.
Static importing means you define functions like this:

function f : integer;
  external 'mydll.dll';

The advantage of static imports are:
  • It is easy - it does not require ugly code.
  • The application will only start up if all DLLs are present and can be loaded (this could also be considered a negative)
  • All functions across all modules are bound during startup time.
Dynamic importing has its advantages as well.
  • It basically gives you full control over the usage of the DLL. If your DLL is only needed rarely for a seldomly used function, you may not want to load it at startup of your application. Your application will start faster then.
  • If the application will work without that DLL to a usable extent, you may allow the user to do so.
  • If you have different DLLs for different environments, for example one for Windows NT, another one for Windows 95 etc, then you MUST bind dynamic - you determine the operating system and load the DLL that you want.
  • dynamic binding allows you to release the DLL if you do not need it anymore
The following code shows you how to do it:

Dynamic loading and binding of DLLs


Comments:

2006-01-25, 05:43:28
welmers_aj@yahoo.com from Aruba  
rating
good serie on DLL
to bad this link is not working
Dynamic loading and binding of DLLs

2006-02-18, 16:04:45
anonymous from Mexico  
rating
2006-05-07, 04:32:54
anonymous from Indonesia  
The link is working kok

 

 

Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option.
 
It seems that you are
from Los Angeles, US .

Info/ Feedback on this

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:
photo Add a picture:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity. The owner of this web site reserves the right to delete such material.