Compiling a static library

To compile a static library:

  1. Compile each source file into an object file, with no linking. For example:
    xlc -c bar.c example.c
    
  2. Use the Linux ar command to add the generated object files to an archive library file. For example:
    ar -rv libfoo.a bar.o example.o