识别哪个Linux系统库包含一个函数 [英] Identifying which Linux system library contains a function
问题描述
我使用的开发系统中,访问其中的函数时必须指定lib名称.
I am using a dev system where I have to specify the lib name when accessing a function inside it.
我以前使用过像open()这样的函数,并且以某种方式发现它们位于libc.so中.
I've used functions like open() before, and somehow found out that they're in libc.so.
现在,我想使用lstat(),但是看来这个不在libc中.可悲的是,我查看的手册页没有记录功能的位置.
Now I want to use lstat(), but it appears that this one is not in libc. Sadly, the man pages I looked at do not document the location of the functions.
因此,有两个问题:
- 有人可以告诉哪个库托管lstat吗?
- 通常我怎么能找到这个?除了在lib文件夹中的所有文件上使用grep"name"之外,我的意思是.
推荐答案
在C中构建一个简单的测试用例,对其进行编译,然后在其上运行"ldd -r"以检查加载了哪些库.如果您没有在C语言中获得lstat(),那么您的开发环境就会出现问题.或者这个环境可以追溯到符号链接时代之前:-)
Build a simple testcase in C, compile it and run 'ldd -r' on it to check what libs are loaded. If you don't get lstat() in C then you have a problem on your dev env. Or this env dates back before the age of symlinks :-)
这篇关于识别哪个Linux系统库包含一个函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!