Cascading static library linking?

Geri Borbás

I created a library kit! with common tools.

I created a library box! with cool features that uses kit!.

Now I want to create a client app that uses box!.

Do I have to link both libraries? Or will box! link kit!?


Hope the question makes sense. I use a workflow, where I include the library projects as well (to be able to edit libraries as well trough the development process), add them as target dependencies, import headers right from the project source directory.

justin

For static libraries, it's generally best to link kit and box to the client app -- directly.

If kit were a private dependency of box (i.e. private sub-library), then it makes sense to link kit with box so that clients don't have to manage private dependencies. You can also do that where you know there will always be a to-one dependency. So yes, you can add kit as a dependency to box and link kit to box. Then the client app can just link to box.

What you want to avoid with to-many dependencies is huge recursive builds, huge object files, symbol cloning/duplication, and not knowing which definitions you will end up with. Although they won't eliminate that problem, they will reduce it.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related