To create a library archive file of object modules suitable for input to the linker, a command may be used such as:
ax cr libmystuff.a myfile1.o myfile2.o myfile3.o
To add another object module to the existing library archive:
ax r libmystuff.a myfile4.o
To delete an object module from the existing library archive:
ax d libmystuff.a myfile4.o
To replace an object module in the existing library archive:
ax r libmystuff.a myfile3.o
To extract two object modules from the existing library archive:
ax x libmystuff.a myfile1.o myfile2.o
To append two object files to an existing library:
ax q libmystuff.a add1.o add2.o
To print the table of contents of the existing library archive using verbose mode:
ax tv libmystuff.a
If the archive file consisted of three object files, foo.bar, bar.o, and etc.o, the previous command would produce:
rw-rw----111/24 110 Mon Jun 22 09:43:14 1992 foo.o
rw-rw----111/24 141 Mon Jun 22 15:05:41 1992 bar.o
rw-rw----111/24 141 Mon Jun 22 09:47:22 1992 etc.o
To extract a single file into a different name, the p option may be used:
ax p libmystuff.a foo.o > newfoo.o
The v option must not be used with p because the filename, foo.o, will also be written to standard output.
Note: The driver option -archive to the compiler driver is closely related to the ax command (it invokes ax). See "General Options" for more information about the -archive command.