User created libraries/archives


Wot is a user library? I hear you ask! Well, its a collection of your functions, that, when placed into a library are available to all the programs you write.

This is what Chris Sawtell has to say about libraries.

There are two types of library, dynamic and static. Although dynamic libraries are the prefered alternative (because they are not linked into your program), here is the method required to create static libraries....

There are several steps required in creating a library.


Here are the four steps in UNIX terms. The function is called reverse and the library is called mart.


 vi reverse.c			     # write your function (no main). 
 gcc -c reverse.c		     # -c just compiles (no link).
 ar -q  libmart.a reverse.o	     # -r == if nessasary replace 
         			     #       an existing function.
 gcc program.c -lmart -L/home/leslim # -l == library to search
				     # -L == Location of the library.

A few notes:


Other usefull commands:


See Also:


Top Master Index Keywords Functions


Martin Leslie