static linking
2013-11-11
Why do I not like static linking?In the most simple case, there is not much difference. Assume my game looks like this:
- server.c
- client.c
- game.c
- library.c
- server.exe
- client.exe
- game.dll
- library.dll
- server.exe
- client.exe
But now, how are we building in the case of static linking. First, we get an object file for each .c file. After that we build static libraries:
- libgame.a
- liblibrary.a
The answer to me is that I'm not sure. I once had it happen that game was using one version (which was outdated) of library and server was using another version. Which led to impossible bugs appearing. And if library.a is an external dependency and hard to rebuild it's also not the first thing to try.