Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!mcsun!ukc!acorn!john From: john@acorn.co.uk (John Bowler) Newsgroups: comp.sys.acorn Subject: Re: The linker Summary: Order of libraries is important Keywords: link libraries Message-ID: <6740@acorn.co.uk> Date: 29 Apr 91 18:00:10 GMT References:
Organization: Acorn Computers Ltd, Cambridge, UK Lines: 20 In article
maumg@warwick.ac.uk (Pop Mobility Freak) writes: >I am not really sure whether the linker should search previous libraries to >try and match unmatched references (do Un*x compilers do this?). No. Order of specification of libraries (and order wrt simple object modules) is almost always important. I have a feeling that it might not matter under VMS but I can't remember for sure :-) >The only thing which would not compile (by changing the order of the libraries >on the command line) is two libraries each of which has external references >into the other. If this was the case though the two library files should be >merged into one which would naturally solve the problem. A loop of three (ie >A uses B, B uses C, C uses A) or more libraries could have a similar effect. An alternative strategy is to repeat the libraries on the command line (I think this works with link, it certainly works with ld on UN*X systems). In some cases altering the order can alter the program produced - if, for example, two libraries duplicate the same function definition. John Bowler (jbowler@acorn.co.uk)