Linking order question

Riccardo Manfrin riccardomanfrin@gmail.com
Wed Nov 13 15:27:00 GMT 2013


A library *BAR* is composed of the object file *bar**.o* that contains 
the symbol *foo* and *qux*.
A *FOO* library depends on symbol *foo*.
A *QUX* library depends on symbol *qux***.

Can I assert the following linking orders outcomes?

     -lFOO -lQUX -lBAR     : OK and logically right

     -lFOO -lBAR -lQUX     : OK <-- this still works because FOO brought 
in bar.o so QUX still finds the qux symbol.

     -lBAR -lQUX           : FAIL bar.o is excluded because it was not 
found to be useful to anyone preceeding -lBAR.

Is this correct?

Thanks and regards,
RM



More information about the Gcc-help mailing list