next up previous contents
Next: Creating Dynamic/Shareable Libraries Up: Libraries Previous: Types of Library   Contents

Creating Static Libraries

To create a static library use the ar (Archive) command. For example to create the library libMyLib.a from files a.o, b.o, c.o:-

ar -r libMyLib.a a.o b.o c.o

the -r option tells the archiver to insert with replacement, creating the library if necessary.

To type the current contents:-

ar -t libMyLib.a

and to replace e.g. c.o:-

ar -r libMyLib.a b.o



P.D. Gronbech (IT Staff) 2015-10-02