C++ dynamic linking to libraries upgrade

Viewed 43

I have a question regarding dynamic linking libraries. Say I have a libfoo.so that requires libbar.so. Currently it links with libbar.so.100 (version 1.0.0). There's a new version of bar, libbar.so.200, and foo does not use any new features of bar v2.0.0. and APIs which it was using are unchanged. Can I straightaway upgrade to libbar.so.200 and can libfoo dynamically link to it?

1 Answers

This is a question of ABI stability.

Often "major" versions of libraries break ABI stability and it won't work. That is one common way to distinguish between major and minor version bumps; minor version bumps are backwards compatible, major ones are not.

There is no guarantee at all either way. Many minor details could make it work or not, and it requires some effort on the part of the library developer to ensure it does work.

Related