DLL hell: Difference between revisions

Content deleted Content added
BrainStack (talk | contribs)
Link suggestions feature: 3 links added.
 
Line 6:
 
== Problems ==
DLLs are Microsoft's implementation of [[shared libraries]]. Shared libraries allow common code to be bundled into a wrapper, the DLL, which is used by any [[application software]] on the system without loading multiple copies into memory. A simple example might be the [[GUI]] text editor, which is widely used by many programs. By placing this code in a DLL, all the applications on the system can use it without using more memory. This contrasts with [[static libraries]], which are functionally similar but copy the code directly into the application. In this case, every application grows by the size of all the libraries it uses, and this can be quite large for modern programs.
 
The problem arises when the version of the DLL on the computer is different than the version that was used when the program was being created. DLLs have no built-in mechanism for [[backward compatibility]], and even minor changes to the DLL can render its internal structure so different from previous versions that attempting to use them will generally cause the application to crash. Static libraries avoid this problem because the version that was used to build the application is included inside it, so even if a newer version exists elsewhere on the system, this does not affect the application.
 
A key reason for the version incompatibility is the structure of the DLL file. The file contains a directory of the individual methods (procedures, routines, etc.) contained within the DLL and the types of data they take and return. Even minor changes to the DLL code can cause this directory to be re-arranged, in which case an application that calls a particular method believing it to be the 4th item in the directory might end up calling an entirely different and incompatible routine, which would normally cause the application to crash.
Line 47:
* Microsoft releasing out-of-band updates to operating-system runtime components;
* Inability of earlier versions of Windows to run side-by-side conflicting versions of the same library;
* Reliance on the current directory or <code>%PATH%</code> [[environment variable]], both of which vary over time and from system to system, to find dependent DLLs (instead of loading them from an explicitly configured directory);
* Developers re-using the ClassIDs from sample applications for the COM interfaces of their applications, rather than generating their own new [[Globally unique identifier|GUIDs]].