Dynamic-link library (Windows)

A dynamic-link library (DLL) is a Microsoft Windows method of having separately-compiled modular routines able to be loaded at run-time when needed by programs. The various versions of Windows include a large number of such files used by system programs and other software, and third-party software is likely to include other files of this sort, some specific to one program and some shared by multiple programs.

There are lots of problems and pitfalls related to these files. Programs may install different versions of the same DLL on top of the previously existing one, possibly breaking other software that depends on the other version and is incompatible with the one just installed. Or if a program's installer avoids this problem by installing its DLLs in a different directory from others of the same name (which might be different versions of a DLL or totally different ones that just happened to be named the same), a system might still have a poorly-set path variable that causes the wrong version to be used, and trying to untangle which file is supposed to be used by which program is a difficult task even for a technically knowledgeable user. Then when you uninstall a program, perhaps it will delete all its DLLs (perhaps breaking a different program that also uses them), or perhaps it will leave them in place (even if no other program uses them), contributing to the mess and bloat that plagues Windows PCs in their old age.

If a program crashes due to lack of a required DLL, perhaps you'll Google it and run into a site that purports to make it available for download... but then tries to push you into downloading and installing their own spyware/adware as well. Watch out! You're best going to the appropriate software manufacturer's site (e.g., Microsoft's if it's a part of the Windows system, or the third-party software company for the package that the DLL is connected with).

Format
DLLs are of a related format to COFF, originally a UNIX-based format which was given a "Microsoft twist" for use in Windows. The Windows form of EXE files (PE executable) is of a similar format, but designed to run directly as a standalone program rather than be loaded within already-running programs as DLLs are.

The normal file extension is .dll, but .ocx is also found for libraries containing ActiveX controls, and .drv for system drivers (of an old legacy format). Additionally, some other formats such as the Windows icon library file use similar format, but limited to particular sorts of content rather than the full range of executable program routines and resource data which can be stored in a DLL.

Specifications

 * Microsoft PE and COFF Specification

Links

 * Dynamic-link library (Wikipedia)
 * Definition and Explanation of a .DLL file
 * Dynamic-Link Libraries
 * DLL tutorial
 * Wikibooks: Programming Dynamic Link Libraries