SaurabhS
SaurabhS

Reputation: 663

Reducing disk size of dynamic libraries if code is shared between them

My C++ application loads two dynamic libraries libdy1.so and libdy2.so. I know both library libdy1.so and libdy2.so share lot of common code base. As these libraries are used only by my application i am thinking a way to reduce disk size of these library as they must be getting common symbols because of common code base. So during building library can i avoid putting a symbol in library libdy2.so or visa-versa if that is already present in another library . Something similar like that is possible?

Upvotes: 0

Views: 88

Answers (1)

eerorika
eerorika

Reputation: 238341

So during building library can i avoid putting a symbol in library libdy2.so or visa-versa if that is already present in another library

Yes, by dynamically linking one library with the other. The depender does not need the symbols that it finds from the dependee.

In case you don't want one library to depend on the other in its entirety, you can instead separate the common parts into a third library, and make both libraries depend on the common one.

Upvotes: 1

Related Questions