How to build a dynamic library with no dynamic dependencies?

Viewed 16

I want to build a shared object, that I can load using LD_PRELOAD (which replaces some functionality of otherwise loaded libraries). How can I make this library to have no dynamic dependencies (i.e. essentially being a static build of a shared library, if that makes sense)?

Something simple like gcc -shared -static -fPIC source.c fails. I skimmed through the other related questions, and cannot seem to find something that would work in this scenario. Is this even possible?

0 Answers
Related