
On 9/19/2013 3:20 AM, Quoth Ulf Samuelsson:
That still does not mean that you cannot parse a command line before starting the actual link process.
It's not about the command line parsing, it's about the order that the objects and libraries themselves are parsed in. The order in which objects are linked can be critically important for certain designs (eg. if you do want a symbol in your application to override one provided by a library, or if you're building a multi-object data structure in a special shared data section). And so that order has been defined as the order that they're listed on the command line, which just makes sense. Sure, it can be a little surprising when you're not used to it, but it's not hard to get it "right" thereafter. And while it's possible to tell the linker to loop through multiple times until it's found everything, this is generally a bad idea as it hides circular dependencies, which are usually a sign of a bad design. And it's slower than just listing things in the correct order to begin with.