[lug] q: building libraries

Sebastian Sobolewski ( Zeb ) spsobole at mindless.com
Mon May 22 13:06:33 MDT 2000


         To build a static library. (.a file) you can do the following:

ar rcs <library_name>.a file1.c file2.c etc..

This will create a static link library composed of the functions in the 
files: file1.c, file2.c etc.


To later use the library you then do:

gcc -o program_name -O main.c library_name.a

This will link main.c and the libary (library_name.a) and create the 
executable program_name.

Hope this helps,
Sebastian








More information about the LUG mailing list