什么是LD_PRELOAD技巧? [英] What is the LD_PRELOAD trick?
本文介绍了什么是LD_PRELOAD技巧?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我最近在 proggit 上参考了和(截至目前)没有解释。
I came across a reference to it recently on proggit and (as of now) it is not explained.
I suspect this might be it, but I don't know for sure.
推荐答案
如果将 LD_PRELOAD
设置为共享对象的路径,该文件将在之前加载到任何其他库(包括C运行时, libc.so
)。所以要运行 ls
与您的特殊 malloc()
实现,请执行以下操作:
If you set LD_PRELOAD
to the path of a shared object, that file will be loaded before any other library (including the C runtime, libc.so
). So to run ls
with your special malloc()
implementation, do this:
$ LD_PRELOAD=/path/to/my/malloc.so /bin/ls
这篇关于什么是LD_PRELOAD技巧?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文