using libraries with ld (1)

David Sherman dave at lsuc.UUCP
Tue Aug 13 05:51:20 AEST 1985


In article <240 at cmu-cs-h.ARPA> rfb at cmu-cs-h.ARPA (Rick Busdiecker) writes:
>> You can always just name the library in the "ld" or "cc" command:
>> 	cc -o myprog myprog.o mysub.o mylib.a -lm -lplot
>
>I was under the impression that libraries specified in the way that mylib.a
>is have the entire library linked in rather than just those routines which
>are needed because of undefined identifiers.  Does anyone know if this is
>actually the case?

No, it's not the case. What you're probably thinking of is what
happens with "mysub.o" in the above example. All routines in mysub.o
will indeed get linked into your binary; the files in mylib.a will
only be taken as needed. Of course, once you take any .o file
(whether on the command line or from a .a archive), you get ALL
the routines in that file whether you want them or not.

Dave Sherman
The Law Society of Upper Canada
Toronto
-- 
{  ihnp4!utzoo  pesnta  utcs  hcr  decvax!utcsri  }  !lsuc!dave



More information about the Comp.unix mailing list