Generated by DeepSeek V3.2| Dynamic-link library | |
|---|---|
| Name | Dynamic-link library |
| Developer | Microsoft |
| Released | 20 November 1985 |
| Operating system | Microsoft Windows, OS/2 |
| Genre | Library |
Dynamic-link library. A dynamic-link library is a shared library concept implemented within the Microsoft Windows and OS/2 operating systems. These libraries contain code and data that can be used by multiple programs simultaneously, promoting modular architecture and efficient memory usage. The system loads these modules into an application's address space at runtime, either when the application loads or on demand during execution.
The concept was introduced by Microsoft with the release of the Windows 1.0 operating environment, fundamentally changing how software was structured for the IBM PC platform. Unlike static libraries linked at compile time, these libraries facilitate a form of dynamic binding, allowing for smaller executable files and easier updates. The architecture is central to the Windows API, where core system functions reside in files like `KERNEL32.DLL` and `USER32.DLL`. This design philosophy was also adopted by IBM for its OS/2 operating system, creating a shared binary standard across two major platforms.
Implementation relies heavily on the Portable Executable file format, which structures the code, data, and export tables. The Windows Loader, a component of the Windows NT kernel or the DOS extender in earlier versions, maps the library into the process's virtual address space`. The `LoadLibrary` and `GetProcAddress` functions are the primary mechanisms for runtime linking, allowing programs to explicitly load a library and retrieve pointers to its functions. Internally, the system maintains reference counts via a process called DLL Hell` to manage the library's lifetime in memory, unloading it when no program requires its services.
A primary advantage is efficient memory management; a single copy in RAM` can serve multiple processes, a technique heavily utilized by the Windows Shell and the Component Object Model. This modularity also simplifies software updates and patches, as seen with service packs for Microsoft Office` or DirectX`. However, disadvantages include versioning conflicts, commonly referred to as DLL Hell`, where different applications require incompatible versions of the same library. This can lead to application failures, a problem that prompted the development of side-by-side assemblies in Windows XP` and the .NET Framework`'s global assembly cache.
In C++`, developers must manage name mangling` and use `extern "C"` to ensure clean export of functions for consumption by other languages like Visual Basic`. The Microsoft Foundation Classes` framework provides specific macros for declaring exports. For Java` applications running on Windows, the Java Native Interface` is used to call functions contained within these libraries. Languages in the .NET Framework`, such as C Sharp (programming language)` and Visual Basic .NET`, typically use Platform Invocation Services` to interoperate with unmanaged code stored in these binary modules.
Libraries are a frequent target for code injection` attacks, where malicious code is placed into a process's address space via techniques like DLL hijacking` or DLL sideloading`. The Stuxnet` worm famously exploited vulnerabilities in the loading mechanism to propagate. To mitigate risks, later versions of Windows Vista` and Windows 10` introduced security features like Address Space Layout Randomization` and Microsoft Authenticode` digital signatures for validation. The TrustedInstaller` service in Windows 7` and later also protects core system libraries from unauthorized modification.
The standard file extension is `.DLL`, but other extensions denote specific types: `.OCX` for OLE` controls, `.DRV` for legacy device drivers, and `.CPL` for Control Panel (Windows)` applets. Key system utilities for managing them include `DEPENDS.EXE` (Dependency Walker`), part of the Microsoft Visual Studio` suite, which displays import and export tables. The `REGsvr32` command-line tool registers and unregisters libraries in the Windows Registry`, while the `System File Checker` utility in Windows 98` and later versions can repair protected system files.
Category:Microsoft Windows Category:OS/2 Category:Software libraries