Creating libraries of object module

Doug Gwyn gwyn at smoke.BRL.MIL
Sun Feb 25 09:54:21 AEST 1990


In article <34230 at news.Think.COM> saroff at wotan.think.com.UUCP (steven saroff) writes:
>How does one create personal libraries or archives of object modules to
>like to.  I want to have a library of various useful sub program, and
>just link to them with a -l or something akin to it when I am compiling
>some larger code.

All that the "ld" or "cc" option "-lxxx" option does is to in effect
expand in-line to the pathname /usr/lib/libxxx.a.  You can always
specify the pathname of any library archive that you wish to be
searched at that point in the link-editing process.  Such archives
are created and maintained via the "ar" utility, which is described
in the UNIX Programmer's Reference Manual.

For example,
	cc -o foo foo.o foosubs.o mylib.a -lm



More information about the Comp.unix.questions mailing list