C++ Lib or Dll?


I have been looking into Developing Win8 Games using C++ and the first question I was faced with was should I use a C++ Lib or a C++ Dll, and what is the difference, why should I choose one over the other..? Here is what I have found (that it doesn’t really matter):

The Kool Aid:“Using dynamic linking instead of static linking offers several advantages. DLLs save memory, reduce swapping, save disk space, upgrade easier, provide after-market support, provide a mechanism to extend the MFC library classes, support multilanguage programs, and ease the creation of international versions.”
Lib-This is a code “bundle” inside your .exe DLL-This is a stand alone unit of code.
Performance
  •  Code ia always loaded with the executable
  • Can speed up app load time
  • Small hit when the .dll loads
  •  Can be defered at App load time
Compiled Size
  •  Larger file size for .Exe
  •  Many smaller filles
ALM
  • Can only be used at compile time.
  • Not prone to versioning problems.
  • You will need to take extra steps to get the PDB’s rolled into the DLL PDB
  • Must update each product which uses it seperatly
  • Fights incompatability issues
  • requires you to replace the exe for upgrades.
  • Some say Lib’s make it easier to support many platforms
  • Can Be used by multiple Applications.
  • Can cause versioning problems.
  • Can upgrade all products at once if dll is shared across product lines
  • Forces you to update all related projects and can cause compatability maintenance issues accross your organization.
  • Allows you to upgrade the application by replacing just the dll.
Operation
  • Used by the compiler at compiletime.
  • Results in 1 Large file.
  • Compiled and called at runtime.
  • Results in many smaller files.
Misc.
  •  All iOS binaries are static libs
  • Origional implimintation was the origin of DLL Hell
Architectural Considerations
  • Can cause problems with static libraries[^]
  •  Special care need to be taken when internal dependancies are not straight forward.
Legal Implications
  • If you use an LGPL library statically your code automatically becomes Open Sourced
  • If you use an LGPL library then you only have to open source the changes made to that library/

For More Information:

http://stackoverflow.com/questions/140061/when-to-use-dynamic-vs-static-libraries

Advertisements

About Larry Louisiana

I'm a Microsoft Partner Consultant.
This entry was posted in Computers and Internet, Programming, Review & Comparison and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s