Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!telxon!gorpong From: gorpong@telxon.uucp (Gordon C. Galligher) Newsgroups: comp.unix.questions Subject: Re: Creating libraries of object module Summary: also can use -Lpath Message-ID: <480@telxon.UUCP> Date: 2 Mar 90 19:37:28 GMT References: <34230@news.Think.COM> <12233@smoke.BRL.MIL> Sender: news@telxon.UUCP Reply-To: gorpong@telxon.UUCP (Gordon C. Galligher) Organization: Telxon Corporation, Akron Ohio (NNTP with a :-) Lines: 29 In article <12233@smoke.BRL.MIL> gwyn@brl.arpa (Doug Gwyn) writes: >In article <34230@news.Think.COM> saroff@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 Doug is absolutely correct about the 'ar' utility. Another thing which he didn't mention about the -l flag is the ability to use the -L_path_ flag. This flag, when given, causes the loader (ld(1)) to search that directory for libraries of the form libxxxx.a also. This gives you the ability to have a directory of libraries ($HOME/lib for example) and then on your cc or ld command lines just give: cc -o file .o_files -L$HOME/lib -lm -lmylib1 -lmylib2 Just another way to do the exact same thing. This gives you a shortcut if you happen to have more than one "local" library you will be using. -- Gordon. Gordon C. Galligher <|> ..!uunet!telxon!gorpong <|> telxon!gorpong@uunet.uu.net Telxon Corporation <|> "I am attempting, ma'am, to make a mnemonic memory Akron, Ohio, 44313 <|> circuit out of stone knives and bearskins" - Spock (216) 867-3700 (3512)<|> _City on the Edge of Forever_