In my c/c++ mixed project, I'm building the source files of individual folders, archiving them with ar
into their own .a
files and then linking them all together at the final stage. So far so good. My question is, is it possible to hint any dynamic library dependencies at the ar
stage so, they don't have to be specified explicitly at the linking stage?
I mean, if a component depends on pthread and the final binary will need to link against it, possibly dynamically, can it not add this dependency to the archive, to be resolved later by the linker?
Would using the linker instead of ar
to create partially linked objects rather than archives provide any such facility to hint dynamic lib dependencies to be satisfied at the final linking stage?