r/cpp • u/debhaldar • Oct 10 '19
10 differences between static and dynamic libraries every C++ developer should know
https://www.acodersjourney.com/cplusplus-static-vs-dynamic-libraries/
5
Upvotes
r/cpp • u/debhaldar • Oct 10 '19
7
u/adnukator Oct 10 '19
Point 5. Memory efficiency as "Low" with static libs is questionable since the linker can strip out unused symbols, keeping only used ones in the final binary
Point 6. Versioning problems are possible with static libraries during linking if your static libs depend on other static libs (not saying it's a good idea, but still)
Another thing not mentioned is that with dynamic libraries (at least in Windows) you can potentially run into problems with the global loader lock, leading to deadlocks during dll loading. With statics this is not possible.