Friday, 13 June 2014

Windows DLL and Introduction to Windows DLL

Filled under:

Post By: Hanan Mannan
Contact Number: Pak (+92)-321-59-95-634
-------------------------------------------------------

Windows DLL


picture
Dynamic link library (DLL) is Microsoft's implementation of the shared library concept.
In our tutorial you will learn what exactly is a DLL and how to write DLL and how to use them.
Pre-Requisite!  You must have good understanding of Windows concepts and you should be familiar with either VC++ or C/C++


Introduction to Windows DLL


Dynamic linking is a mechanism that links applications to libraries at run time. The libraries remain in their own files and are not copied into the executable files of the applications. DLLs link to an application when the application is run, rather than when it is created. DLLs may contain links to other DLLs.
Many times, DLLs are placed in files with different extensions such as .EXE, .DRV or .DLL.

Advantages of DLL

  • Uses fewer resources
    The advantage of DLL files is that, because they don't get loaded into random access memory (RAM) together with the main program, space is saved in RAM. When and if a DLL file is needed, then it is loaded and run. For example, as long as a user of Microsoft Word is editing a document, the printer DLL file does not need to be loaded into RAM. If the user decides to print the document, then the Word application causes the printer DLL file to be loaded and run.
  • Promotes modular architecture
    A DLL helps promote developing modular programs. This helps you develop large programs that require multiple language versions or a program that requires modular architecture. An example of a modular program is an accounting program that has many modules that can be dynamically loaded at run time.
  • Eases deployment and installation
    When a function within a DLL needs an update or a fix, the deployment and installation of the DLL does not require the program to be relinked with the DLL. Additionally, if multiple programs use the same DLL, the multiple programs will all benefit from the update or the fix. This issue may more frequently occur when you use a third-party DLL that is regularly updated or fixed.
Applications and DLLs can link to other DLLs automatically if the DLL linkage is specified in the IMPORTS section of the module definition file as part of the compile or you can explicitly load them using the Windows LoadLibrary function.

Examples of Important DLL files

  • COMDLG32.DLL - Controls the dialog boxes
  • GDI32.DLL - Contains numerous functions for drawing graphics, displaying text, and managing fonts
  • KERNEL32.DLL - Contains hundreds of functions for the management of memory and various processes
  • USER32.DLL - Contains numerous user interface functions. Involved in the creation of program windows and their interactions with each other

0 comments: