dmd's linking order

eles eles at eles.com
Wed Apr 11 12:51:05 PDT 2012


> Not exactly.  For example, Ubuntu 10 was perfectly happy 
> accepting libraries in any order.  Only with Ubuntu 11 did this 
> "revert" to the old way.

Actually, it looked like that. What happenned behind the doors it 
was that the linking proceeded with --as-needed and the expansion 
was on the spot.

Assume that you had libA depending on libB (but also on some 
other library that you do not use, namely libC).

if you tried to link:

gcc my_program.o -lB -lA (so, in reverse order)

this looked a bit like:

gcc my_program.o -lA -lB

BUT what really happened was that the true link command was now:

gcc my_program.o -lA -lB -lC -lB

where the "-lA -lB -lC" is the expansion of the previous "-lA".





More information about the Digitalmars-d mailing list