A DLL is a type of file that contains executable codes, resources like data, images, etc and cannot be directly executed, but can be executed by an application. DLL files are very important and essential for Windows Operating system and .Net based applications. This article describes what a dynamic link library (DLL) is, basic overview of DLL. Summary of the article:
- What is DLL or Dynamic-Link Library?
- Advantages of DLL
- Properties of DLL
What is DLL or Dynamic-Link Library?
A DLL is a library that contains code and data that can be used by more than one program or application simultaneously. For example, the Comdlg32 DLL performs common dialog box related functions, in Windows operating systems. This helps us to reuse same code and efficient memory usage.
It is a library developed by Microsoft Corporation for Microsoft Windows and OS/2 operating systems. Generally it has DLL, OCX (for libraries containing ActiveX controls), or DRV (for legacy system drivers) file extension.
Some files that are used as a DLL in Windows operating systems is given bellow:
- ActiveX Controls (.ocx) files
The calendar control is an example of .ocx file that allows us to select a date from a calendar.
- Control Panel (.cpl) files
An item in the Control Panel is an example of .cpl file. Here every item is a specialized DLL file.
- Device driver (.drv) files
A printer driver is an example of .drv file that controls the printing of a printer.
Advantages of DLL
A DLL file can provide us a lot of advantages. Some benefits of DLL files are given bellow:
- It uses fewer resources. When multiple programs use the same functions of a DLL library,it can reduce the redundancy of code that is loaded on the disk and in physical memory. It increases the performance of all programs
- It promote modular architecture. It encourages us to developed modular program. That’s why we can develop large programs that require multiple programming language and there version may differ. Accounting program is a good example of modular program. It has many modules and all the modules may run at the same time
- It is easy for deployment and installation. If multiple programs use the same DLL and we update the DLL, then all the programs will be benefited
- It provides better security. We can encrypt our codes by creating a DLL file
Properties of DLL
Some common properties of DLL are given bellow:
- It can not be executed without the help of EXE file
- It has no main function
- A dll is a library that a .exe (or another .dll) may call
The DLL files are very important for .Net based development. It provides code re-usability and security. If possible try to generate and use DLL instead of general class during development.