6 ms·
> It's not shared state - dynamic libraries don't share any more state between processes than static libraries do. The above sentence could be misconstrued. I
by amscanne 13y ago
> It's not shared state - dynamic libraries don't share any more state between processes than static libraries do.
The above sentence could be misconstrued.
I assume when you say static libraries, you mean standard shared libraries (i.e. those listed when you run ldd). Not statically-linked libraries?
- caf 13y agoShared libraries on Linux only share read-only text and data, which should not be application-visible. If you want to share state between processes, the library must explicitly set up a shared mapping - but of course a statically linked library can do this just as well.
- amscanne 13y agoYes, I know. My point was related to the terminology re: static, dynamic, shared, etc. A statically-linked library won't share any state with other users of the library. It's statically-linked into the binary. State will be shared only with the instances of the same binary.
- caf 13y agoIt is irrelevant whether the library is statically-linked into the binary or not - a statically-linked library can share state with instances of that library linked into other binaries just as easily as a dynamically-linked library can. In both cases the library must explicitly set up some shared state.