I want to know how I can "give" a forked process a different dynamic library than the one it "asks" for. For example, if the fork "asks" for the library "foo.so" the main process "intercepts" that and instead provides "bar.so".
Considering I don't know much about how dynamic libraries are loaded, it's very much possible that this is impossible.


You can set LD_LIBRARY_PATH for the forked process in execve pointing to a directory with your custom version of foo.so. More about shared libraries and environmental variables that control the loading process here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.