Jump to content
  • Advertisement
Sign in to follow this  
Tera_Dragon

which is quicker, libs or dlls?

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

Advertisement
Since you have determined that this is your bottleneck, it should be just a matter of trying both and profiling the results. Let us know how it turns out.

Share this post


Link to post
Share on other sites
Quote:
Original post by CodeMunkie
Since you have determined that this is your bottleneck, it should be just a matter of trying both and profiling the results. Let us know how it turns out.


I have no bottleneck. If you look I said I was just wondering, so then I will know for future reference.

Share this post


Link to post
Share on other sites
Once your application is fully loaded into the memory there is absolutely no speed difference whether you use a static library, a dll or some function from your executable.

Loading may be a little slower, although I doubt it. Windows implements dlls using memory mapped files so it'll need to load two files into the memory instead of one (dll + exe vs. just exe) but that should be negligible.

Share this post


Link to post
Share on other sites
Quote:
Original post by mike25025
static libs can be faster

What makes you say that? Do you know how dlls are implemented and how they actually work?

Share this post


Link to post
Share on other sites
Of course there is a difference. DLLs are late binding and usually called through function pointers. Libs are going to be bound at compile time.

Share this post


Link to post
Share on other sites
If I remember correctly, the program loader set up a table of pointers (at load time, obviously), by looking up for each entry (as defined at compile time by the .LIB import libraries) the address of the matching function (by name or ordinal) in the DLL. Then each DLL call (which include Win32 API and DX) is made through the function pointer located at a given position in the table (e.g. the function Foo is at offset 0x42 in the table, so calls to Foo are all replaced by indirect calls of the function whose address is at offset 0x42).

This is incidentally, the same mechanism as for *gasp* virtual functions *evil*, except you only have one table for the whole program instead of a table per class.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!