帮助使用LD_ preLOAD [英] Help with using LD_PRELOAD
问题描述
我想创建一个库的printf的修改版本,然后调用LD_ preLOAD所以,当我的程序调用printf它使用我的版本。谁能向我解释如何使用LD_ preLOAD,如果有一个特殊的东西,我需要在我的code或我的图书馆办?
I want to create a library with a modified version of printf and then call LD_PRELOAD so when my program calls printf it uses my version. Can someone explain to me how to use LD_PRELOAD and if there is a something special I need to do in my code or my library?
推荐答案
您只需设置环境变量 LD_ preLOAD
来的完整路径替换库。既然你那点之后推出的所有程序将会尝试使用这个库,你可能想使一个包装脚本,设置 LD_ preLOAD
然后调用你想要的程序运行。
You just set the environment variable LD_PRELOAD
to the full path to the replacement library. Since all programs you launch after that point will attempt to use this library, you may want to make a wrapper script that sets LD_PRELOAD
then calls the program you want to run.
这篇关于帮助使用LD_ preLOAD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!