René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -

ar, the archiver [binutil]

The archiver can be used to place object files into a static library.
The following command creates a static library named libutil.a and places the three object files algorithm.o, converter.o. and processor.o in that library. If the library already exists, the three object files will be added to the library. If the library already exists and already contains one or more of these three object files, the object files in the library will be replaced.
ar rcs libutil.a algorithm.o converter.o processor.o
The most common options to ar are r, c and s:


Add the object files to the library, r replace any already existing object file with the same name.


Create the library if it doesn't already exist.


Maintain the table mapping symbol names to object file names.