简体   繁体   中英

Redundant occurances of a statically linked library?

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.
  • All 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM