matrixcore - 2005-07-06 7:58 PM
Windows programs share a lot of code so, to avoid wasting disk space, the solution was simple
(apparently
), create code "containers"
(the libraries
), which had code that may be reused across various applications. but, as everything, DLL's
(dll means dynamic link library
) have different versions, even if they're called the same way
(for example, commdlg.dll which exists across all windows versions since 95, but it's different for each one
). In the old times, and even in the modern ones, there is no 100% reliable mechanism to make sure the DLL a program is trying to load is the DLL that the program is designed to use, and not an incompatible version. so DLL hell
(also referred as a SNAFU
) is a situation where you have a DLL which is incompatible with the program that is trying to use it, and it fails miserably. happens for example, when you install program A that uses version 1.2.3 of library "foo.dll", then, program B overwrites "foo.dll" with version 0.9.6, which then renders program A inoperable.
That was a long explanation. but i hope it was clear
I couldn't have explained it better myself!
To add to the existence of DLLs, it was mostly to tackle the problem of limited memory back in the early days ... think 4MB 386SX/DX PCs or even 1MB 286AT PCs ... Windows 3.0
(or earlier
) started off with the DLL thingie so that more apps can run at the same time without taking up precious memory estate by sharing code in the form of DLLs.
In the DOS days, only *one* app run at a time, so an app had access to *ALL* possible memory, 640KB, the 384KB upper memory, extended mem, expanded mem, whatever ...
...
To round up what I veered off with this DLL thingie, DLLs can also be static libraries. They differ from Dynamically loaded libraries in that when an app is run, it is loaded at program load time, whereas Dynamically loaded libraries are
(well
) loaded dynamically, ie as and when the programs need the specific function found in that library. Dyn libs can also be unloaded when not in use. So a properly written app can make use of minimal memory footprint whereas a lazy app will simply load everything other thing even if it is only used once.
At the end, its almost always a constant balance between speed vs memory usage.