Path: utzoo!utgpu!watmath!clyde!att!rutgers!mailrus!ames!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: C/Unix Libraries Message-ID: <9054@smoke.BRL.MIL> Date: 4 Dec 88 05:02:51 GMT References: <18524@shemp.CS.UCLA.EDU> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB)) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 23 In article <18524@shemp.CS.UCLA.EDU> kirkaas@cs.ucla.edu (paul kirkaas) writes: >Is there any way to look at a library or object file & tell what routines >are defined in it? "nm" seems only to tell what symbols appear >in an object file; not whether they are defined there or not. Since I don't know your specific C system, all I can give is generic UNIX advice. All flavors of "nm" I'm familiar with do show the difference between the definition of a symbols and a reference to it. >I particularly find this a problem when I port complex programs & get >a lot of link time undefined symbol errors. Most linkers I know of have an option to trace def of/ref to a symbol during linking. (On VAX 4.3BSD it's "ld -y symbol".) System V "cc" should support the -# option, which prints the commands that would be executed to do the real compilation/linking ("cc" itself is just a driver). So add -# to your link command line, then on your 630, or using EMACS, or whatever, edit the displayed result to include -y symbol (or whatever option your manual says to use on the "ld" command line), then send the edited result as a manual "ld" command. (If you don't have a decent interactive environment you'll have to type this in by hand.) "ld" should show clearly where the references to the symbol are being made.