DLL Hell : Java Glossary
©1996-2017 Roedy Green of Canadian Mind Products
- DLL Hell
DLL (Dynamic Link Library). This is the
stupidest idea every foisted on the computing public. You can thank Microsoft for
this lunacy and for the second stupidest idea, the registry. It started out well intentioned. If two different
programs are using the same code, should they not share a common copy?
DLLs (Dynamic Link Libraries)
also tend to stay loaded even after they are no longer necessary. Often this saves
the effort of reloading them if they are used again soon. This is a Good
Thing™. What went wrong?
If you want to access code in a DLL
from Java, you will need to write some JNI (Java Native Interface)
- The main error was giving DLLs
only 8+3 names. If two different companies called their DLL
PLOTTER.DLL they are assumed to be the same
company can sometimes accidentally use the other company’s
DLL. It all
depends on which version of the DLL
was loaded first.
- The second error was Microsoft putting out into the world dozens of different
versions of the same DLL all with the same name. In theory all programs
should use the latest version. However, there is nothing to stop an old version
from being loaded instead. Further, some program will only work with the old
version and some only with the new. Every time you install a new program it may
install some DLLs
that stop your existing programs from working.
- Instead of managing the DLLs
in a carefully controlled way as part of the operating system, application programs
are responsible for installing them. Cowboy coding that ignores the conventions
makes a horrible problem even worse.
- A DLLs
muddles together in its address space the data for all its clients. They are not
kept separate by hardware. It is totally up to the DLL
to keep it all straight.
You can’t change DLLs
to a new version without rebooting, not even the disk copy, let alone the RAM (Random Access Memory) image. Java can change code on the fly without so much as stopping the program. Surely Microsoft
could work out a method to change a DLL that did not require such drastic measures. Some Unix machines run for years without rebooting. To replace a
DLL with a new one, you must use the inuse utility to allow you to replace the DLL and then reboot to clear the in-RAM
inuse test.dll C:\winnt\system32\test.dll /y
Alternatively, you can reboot and then replace the DLL, so long at it is not loaded.
- Microsoft closed its eyes to these problems for a decade. Instead it
concentrated on adding dancing paper clips to its applications. They have finally
decided to at least tackle the problem in a half-hearted, half-assed,
kludge-o-matic way. The whole concept of DLL
needs a total overhaul. They refuse to bite the bullet and totally rethink this