What is DLL file?

What is .DLL file, can u explain me in detail with examples and its function, i see some of them in my system32 folder in windows are they same .dll file which i find in other program. what is the relation ?

Who is Participating?
DavidBirch2dotComConnect With a Mentor Commented:
Many programs do not need Dll's, however some programs do, this is usualy to make things simpler for the programmer, they can put all the code to do with certain events into one 'container' which is easier to access (see above example).  

Yes some programs rely on windows dll's for certain functions such as printing, regestry, music ect...

Most Dll's are not applications in them selfs, they are usualy called by other applications to do specific jobs such as printing.

Also Dll's can be used to hold resources such as images, word lists error messages and codes, ect

the best way to think of a dll is as  a libary (u know the real thing with books and stuff ;) ) with hundreds of books which could be thought of as various resources/functions/procedures and a person standing at the front desk... when a program wants to use a dll it loads it, as you would walk upto the libary, it calls a function and prehaphs passes some imformation, you ask for a book, the dll (libarian) then goes and gets it/ carries out the function and hands you the result,  WITHOUT you haveing to worry about the filing system, how the procedure works and all things like that, it provides a simple interface for complex data and procedures

hope thats more clear?

sunnycoderConnect With a Mentor Commented:
Hi joy12345,

Dynamic Link Library. A file of functions, compiled, linked, and saved separately from the processes that use them. Functions in DLLs can be used by more than one running process. The operating system maps the DLLs into the process's address space when the process is started up or while it is running. Dynamic link libraries are stored in files with the DLL file extension.

VenabiliConnect With a Mentor Commented:
http://support.microsoft.com/default.aspx?scid=kb;en-us;87934 - Definition and Explanation of a .DLL file
A dynamic-link library (DLL) file is an executable file that allows programs to share code and other resources necessary to perform particular tasks. Microsoft Windows provides DLL files that contain functions and resources that allow Windows-based programs to operate in the Windows environment.

DLLs most often appear as files with a .DLL extension; however, they may also have an .EXE or other extension. For example, Shell.dll provides the Object Linking and Embedding (OLE) drag and drop routines that Windows and other programs use.

Kernel.exe, User.exe and Gdi.exe are examples of DLLs with .EXE extensions. They provide code, data or routines to programs running in the Windows operating system. For example, one of these files provides the "CreateWindow" function that programs use when a new window is created on the screen.

In Windows, an installable driver is also a DLL. A program can open, enable, query, disable and close the driver based on instructions written in the DLL file.

DLLs may be found in the Windows directory, Windows\System directory or in an program's directory.

If a program is started and one of its DLL files is missing or damaged, you may receive an error message like: "Cannot find xyz.dll". If a program is started with an outdated DLL file or mismatched DLL files, the error message "Call to undefined dynalink" may be displayed. In these situations, the DLL file must be obtained and placed in the proper directory in order for the program to run correctly."
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).


>>Dynamic link libraries are stored in files with the DLL file extension.
Usually but not always :) Especially when speaking for Microsoft :)

I realized that ... so lets change it to
Dynamic link libraries are generally stored in files with the DLL file extension.

but DLL extension will be a dynamic link library unless you are working on a crazy system or a crazy person's system ;o)

I regularly use ISAPI dll's for creating complex web server applications, I know this isn’t the most common use for them, however you can get an idea of what is within them and how they are used just by browsing a project,

Go to www.davidbirch2.com/cgi-bin/ComicServer.dll/Index/

You can see the file name ComicServer.dll, within that there are various functions in this case separated by //'s each function can have variables passed to it such as this


The function is called Comic and it has a variable named comic passed to it with the value of '1'

Before all the other experts get at me ;) I know most Dll's do not work exactly like this, however they do have the same characteristics, various functions within them and you may pass variables to them as in the above example.... this idea was simply to illustrate the way a Dll file works ;-p)

joy12345Author Commented:
So does all the program have .ddl file, i mean when i intall new program does that program also have .dll file? So to communicate with my machine does this .dll file has to communicate with my OS ddl file?
or ??? please expain me
Prashant SabnekarAVPCommented:
A Dynamic Link Library is that file which becomes the part of the code at run time.
A program may contain some library function. Normally the declerations of library functions are available at the header file(.h) file, the definition part is available at some other file which is pre-compiled, and ready to link at the run time.

the question is what many have a doubt about .
in short DLL is a dynamic link library.

If an ActiveX component has been implemented as part of an executable file (EXE file), it is an
out-of-process server and runs in its own process. If it has been implemented as a dynamic link library
(DLL file), it is an in-process server and runs in the same process as the client application.
If your ActiveX component is an out-of-process server, it is an EXE file, and can run standalone.
Applications that use in-process servers usually run faster than those that use out-of-process servers
because the application doesn’t have to cross process boundaries to use an object’s properties, methods,
and events.
There are a few reasons why you may want to create your ActiveX document as an in-process
component (DLL file). The performance of an in-process component surpasses that of the same
component compiled as an EXE. In addition, multiple programs accessing the same EXE can overwrite
global data; that doesn’t happen if they each have their own in-process server.
I find that relying on DLLs can become a pain.  WHen a program has to be installed by multiple users at diverse locations, it seems that the DLL libraries are never the same and maintaining a common set of DLLs across all users becomes impossible. So if possible, I try to compile and build executible modules that do not use the DLLs.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.