Duke CPS 108 16.1
Libraries
- In C++ it’s possible to create static libraries and shared
libraries
➤ Static libraries (end in .a) are combined/linked into an
executable
- Executables are large. If library is updated in a binary
compatible way, programs still need to be relinked
➤ Dynamic/shared libraries (end in .so) are “fetched” when
the program is run
- Executables are small, updates can happen at run time
➤ Location of library can be made part of the executable (e.g.,
in Solaris, not in Linux as far as I know, -R in linker).
- Alternative is to use environment LD_LIBRARY _PATH
➤ DLL in windows is dynamically linked aka shared