using libraries with ld(1)

Paul S. R. Chisholm psc at lzwi.UUCP
Tue Aug 13 12:21:29 AEST 1985


In article <125 at shell.UUCP>, buck at shell.UUCP (Lester Buck) writes:
> I have a private library of C routines which I want to link into various
> programs.  The loader ld(1) *insists* on searching only /lib/lib*.a,
> /usr/lib/lib*.a, /usr/local/lib/lib*.a  and then gives up.
> 
> Ok, what am I missing?

Well, in System V ld(1) has a -L option, followed by the name of a
directory to be searched before /lib and /usr/lib.  Usage
	cc -c foo.c && ld -o foo -L/usr/jrandom/lib -lglarch -lc
or
	cc -o foo foo.c -Wl,-L/usr/jrandom/lib -lglarch
(-Wl can be used to pass arguments to the linker from cc(1); there
were so many options to each, cc could no longer just assume
all linker commands were unrecognized and vice versa, and don't
flame at me for it!)
Note for Unix history buffs:  this feature wasn't in System III, so
it's quite recent.
       -Paul S. R. Chisholm       The above opinions are my own,
       {pegasus,vax135}!lzwi!psc  not necessarily those of any
       {mtgzz,ihnp4}!lznv!psc     telecommunications company.
       (*sigh* ihnp4!lzwi!psc does *NOT* work!!!  Use above paths.)
"Of *course* it's the murder weapon.  Who would frame someone with a fake?"



More information about the Comp.unix mailing list