linux 查看so库文件函数信息

我的环境是ubuntu16.04

glibc官网:http://www.gnu.org/software/libc/libc.html

方法一、一般来说,涉及到库调用的程序,在链接时候都会链接到glibc,所以,可以用ldd命令来查看

复制代码
ghostwu@ubuntu:~/c_program/linux_unix/chapter4$ ldd ./pwd | grep libc
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7c45491000)
ghostwu@ubuntu:~/c_program/linux_unix/chapter4$ /lib/x86_64-linux-gnu/libc.so.6
GNU C Library (Ubuntu GLIBC 2.23-0ubuntu9) stable release version 2.23, by Roland McGrath et al.
Copyright © 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 5.4.0 20160609.
Available extensions:
crypt add-on version 2.1 by Michael Glad and others
GNU Libidn by Simon Josefsson
Native POSIX Threads Library by Ulrich Drepper et al
BIND-8.2.3-T5B
libc ABIs: UNIQUE IFUNC
For bug reporting instructions, please see:
https://bugs.launchpad.net/ubuntu/+source/glibc/+bugs.
复制代码
这个就是我的电脑上glibc的路径:/lib/x86_64-linux-gnu/libc.so.6

方法二:man -k glibc,可以找到一个系统函数gnu_get_libc_version,他可以用来获取版本

复制代码
ghostwu@ubuntu:~$ man -k libc
cracklib-check (8) - Check passwords using libcrack2
create-cracklib-dict (8) - Check passwords using libcrack2
curl-config (1) - Get information about a libcurl installation
error (3) - glibc error reporting functions
error_at_line (3) - glibc error reporting functions
error_message_count (3) - glibc error reporting functions
error_one_per_line (3) - glibc error reporting functions
error_print_progname (3) - glibc error reporting functions
glibc (7) - overview of standard C libraries on Linux
gnu_get_libc_release (3) - get glibc version and release
gnu_get_libc_version (3) - get glibc version and release
libc (7) - overview of standard C libraries on Linux
ghostwu@ubuntu:~$ man 3 gnu_get_libc_version
复制代码
复制代码
/*================================================================

  • Copyright © 2018 . All rights reserved.
  • 文件名称:check_glibc_version.c
  • 创 建 者:ghostwu(吴华)
  • 创建日期:2018年01月10日
  • 描 述:获取GNU C库(glibc)的版本号

================================================================*/

#include <stdio.h>
#include <gnu/libc-version.h>

int main(int argc, char *argv[])
{
printf( “glibc’s version: %s\n”, gnu_get_libc_version() );
return 0;
}
复制代码
方法三、getconf GNU_LIBC_VERSION

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

android framework

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值