Description
(note: resolving #205 might avoid the issue in many cases in practice as well, but might not fully resolve it in case of different build configs)
When loading libz.so.1 with dlopen and RTLD_LOCAL it can happen that you end up with mysterious crashes.
The reason is that your library is run inside a program that ALSO uses zlib, but a different version and does not hide the symbols (loads it RTLD_GLOBAL, depends on it, ...).
The end result is that deflateInit2_ when calling deflateReset() ends up calling deflateReset from that INCOMPATIBLE version of zlib.
The normal solution to that is to link with -Wl,-Bsymbolic.
Alternatively (e.g. if one wanted to avoid depending on non-generic compiler options) it would be possible to forbid calling any exported functions from zlib code itself. This will be more difficult to do though, I do not know if there are any other pieces of code with this same issue.