What is DLL ?


In computer science, a dynamic-link library is a software library that is dynamically loaded at run time, instead of being statically linked to an executable at compile time. These libraries are known by the extension DLL, which is the extension of the file they have in the Microsoft Windows operating system, or even with the term shared libraries (from shared library, used in the literature of Unix systems). In systems that use ELF as an executable file format, such as Solaris or Linux, they are also known as “.so”, short for Shared Object.

The following describes the structure and operation of a dynamic link library in a Windows environment, however the concepts expressed are generally equivalent in all systems that allow the use of dynamic libraries.

A dynamic link library is actually an executable code. Each executable file (EXE or DLL) has an entry point (entry point) invoked by the operating system immediately after loading. For a DLL the entry point is mapped by convention on the DllMain function.

The DllMain function, in addition to loading the DLL, is also invoked when it is downloaded or when a thread is created or destroyed in the process in which the DLL resides.

Unlike an EXE file, the DLL must exit the entry point as soon as it has completed the necessary initializations.

Dynamic libraries are loaded by the operating system into the memory space of the process that requested them. In this way the access to the DLL code will have performances almost equivalent to those of the code of the application itself or of the code of the static libraries (later we will see why they are almost equivalent).

To avoid that the application code and the DLL code occupy the same position in memory, the linker will have to prepare the DLL for relocation. In practice, the operating system determines an available memory area and remaps any reference to the memory contained in the DLL code. Since this operation takes time, each DLL has its own ideal base address: the relocation will only be necessary if a previous DLL has already been mapped to this predetermined address. To specify the ideal address you can use an empirical rule, based on the initial letter of the DLL name, according to the following table:

The connection of an executable to a dynamic library occurs during execution (at run time) and takes place via the LoadLibrary API, which accepts the library name as input. For example, LoadLibrary (_T (“MyLib.dll”)) will load the MyLib.dll DLL into the application’s memory space.

Download DLL – thousand of missed dlls, you can download for windows.