Change library load order at run time (like LD_PRELOAD but during execution)

Posted by tylerl on Stack Overflow See other posts from Stack Overflow or by tylerl
Published on 2010-06-18T06:10:30Z Indexed on 2010/06/18 6:13 UTC
Read the original article Hit count: 229

Filed under:
|
|

How do I change the library a function loads from during run time?

For example, say I want to replace the standard printf function with something new, I can write my own version and compile it into a shared library, then put "LD_PRELOAD=/my/library.so" in the environment before running my executable.

But let's say that instead, I want to change that linkage from within the program itself. Surely that must be possible... right?

© Stack Overflow or respective owner

Related posts about c

    Related posts about linux