Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!att!cbnewsd!knudsen From: knudsen@cbnewsd.att.com (michael.j.knudsen) Newsgroups: comp.os.os9 Subject: Re: C Linker Library problems -- help! Keywords: OSK, C, linker, libraries Message-ID: <1991Apr29.223454.5112@cbnewsd.att.com> Date: 29 Apr 91 22:34:54 GMT References: <1991Apr25.175935.8665@cbnewsd.att.com> <196@blars> Organization: AT&T Bell Laboratories Lines: 53 In article <196@blars>, blarson@blars writes: > >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. > Nice theory. Too bad it's wrong. (Most unix linkers work that way.) Not entirely wrong. I successfully replaced gets() with my own version on both 6809 and 68K, putting my gets() in a mainline file. > L68 does not allow multiple routines with the same name. Circularly > refering routines, which other operating systems allow by putting the > same routine in the library multiple times, must be done as a single > source file on OSK. This is one of the uglier hacks still needed in C > news for OSK. Yes -- according to Tim Koonce/Kientzle, L68 does two passes and will complain if the same name shows up twice in a lib. > All routines in any one source file are always pulled in as a unit. > Confuse, no, but it won't pull the routines apart. Yep, others have confirmed that this is the problem. THe bunch of functions I'm trying to replace was not intended as a lib and so was not MERGEd up. > Microware even took advantage of this on their 6809 version by having > some routines printf needed only pulled in if there was a reference to > another function in your code. (The other function did nothing, and Yeah, pflinit() and pffinit(). Another smart thing I discovered -- if your mainline declares some data array as extern but never actually refers to it in executable code, AND you have that array in another mainline file, the linker just leaves it out! I found this out when I added a nonsense array just to pad the data size out to a certain value. > It would be nice. Sugest it as an enhancement to microware. I guess for 68K this is not necessarily a joke, as it has been for years with 6809. Hope M'ware doesn't abandon OSK for OS-9000 for a few more years... James? > >Any way to split it into a merged lib format? > Dissassemble or rewrite. Will rewrite ultimately (source was lost in a crash). Meanwhile someone suggested going into the .r file with a binary editor and changing the names of any functions I wanted to replace incrementally. What a hack, but maybe worth it. -- "What America needs is A Thousand Points When Lit..." knudsen@iceland.att.com