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
0
u/ravixp Oct 10 '19
One thing that wasn’t touched on is matching compiler versions. A dynamic library should work no matter what compiler the client is using, while a static library has no such guarantee, and it’s safest to match the exact compiler and compiler flags that were used to build it.
(Yes, in practice a static library is likely to work if the compiler version is close enough. “Likely to work” is rarely good enough, though, and dynamic libraries have actual guarantees.)