Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.



This topic is 5215 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m having a hard time getting a straight/layman''s answer to what seems to be a pretty simple question; every definition I get spits out a convoluded and vague answer: What is a dynamic link library (DLL)? How/when are they used? What is their purpose and main usage?

Share this post

Link to post
Share on other sites
A dll is essentially parts of a computer program. Just like an executable (.exe) file, a dll contains executable code. It can''t run by itself though. A program uses the code inside a dll to perform common tasks, such as drawing windows on the screen and loading files. All the basic system functions like file loading and saving and graphics are contained in dlls.

They''re useful for efficiency reasons. Before dlls, every program had to have all its code inside the exe. Every exe that dealt with loading files, for example, contained similar code. This increased the size of the executable file, which was precious in those days. With a dll though, that file-loading code is located in one place on disk, and every program that uses it no longer needs to contain that code.

It''s also efficient for memory usage. A dll is loaded into physical memory once, and is accessible to each program that uses it. This saves on memory usage in environments like Windows where several or many programs are running at once, and each wants to use that dll.

The dlls also provide somewhat of a black box implementation. Programs that use Windows graphics code, for example, automatically change their look and feel with each new version of Windows. The dll code changes, but programs don''t need to change, so the same program can keep up with new styles.

My spoon is too big.

Share this post

Link to post
Share on other sites
Well, you have the concept of a statically linked library? It is basically ''attached'' to the EXE when it is compiled. So, if you have a 2 MB library, and you have 50 KB of executable code which uses that library, every EXE you make that uses the library will be 2 MB larger. Of course, no one likes that, especially because Windows code is maybe 100 MB large... Also, when your program is run, the entire executable is loaded, along with the library.

So along came the DLL. Instead of attaching itself to your program, it sits in a little directory (typically C:\Windows\System32), usually along with other DLLs. When a program needs the DLL, it is loaded into memory. If another program needs it, the copy in memory is used, instead of loading it again (like the statically linked program would do). This way, you can take lots of code off of both the EXE and its memory usage.

-- Fyhuang, president, Altitude Technologies

Altitude Technologies: http://www.hytetech.com/altitude
Altitude Forums: http://s8.invisionfree.com/Altitude_Forums/

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!