Question

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.

Was it helpful?

Solution

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

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top