Skip to content
Advertisement

Can I get symbol names from one .so and make another .so see it?

I’ve built zlib and libpng separately (what are these libs doesn’t matter), so I’ve got libz.so and libpng.so now. With dlopen() and dlsym() I get function pointers from libpng.so and use them, but the problem is that, since libpng depends on zlib, I get linker errors when libpng function calls some zlib function inside itself. So my quiestion is: Is it possible to solve this problem without builing zlib with libpng together? Can I somehow get symbol names from zlib and make libpng see them?

P.S. I can’t use dynamic linking because of the task.

Advertisement

Answer

I’ve found the solution. Just use RTLD_GLOBAL flag in dlopen and you’ll be fine 🙂

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement