DLL - Dynamic Link Library
A dynamic link library (DLL) is a collection of small programs, which can be called upon when needed by the executable program (EXE) that is running. The DLL lets the executable communicate with a specific device such as a printer or may contain source code to do particular functions.
DLL files do not get loaded into RAM together with the main program, so they help to save RAM space. When and if a DLL file is called, then it is loaded in RAM.
You are editing a Microsoft Word document. If you decide to print the document, then & then only the printer DLL file is loaded and a call is made to print.
In short, DLL is an executable file that cannot run on its own, it can only run from inside an executable file.
This example will simplify so that you might understand it better:
If the program (exe) needs to get the free space of your hard drive. You will create a EXE containing following commands -
∑ Declare GetFreeSpacex, Kernel32.dll (Drive_Letter, Buffers_If_Any, Value_Returned)
Now letís run a program and make the call.
The DLL is not loaded into RAM until the next line.
∑ GetFreeSpacex "C",Buffers_If_Any, Drive_Letter
Now let's tell the user how much free space is on drive C
∑ Use a MessageBox = "The free space on drive C: is ", Value_Returned, "bytes"
This call required 3 lines of code. Where as if you did not call the DLL file it may have taken you 30 or 40 lines of code.