Difference and size footprint...
Static libraries are built (compiled) and linked at a compile time. Dynamic Libraries are compiled separately and linked at runtime, usually when application is launched. Dynamic (shared) libaries exist outside of the main executable.
Static libraries can increase the size of the final executable, because they are duplicated for each binary that uses them. Dynamic libraries do not increase final executable size becuase they are shared between all binaries. Advantage here goes to dynamic runtime libraries because of less redundacy.
Each application that uses static libraries, needs it's own copy of it. This increases deployment size. Dynamic libraries have dependency to other libraries and they are allocated dynamically at runtime.
Static libaries are faster, because they are pre-loaded at compile time, while dynamic libraries are a bit slower because of a runtime loading and symbol resolution.
Big disadvantage for the static libraries is, that if a change has been made, every binary using them needs to be re-compiled and re-destributed. A change in the dynamic library does not require all binaries to re-compile and re-distribute.
Comments
Post a Comment