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.
Found it. The -r option links files incrementally, so they can be used as input to ld.
2
votes
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
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkRead more