peter@msinc.msi.com (Peter Blemel) (08/24/90)
It has been noted that the linker *should* resolve symbols to local code before resolving them from a library. Two problems arise from this assumption in my personal experience: 1) I decided to rewrite a function, but I changed the order of the arguments: If the system I am porting to has ansi prototypes the compiler will bomb on the code declaring that my arguments are incorrect. I had used index as a global int within a file (properly declaring it, and referencing it), but when I tried to port the code to a machine with prototypes, the compiler choked on my use of index because of the prototype definition, effectively making index a reserved word. Should functions in the standard c library be forced as reserved words? 2) In an even worse oversight, Apollo has implimented shared libraries including the lex library libl.a. My application needed a very large yytext[] array, so I declared it myself and the Sun/VAX/IBM linkers correctly used my array because I do not include -ll in the arguments to ld. The Apollo linker automagically loads all of the shared libraries, so that even though I do *not* specify -ll at link time, it is still loaded and a multiply defined symbol yytext is produced. My code (under these conditions) can not be ported without a rewrite becuase I need the expanded yytext buffer. Peter Blemel ---------------- unmvax.cs.unm.edu!bbx!yenta!msinc!peter