0

I was taught the advantage of shared library over static library is that if I modify library source code, only shared library must be rebuilt whereas both library and program must be rebuilt in case using static library.

Today, I made some change in library and rebuilt the *.so file. However, the program loads new shared library and crash, I have to rebuild the program with new shared library to make it work. So my question is that:

1) How does program load the shared library? Why do I have to build the program again?

2) How about other libraries that depend on modified library, do I have to rebuild them too?

1 Answer 1

1

When using a new shared library with an old program, there's rules about what sort of changes the shared library can make to avoid breaking ABI compatibility. For example, it can add new functions and change the body of existing functions, but it can't remove functions or change the signature of existing functions. When other people make shared libraries, they take care of keeping track of this for you with versioning. If you're going to make your own, you need to keep track of this yourself.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.