doniam Here is something I just came across on DLL's that you might be interested in.
What is a DLL? DLLs are dynamic link libraries: libraries of code, written in C or C++, to which programs, applications and other libraries can link dynamically, meaning: only when they need them.
Sometimes DLLs are called "programs", but they're not: they are collections of functions (or "routines") that sort of belong together but are not integrated into an executable program. A common denomination for a DLL is a "module". DLLs can have other extensions than DLL, like CPL, OCX or EXE (e.g. Krnl386.exe -- this doesn't mean that all EXE file are DLLs, far from it).
A CPL file is a Control Panel Extension: the Windows Control Panel consists of a collection of CPLs, to be found in the Windows\System folder. An OCX is an ActiveX Control (or formerly, an Object Linking and Embedding (OLE) Control). In fact, they are object libraries, and in this case "object" can be taken quite literally. For instance, Mscomctl.ocx contains objects like a status bar, a slider, a progress bar, etc. HOW IT WORKS:
Applications will issue a function call when they want to perform a common task, such as opening a dialog box when you want to save a file, drawing a window on the screen, requesting memory space, etc. "Calling a function" means: sending a message to Windows that contains the name of the function (e.g. CreateMenu) and the name of the DLL (User32, for the CreateMenu function). "Windows" is the core of the operating system, usually Kernel32.dll, which provides the most basic functions and is, of course, itself a DLL. Windows passes the info given by the application to the appropriate DLL (which could be one of the core components), the function is loaded and executed by the processor. The applications is idle now, the DLL is running all communications with hardware and operating system. Next, the DLL puts the output of its operation into memory for the application and tells Windows that it can be removed from memory. Now the application takes over again, and if the execution of the function by the DLL was correct, it will continue. If not, an error message will be displayed. It's not hard to see that there are many possibilities for errors here. If one of the parties involved is corrupt or buggy (badly written), you could see an error message. And almost everything is involved here: Windows, the application, hardware, drivers. An example: whenever you start up Internet Explorer, functions of Advapi32.dll, User32.dll, Shlwapi.dll and Kernel32.dll are called. User32.dll also calls Gdi32.dll and, again, Kernel32.dll, and so on. Depending on what you do with IE, more routines from the same or other DLLs will be needed.
This is what you can see in a window of the Dependancy Walker, one of the many small but useful programs included in the Windows Resource Kit, showing on which modules Iexplore.exe has to rely.
In the context of programming for Windows, the library of all functions in all Windows DLLs is called the Windows API (Application Programming Interface). In a programming language like C++, used to write the majority of professional Windows applications today, the "API functions" can be called directly from libraries. In the very popular Visual Basic language, APIs have to be declared first.
Some functions in DLLs are written to be called by Rundll.exe or Rundll32.exe. These functions can be called from the command line.
* * *
If you think there are a lot of DLLs on your C:\ drive, there are still maybe more than you think. Go to the command line (you don't have to exit Windows) and make sure you're at the C:\> prompt--if you're not, type cd c:\ and press Enter.
Now, type this line dir *.dll /s >>dll.txt
and press Enter. You will have a file named C:\dll.txt that contains a listing of all the DLLs on your C:\ drive. If you would open this file in a text-editor in which you can display line numbers, you would surely have more than one thousand lines (DLLs), maybe more than two thousand, depending on the applications you have installed. |