Sign in to follow this  
rayce

DLLs

Recommended Posts

rayce    120
what exactly is a dynamic link library? how does it relate with a "static library"(i saw this under new project in devcpp) and a header file?

Share this post


Link to post
Share on other sites
c-gibson-s    313
In short, i like to think of it as a file that containes code (it's compiled already in a .dll) - and you can use that in your linked program.

For example, if you use the opengl function glEnable();, this function, or more what it actually does in code, is contained in the OpenGL32.dll file. Sorta like a CPP file in a class, except it is compiled code (im not sure what they call that?).

When you use a .dll, any program can use that if they link to it. With opengl, this is done by linking OpenGL32.lib..and you include the header file for compile purposes...for example.

Share this post


Link to post
Share on other sites
MotionCoil    464
^^^

Yea, in short its a library of compiled functions that any program can 'link' to. In other words; Any program can call up and use the compiled function from the library, at the same time, as if it were written into the programs execute.

muh, I just confused myself [smile]

Share this post


Link to post
Share on other sites
supercoder74    154
what I think of .dlls and .libs are that with .lib you dont have to have the library on the computer you run the program, like a header file. using a static library, a folder with the program might be like this:
A folder named "mainfolder"
An exe for the game in mainfolder
a folder in mainfolder named "graphics"
.bmps in graphics

But with a DLL(dynamic linked library) it will be this:
A folder named "mainfolder"
An exe for the game in mainfolder
A DLL in mainfolder named "mainlib"
a folder in mainfolder named "graphics"
.bmps in graphics
[EDIT]
oops. Misunderstood the questions. heres the answer to the question:
A header file you created has a class, and some functions in it.
You realize that you cannot put the definitions in the header file, so you make a .cpp file for that.
You say to yourself, "what I need is some file that I can use so I dont have to include the .cpp every time", so you make a library.

Share this post


Link to post
Share on other sites
Strewth    146
Well, a .lib is still gonna end up being "included" each time. Its linked into the executable at compile time (hence the static term). Whereas the .dll is external to your executable and is dynamically linked at run time.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this