Dynamic Link Library. Advvantages And Disadvantages



dynamic-link library (DLL) is a module that contains functions and data that can be used by another module (application or DLL).

A DLL can define two kinds of functions: exported and internal. The exported functions are intended to be called by other modules, as well as from within the DLL where they are defined. Internal functions are typically intended to be called only from within the DLL where they are defined. Although a DLL can export data, its data is generally used only by its functions. However, there is nothing to prevent another module from reading or writing that address.

DLLs provide a way to modularize applications so that their functionality can be updated and reused more easily. DLLs also help reduce memory overhead when several applications use the same functionality at the same time, because although each application receives its own copy of the DLL data, the applications share the DLL code.

The Windows application programming interface (API) is implemented as a set of DLLs, so any process that uses the Windows API uses dynamic linking.

A DLL is a library that contains code and data that can be used by more than one program at the same time. For example, in Windows operating systems, the Comdlg32 DLL performs common dialog box related functions. Each program can use the functionality that is contained in this DLL to implement an Open dialog box
Your DLL files are located in C:\Windows\System32. When Windows Defender runs a Full Scan, it includes that directory and so all of your DLLs will be scanned. This will scan your DLL files for any malware infections

Advantages of Dynamic Linking

Dynamic linking has the following advantages over static linking:

  • Multiple processes that load the same DLL at the same base address share a single copy of the DLL in physical memory. Doing this saves system memory and reduces swapping.
  • When the functions in a DLL change, the applications that use them do not need to be recompiled or relinked as long as the function arguments, calling conventions, and return values do not change. In contrast, statically linked object code requires that the application be relinked when the functions change.
  • A DLL can provide after-market support. For example, a display driver DLL can be modified to support a display that was not available when the application was initially shipped.
  • Programs written in different programming languages can call the same DLL function as long as the programs follow the same calling convention that the function uses. The calling convention (such as C, Pascal, or standard call) controls the order in which the calling function must push the arguments onto the stack, whether the function or the calling function is responsible for cleaning up the stack, and whether any arguments are passed in registers. For more information, see the documentation included with your compiler.

A potential disadvantage to using DLLs is that the application is not self-contained; it depends on the existence of a separate DLL module. The system terminates processes using load-time dynamic linking if they require a DLL that is not found at process startup and gives an error message to the user. The system does not terminate a process using run-time dynamic linking in this situation, but functions exported by the missing DLL are not available to the program.

Save more memory and reduce page switching;

(2) DLL file and EXE file independent, as long as the output interface is unchanged (that is, the name, parameters, return value type and calling convention unchanged), the replacement DLL file will not have any impact on the EXE file, thus greatly improving the maintainability and extensibility;

(3) programs written in different programming languages can call the same DLL function just according to the function calling convention;

(4) Suitable for large-scale software development, make the development process independent, the coupling degree is small, facilitates the development and the test between different developer and the development organization.

(5) Save disk space: When an application uses dynamic linking, multiple applications can share a single copy of the DLL on disk. In contrast, when an application uses a static-link library, each application links the library code to the executable image as a separate copy.


An application that uses a dynamic-link library is not self-contained, and it relies on a DLL module to exist, and if you use dynamic linking at load time, the program starts to discover that the DLL does not exist, and the system terminates the program and gives an error message. While using runtime dynamic linking, the system does not terminate, but because the exported function in the DLL is not available, the program fails to load, and the speed is slower than the static link. When a module is updated, if the new module is incompatible with the old module, then the software that needs the module to run will die.

My QR code is as follows, welcome to exchange discussion You are welcome to pay attention to the “It question summary” subscription number. Every day to push the classic face test and interview tips, are dry! The QR code of the subscription number is as follows:

Drop your comment

Related Post

Leave a Reply

Your email address will not be published.