What do *.dll files do?

Started by
7 comments, last by Empirical 19 years, 6 months ago
I was just wondering what *.dll files are for. I read it in the dictionary section but I still cant quite get it... Umm.. could anyone elaborate a little bit more? Oh... could you give me examples on where they are used..
Advertisement
DLLs are libraries of functions or classes. If you include them in a project, you can access the things in the DLL as you would if you had defined the classes or functions yourself. The reason (or at least a reason that they are useful is that if you need to update a portion of code, you only need to recompile the dll rather than the whole thing. Hope that helps.
DLL files contain code in them, just like executable files (.exe). The difference is that DLL files don't represent an entire program. You can't run them. But an executable can attach or link to them while it is running (that's why they're called "dynamic link libraries") and execute the code that is contained within them. A DLL will typically have multiple functions, and the executable can choose any of those functions to call at any time.

DLLs are good for one thing because multiple executables can use the same DLL to get functionality that they all need, without having to waste space by putting all that functionality into the executables themselves. For example, all DirectX games use the DirectX DLLs that are in the Windows System folder. That means that A) each of these .exe files do not need to include all the code that is part of DirectX, and B) whenever the DirectX DLLs get updated, every DirectX game is automatically updated as well. This second one is the other big feature of DLLs, the ability to update features easily. Mods for games are often in the form of DLLs. In fact, some games themselves are DLLs: The engine (graphics/physics/networking/input/etcetera) is an executable file, and then the game-specific stuff (story/menus/game flow/etcetera) would be in a DLL. If you wanna make a new game, but use the same engine, just make a new DLL.
"We should have a great fewer disputes in the world if words were taken for what they are, the signs of our ideas only, and not for things themselves." - John Locke
thanks a lot...
The idea is simple. Dll file is almost an ordinary exe file. There are, of cource, some differences. Dll's cannot be executed like exe files. They can be loaded or unloaded by a exe file when the program needs the code inside the particular dll. For instance, You writes an application that uses Direct3D ( part of DirectX resposible for graphics. In fact, it's just d3d.dll ). You can 'attach' the dll in two ways:

1. static. Here the need of the dll is written in the exe file and Windows loads it into RAM memory before your program.

2. dynamic. In this case, You load the particular dll using LoadLibrary() and then you find procedures you want to use, which are placed in the dll.

Summary
Dll are provided to divede the whole program code to a number of logical parts ( modules ). The main module ( exe file ) is the most important and it can menage the dll ( use the parts of the code they contain ). Moreover, it is easier to you to write/debug or update your software when you use dlls. Imagine, you wrote a big app in one file. Then there is an error. Hard to find ? Does it compile to long ? Do you have to send all your clients new version instead of just a small patch ?
There is a difference between those linked in and those used at run time. DLL files are used at run time and LIB files are the development libraries.
- A momentary maniac with casual delusions.
ok, if a .dll file is something like an exe file just not executable, could i then make a dll file in delphi/vb/whatever other language you can think of and then use it in combination with my c++ program?
Now get down on your hands and knees and start repeating "Open Source Good, M$ Evil", smacking your head against the pavement after each repetition. Once you have completed your training you may change your first name to GNU/, to show that you are free from the slavery of the closed source world. -Michalson
<disclaimer>While I'm not an expert on the subject</disclaimer>, yes, I think you can. That is, providing the data types/structures you will be using are compatible.
Quote:Original post by BiGF00T
ok, if a .dll file is something like an exe file just not executable, could i then make a dll file in delphi/vb/whatever other language you can think of and then use it in combination with my c++ program?


Its been a few years since I used vb. But at that time you could not. You can use DLLs IN vb, but not make them with vb.

This topic is closed to new replies.

Advertisement