tags:

views:

25

answers:

2

I knew gcc linker always looking extern function in later obj or lib file. is there a way tell linker looking reference in entire obj file or lib, if linker did not find in later obj.

for examole,

ld a.obj b.obj c.obj

if linker did not find x function in a.obj, it will looking into b.obj or c.obj.

if linker did not find xx function in b.obj, it will looking into c.obj. and if xx function is in a.obj, linker will complain no reference to xx. how to solve this problem.

Thanks

+1  A: 

Not the clearest of questions, but perhaps you're looking for the -( ... -) (or --start-group ... --end-group) options to ld (as described in man ld or the ld documentation online)?

Matthew Slattery
A: 

@Matthew's answer may help solve your initial problem (at a potentially significant performance cost), but if your object files are so order dependent, it seems like you have issues with a non-orthogonal design.

Scottie T