Static library

With dynamic linking, not only might the library file be missing, but even if found, it could be an incompatible version.

Another trade-off is that the size of the executable is larger with static linking that dynamic.

This allows library files to be shared between applications leading to space savings.

To create such a library, the exported functions/procedures and other objects variables must be specified for external linkage (i.e. by not using the C static keyword).

For example, on a Unix-like system, to create an archive named libclass.a from files class1.o, class2.o, class3.o, the following command would be used:[1] to compile a program that depends on class1.o, class2.o, and class3.o, one could do: or (if libclass.a is placed in standard library path, like /usr/local/lib) or (during linking) instead of: