windows - Should I compile my VS2008 C++ Win32 applications statically or link them dynamically? -
i'm trying avoid dll hell problem , users having install redistribution packages in case don't have dlls.
is recommended compile application statically?
it depends.
if program small, , want able drop single executable onto machine , run it, static linking appropriate , simplest thing do.
if program larger, or if need installer anyway (to deploy multiples files, set registry keys, etc.), may link dynamically, can substantially reduce size of executable. can avoid dll hell installating necessary, redistributable run time dlls in same directory executable. if want go pro, can create msi-based installer includes merge modules run time libraries project requires.
do not compile dynamically , expect user either have dlls or install vcredist package. that's difficult support , it's pain users.
there additional considerations if you're thinking linking own dll static run-time library. if statically link run time, can end of having multiple instances of run-time library in single process. state run-time library maintains (like heap information or position next strtok call) duplicated. can lead subtle bugs unless you're extremely careful.
Comments
Post a Comment