Jump to content
  • Advertisement

Archived

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

serratemplar

Why use a .DLL?

This topic is 5220 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 am under this impression (which could be totally wrong) that it''s possible to split my entire game up into .dlls that would -reduce the size of the exe -potentially reduce the size of patches -simplify patches by localizing the code I''d have to edit, recompile, and submit. Am I entirely off base? Is a self-made DLL good for other reasons? Is there an alternative I''m missing out on? As you can see, I have a great many questions. =)

Share this post


Link to post
Share on other sites
Advertisement
Sounds about right.

Add to it the fact that you can load dynamic libraries programmatically, at run-time, which is how you can make plugins

e.g. "Load and initialize all the DLLs you find in the /plugins directory"

Look at the LoadLibrary and GetProcAddress functions.


“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.”
— Brian W. Kernighan

Share this post


Link to post
Share on other sites
So I can treat it like a subprogram, give it its own dllmain(), and map function pointers to all the functions in it that I might use. Then I axe it with FreeLibrary().

Any detriments to using dlls?

Share this post


Link to post
Share on other sites
Well, personally I use COM, so perhaps this won''t be valid depending on how you link it...however...make sure it is loading when you THINK it is loading. If you honestly want to build them all seperately, you need it dynamically loaded (obviously...that is the point) I use COM because it requests an interface to an object and then does its operations on it...if I have two programs and want different behavior I can easily provide different interfaces for them, or add special functionality that only the one uses without ever touching the other.
The issue though is that the dll is loaded in run time ''as needed''...which means if I don''t bother to call into it until I''m rendering some scene...well..that is going to slow us down a wee bit The other option is to load it in at load time...but this generally means you''ll be recompiling your executable, dll or not, every time you make a significant interface change (to link it up with the new lib definition)

Share this post


Link to post
Share on other sites
So my thinking now is this. While dlls might be good for graphic and sound effect functions, so later optimizations to blackbox functions can make for smaller patches, it might be worth my effort to learn about scripting and build a game engine tailored to work with scripting.

Which scares me, I''ll admit. =)

Thanks for the tips, guys.

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!