ar - the archiver

David B. Anderson davea at quasar.wpd.sgi.com
Fri Mar 2 04:11:32 AEST 1990


In article <9002281129.aa20377 at SMOKE.BRL.MIL> JORDAN at gmr.COM writes:
>Can someone give me any tips on using ar, or lead me to any books that
>might be able to help me.
>
>I am able to create a library, add objects, and update symbol tables
>(e.g. ar cr lib.a a.o b.o, or ar ts lib.a), BUT I would like the compilerr
>to recognize it via a flag; for example, the way it recognizes -Zg, or -lgl_s.

This is easily done. Say you name your archive  libmy.a and have a copy
temporarily in /myliblocation.

	su       # need to be root for the cp to /usr/lib
	cp /myliblocation/libmy.a /usr/lib
	exit     # no need to be root any more
	cc t.c -lmy      #this works, since ld searches /usr/lib

# alternatively:
	mkdir /usr/local/lib
	cp /myliblocation/libmy.a /usr/local/lib    
	cc t.c -L/usr/local/lib  -lmy
	# the -Lpath adds the path to the ld search list

You'll find all this information via ``man ld''

As always, RTFM :-)
Regards,
[ David B. Anderson  Silicon Graphics  (415)335-1548  davea at sgi.com ]



More information about the Comp.sys.sgi mailing list