Compiling a static library

To compile a static library, follow this procedure:

  1. Compile each source file to get an object file. For example:
    xlc -c test.c example.c
    
  2. Use the ar command to add the generated object files to an archive library file. For example:
    ar -rv libex.a test.o example.o