grommeleur

Wrong’Em Boyo

  • The GNU C Programming Tutorial
    Kinds of library
    http://crasseux.com/books/ctutorial/Kinds-of-library.html#Kinds%20of%20library

    The file name for a library always starts with lib and ends with either .a (if it is static) or .so (if it is shared). For example, libm.a is the static version of the C math library, and libm.so is the shared version. As explained above, you must use the -l option with the name of a library, minus its lib prefix and .a or .so suffix, to link that library to your program (except the library glibc, which is always linked). For example, the following shell command creates an executable program called math from the source code file math.c and the library libm.so.

    gcc -o math math.c -lm

    The shared version of the library is always linked by default. If you want to link the static version of the library, you must use the GCC option —static. The following example links libm.a instead of libm.so.

    gcc -o math math.c -lm —static

    #bibliothèques #statique #dynamique #scc