tags:

views:

175

answers:

2

If I have a.o, b.o, and c.o, how do I make ld link them into d.o, which is then linked into my main object file? All that I want to have happen is that all the symbols in the input files get combined into one big output file.

+1  A: 

Found it. The -r option links files incrementally, so they can be used as input to ld.

computergeek6
+2  A: 

A concatenation of .o files is called a library. You create one with the ar library utility:

ar rvs mylib.a a.o b.o c.o

You can then link against the library:

cc main.c mylib.a
anon