View Full Version: DLL

C++ Learning Community > C++ Help > DLL


Title: DLL
Description: what is it...


Shonoby - January 15, 2007 04:24 AM (GMT)
I have been hearing a lot of DLL, and wanted to see what it is i have been to wikipedia about it and shown me several ones so i need to know, what does DLL stand for, what can it do, were can i learn it, what type of programs can it create?

C-Man - January 15, 2007 09:41 AM (GMT)
dynamic link library

Shonoby - January 15, 2007 07:33 PM (GMT)
:o *cough *cough :huh:
What can it do, were can i learn it, what type of programs can it create?

biggoron - January 15, 2007 10:16 PM (GMT)
Any compiler should be able to make it. With my IDE (Dev-Cpp) I choose New Project -> Windows DLL. It's basically a set of functions, like a static library except it's external and can be used by multiple programs at the same time, cutting down on the size of programs that use it and reducing memory usage.

I think the functions to use it are included in windows.h but I really don't know. If I recall correctly, you use the LoadLibrary(dllname); function to load a library, and then you can use whatever it contains as part of your program. You use FreeLibrary(dllname) to free the library.

Don't quote me on any of that though.

[edit]
I just remembered that Smarty at the GMC wrote a topic about DLLs but I don't really know where it is. Look him up on the member index and search through his posts and you should be able to find it. If not I think it was created in the Extending Game Maker forum.

Shonoby - January 16, 2007 01:53 AM (GMT)
Ohh, thxz man

PinguinDude - January 16, 2007 06:51 AM (GMT)
Well, to use a dynamic link library you could either do this:
CODE

HINSTANCE hLib = LoadLibrary("test.dll");

FunctionPointer = (functionpointer)GetProcAddress(hLibrary, "function");

FreeLibrary(hLib);

Which is very useful when you want to make a game that can be modded, since if the dll has a different name you only load a different one which could include different functions.

To STATICALLY link them, you need to go to your project settings in devc++/visualc++ and link the project.a/project.lib files. This is recommended unless you have a special need to not do so.

dr voodoo - January 16, 2007 08:59 PM (GMT)
PinguinDude be sure to only free the library when it is no longer needed!

Basically you can think of a DLL as a C object file (or a group of object files combined to a single one) which you link to at runtime.

Nearly all WinAPI calls are calls to C functions exported by DLLs.

Shonoby - January 16, 2007 09:23 PM (GMT)
Ok, i see, so it can be used in C++ also, with the code pengindude said

Ravotus - January 17, 2007 12:08 AM (GMT)
Technically, you can use dll's made in many different languages, just as long as they all compile down to the same byte code. For instance, a DLL written in C++ could be used in an Assembly program. Things get more complicated when you start dealing with exported classes instead of functions, though.

Shonoby - January 17, 2007 12:57 AM (GMT)
Ohh, ok thxz

TheHawgMaster - January 17, 2007 09:16 PM (GMT)
QUOTE (Ravotus @ Jan 16 2007, 05:08 PM)
Technically, you can use dll's made in many different languages, just as long as they all compile down to the same byte code. For instance, a DLL written in  C++ could be used in an Assembly program. Things get more complicated when you start dealing with exported classes instead of functions, though.

I think dlls are typically compiled to the target machine's architecture, not to bytecode, aren't they?

C-Man - January 17, 2007 09:50 PM (GMT)
unless it's MISL dll

Ravotus - January 17, 2007 11:31 PM (GMT)
Alright, I'm sorry for putting it in terms that a newbie would understand and not being 100% computer-science correct. Shonoby is obviously seeking to learn the fundamentals of DLLs, not to what architecture they are compiled. <_< I was simply trying to get the point across that it does not matter (for the most part) what language a DLL is written in to be used by another language.

Do I need to start putting disclaimers in my posts from now on?

Shonoby - January 17, 2007 11:56 PM (GMT)
Naw, dude i just really wanted to know the capabilities of it, but i am alrdy learning it myself, cause there is this new invention call the INTERNET u know, and i just went on it and searched and i got a guide OMG, can u believe that!!! But for real thxz for all ur help but all i need to know is its capabilities... But u know iam not a noob i dont need to be guide each step i can teach myself.

Rmstn1580 - January 18, 2007 03:44 AM (GMT)
Could you send me the URL for the DLL tutorial? I've been looking all over for one and all I can find are shitty ones.

Shonoby - January 18, 2007 03:53 AM (GMT)
This is the site that i got, not sure if u like it but thats what iam learning from and u could try other links here in
wiki


Rmstn1580 - January 18, 2007 04:00 AM (GMT)
Thanks a lot! :D Especially for the quick response

Shonoby - January 18, 2007 04:08 AM (GMT)
LOL, yea sure, iam almost always on....well cause today i had nothing to do LOL :lol:

TheHawgMaster - January 18, 2007 09:13 AM (GMT)
QUOTE (Ravotus @ Jan 17 2007, 04:31 PM)
Alright, I'm sorry for putting it in terms that a newbie would understand and not being 100% computer-science correct. Shonoby is obviously seeking to learn the fundamentals of DLLs, not to what architecture they are compiled. <_< I was simply trying to get the point across that it does not matter (for the most part) what language a DLL is written in to be used by another language.

Do I need to start putting disclaimers in my posts from now on?

No offense was intended. I'm not totally clear on the topic. Would it be considered a DLL if the code linked to was interpreted? For all I know it might be, I really was asking a question.

dr voodoo - January 18, 2007 06:00 PM (GMT)
QUOTE (TheHawgMaster @ Jan 17 2007, 09:16 PM)
I think dlls are typically compiled to the target machine's architecture, not to bytecode, aren't they?

Well what you consider a dynamic link library is completely up to your definition. However MS considers is more specific about this question.

A DLL is file in a variant of the PE executable format which exports symbols. It is the role of the DLL user to know what such a symbol refers to.

The DLL basically only contains information on how load such symbols. For example if the caller needs write access or only read access (and all programs can share the same version in memory thus saving space) or if the memory should not be allowed to be executed.

If the entries for certain symbols now refer to a text which contains some interpreted language or machine code is not defined. (Most of the time however it's machine code.)




Hosted for free by InvisionFree