Sign in to follow this  

What do you use DLLs for.

This topic is 4751 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

Dynamic Linked Libraries are the opposite of Static Linked Libraries. They are commonly used to hold code that is frequently updated and does not need to be fast. I would personally not recommend using DLL files in a game but instead in a Windows Application. DLL file will allow you to update the program without recompiling the whole Executable. The executable files are almost identical in file structure to DLLs however DLLs do not have a main function. The Linux alternative to dynamic libraries are SO files.

This website should give you a good idea of what they are:
http://www.geocities.com/sujitmanolikar/dllhowto.html

Hope that helps~ John DiSanti

Share this post


Link to post
Share on other sites
DLL's are used for a few different reasons.

One is a compiled C++ DLL is much faster than VB (visual basic) any day, so that can have some good effects.

DLL's can also be part of larger libraries that dont give out their source code, but will give you a compiled DLL to use (such as SDL, OpenGL, and DirectX, to name a few).

Third, and more personal use, of a DLL is to share commonly used code among different programs.

Hope that makes sense
~zix~

Share this post


Link to post
Share on other sites
Quote:
Original post by disanti
The executable files are almost identical in file structure to DLLs however DLLs do not have a main function.


they are identical to executable files (Portable Executable), the only difference is the extension and the way you use them.
They do have a main function, its called DllMain, though you can write a DLL without specifying one, in which case you get a stub.

*nix shared objects are different thought.

Share this post


Link to post
Share on other sites
Quote:
they are identical to executable files (Portable Executable), the only difference is the extension and the way you use them.
They do have a main function, its called DllMain, though you can write a DLL without specifying one, in which case you get a stub.


Hmmm... I've made so few DLLs, I had no clue they had a main function. I have never used it.

Share this post


Link to post
Share on other sites
Quote:
Original post by Spoonster
Hmm, I never knew DLL's to be slower. Can anyone explain why that is? I realize loading them takes time, but after that, isn't it just executable code, like any other?


The reason they are slower is because the computer has to find the address of the functions it is using from a virtual table in the .DLL. I don't think that the .dll perfomance hit in execution is significant to discourage its use. I'm working on my Game Engine and it is a .dll and it runs just as good as the whole project compiled. But since there is more overhead when using .dlls, thats where a speed hit is from. Hope this helps!

PS - Making dlls aren't that hard anymore, you just have to do a few easy steps and that's it. The trouble comes when you need to share data across multiple programs or you need to use STL...then the fun begins.

Share this post


Link to post
Share on other sites
Quote:
Original post by Drew_Benton
PS - Making dlls aren't that hard anymore, you just have to do a few easy steps and that's it. The trouble comes when you need to share data across multiple programs or you need to use STL...then the fun begins.


How is STL an issue? Also, i've had trouble trying to share data across multiple dll's... is there a standard method to handle that?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by Drew_Benton
The reason they are slower is because the computer has to find the address of the functions it is using from a virtual table in the .DLL. I don't think that the .dll perfomance hit in execution is significant to discourage its use. I'm working on my Game Engine and it is a .dll and it runs just as good as the whole project compiled. But since there is more overhead when using .dlls, thats where a speed hit is from. Hope this helps!


The address only has to be resolved once, this is something you want to do when your program loads. After that, you can store a pointer to the function and its not slower to call the DLL function than calling a virtual function on an object in C++.

Share this post


Link to post
Share on other sites
Quote:
Original post by Mr Furious
How is STL an issue? Also, i've had trouble trying to share data across multiple dll's... is there a standard method to handle that?


I don't think is STL, but rather templates, when coding aedGUI we ran in a lot of compile problems with functions that had STL containers as either arguments or return values, for Visual C++ you have to do some hacks in order to be able to use const std::string& and such as I mentioned.

functors never worked properly on MSVC that I can remember.

as for sharing data, you have to use a #pragma directive, but I cant remember what was it, something like #pragma shared data segment or something along those lines, someone else might be able to give you a better answer.

Share this post


Link to post
Share on other sites

This topic is 4751 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.

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