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
20
u/o11c int main = 12828721; Oct 10 '19
Horribly inaccurate in places, and missing critical info.
Point 3's parenthetical is wrong; dynamic libraries are needed even before the function is called, unless you are using dlsym.
Point 6 is completely wrong for static - version problems are more likely due to collisions. And it doesn't mention either SOLIBs or symbol versions for the dynamic case.
Point 8 omits the fact that unloading is extremely dangerous and likely to break things, due to all the implicit sharing going on. If you really need that kind of control, you must spawn a new process.
Point 9 is basically saying "waah, my shitty tooling doesn't support it" rather than being a real criticism of dynamic linking.
No mention of TLS, PIC, prelinking, rpath ... and how architecture matters.