goldenmean
goldenmean

Reputation: 18956

Wanted to know in detail about how shared libraries work vis-a-vis static library

I am working on creating and linking shared library (.so). While working with them, many questions popped up which i could not find satisying answers when i searched for them, hence putting them here. The questions about shared libraries i have are:

1.) How is shared library different than static library? What are the Key differences in way they are created, they execute?

2.) In case of a shared library at what point are the addresses where a particular function in shared library will be loaded and run from, given? Who gives those functions is load/run addresses?

3.) Will an application linked against shared library be slower in execution as compared to that which is linked with a static library?

4.) Will application executable size differ in these two cases?

5.) Can one do source level debugging of by stepping into functions defined inside a shared library? Is any thing extra needed to make these functions visible to the application?

6.) What are pros and cons in using either kind of library?

Thanks.

-AD

Upvotes: 5

Views: 2638

Answers (1)

anon
anon

Reputation:

See this SO question When to use dynamic vs. static libraries and this HOWTO.

Upvotes: 1

Related Questions