First, we have a system
project, which provides some abstract architecture classes. Then, several module
projects with different names inherit from one of system's classes to implement specialized features. Last, an application
brings both together. It instantiates the base architecture from system and attaches modules to it.
This gives the following dependencies.
system
has no dependencies and builds to a static library.module
s depend on system
and build to static libraries.application
depends on system
and on all module
s and builds the executable.When I build this setup, do all module
libraries contain copies of the system
library? If so, can I prevent this behavior? In the end, they are, anyway, statically linked together in the executable along with the system
library.
When you build a library, nothing gets linked. A library is just a bunch of object files stuck together in an archive. It's only when you build an application that the linker gets involved, pulling in the pieces that are needed by the various components of the application.