Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!linac!att!cbnewse!cbnewsd!knudsen From: knudsen@cbnewsd.att.com (michael.j.knudsen) Newsgroups: comp.os.os9 Subject: C Linker Library problems -- help! Keywords: OSK, C, linker, libraries Message-ID: <1991Apr25.175935.8665@cbnewsd.att.com> Date: 25 Apr 91 17:59:35 GMT Organization: AT&T Bell Laboratories Lines: 45 Could someone help explain the exact rules by which the OSK C Linker handles references to functions and global values that occur both in your program's .r files and also in a library file that you name with the -L flag? In theory, if function F exists in your own code and also a library, it is ignored in the library and your own F is linked. But it doesn't work that well for me -- I get "multiply defined symbol" errors. So I THINK the rules are more like: (1) If F is defined in both places (yours and library) and F is entirely self-contained in the library source (it makes no references to other functions or variables nor does anything else reference F), then the linker works well. (2) If F in the library source also is called by another function E in the library source, then you get an error. Your own F can't be linked because E is already pre-linked to the library's version of F. (This is my theory). (3) If F in the library calls G in the library, then by (2) you can't replace G with your own, but you *should* be able to replace F. Seems that you can't even replace F. If only (1) and (2) are true, then I should be able to replace an "incestuous" set of inter-twined fcns and vars if I redefine them all at once. If (3) also applies, then we're in big trouble. Anyone got the facts? The manual isn't very specific. PS: The .r file I'm using as a "lib" was not originally intended as such -- its several functions and global arrays were not MERGEd together, but just compiled from one source file. Does that confuse the Linker L68? THIS may be the real problem! Note that RDUMP doesn't list its individual functions; maybe that's why L68 can't pull them apart either. I lost that one .c source in a crash and am trying to replace its functions a few at a time, as I decide existing ones in the .r file are buggy. So I can't change the .r lib file now. Any way to split it into a merged lib format? -- "What America needs is A Thousand Points When Lit..." knudsen@iceland.att.com