From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-01-30 09:22:13
I've just comitted code which computes proper library order for gcc. The
implementation is quite simple and supposedly inefficient, but on my project
the performance did not suffer.
The only limitation is that the code does not work for searched libraries, but
I'm going to fix that really soon.
I'd appreciate some testing of this new code. I attach the notes telling how
it's supposed to work.
--Boundary-00=_VimGAXBADWCWXgn Content-Type: text/plain;
For gcc, we need to determine link-order relationships between
libraries on command line. Library 'a' must come before 'b' on
comamnd line if 'a' uses symbols from 'b' (well, actually, this
is only true for static libraries, see below).
We decide that this is so in two cases:
lib a : b ;
lib a : <use>b ;
Where <use> can be replaced by any dependency property. The actual
logic is within linking-generator. When it sees targets of type
'LIB' in sources of dependency properties of type 'LIB', it set up
the appropriate order requirements.
Some additional facts:
1. For symbols in dynamic libraries, order does not matter. They
are always found, nor matter is they are references from another
dynamic library or static library. (Dynamic linker, luckily,
is not order-sensitive).
2. For static libraries, order matters.
- If a symbols in static library is referenced, the library
must be present on command line after library where reference
- References to dynamic library are not order-sensitive.
3. Using library via full filename and via -l switch is equvivalent.
Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk