如何使用gcc检查动态库中符号的完整性
来源:互联网 发布:淘宝大买家 编辑:程序博客网 时间:2024/05/23 01:24
Check out the linker option "-z defs" / "--no-undefined". When creating a shared object, it will cause the link to fail if there are unresolved symbols.
If you are using gcc to invoke the linker, you'll use the compiler -Wl option to pass the option to the linker:
gcc -shared ... -Wl,-z,defs
As an example, consider the following file:
#include <stdio.h>
void forgot_to_define(FILE *fp);
void doit(const char *filename)
{
FILE *fp = fopen(filename, "r");
if (fp != NULL)
{
forgot_to_define(fp);
fclose(fp);
}
}
Now, if you build that into a shared object, it will succeed:
> gcc -shared -fPIC -o libsilly.so silly.c && echo succeeded || echo failedsucceeded
But if you add -z defs, the link will fail and tell you about your missing symbol:
> gcc -shared -fPIC -o libsilly.so silly.c -Wl,-z,defs && echo succeeded || echo failed/tmp/cccIwwbn.o: In function `doit':silly.c:(.text+0x2c): undefined reference to `forgot_to_define'collect2: ld returned 1 exit statusfailed
- 如何使用gcc检查动态库中符号的完整性
- gcc链接动态库时,两个动态库中符号重名的问题
- 在DB2中检查备份文件的完整性
- 利用栈检查程序中成对符号使用的正确性
- php中检查email完整性
- GCC制作动态库导出符号表
- jpeg 文件完整性的检查
- Linux 如何使用gcc生成静态库和动态库
- linux如何使用gcc生成静态库和动态库
- gcc的如何使用
- cygwin中如何使用gcc
- 如何检查补丁/软件下载的完整性? [视频] (文档 ID 2016783.1)
- python检查HTML的标签完整性
- python PIL 检查图片的完整性
- gcc中关于静态库和动态库使用
- gcc中关于静态库和动态库使用
- gcc中关于静态库和动态库使用 -转载
- gcc中关于静态库和动态库使用
- 任正非内部会谈:华为不开放就死亡 须力促创新
- 冒泡排序算法(Bubble Sort):
- 中国剩余定理那些事
- 智能普适网络架构及关键技术研究
- SAP之定价
- 如何使用gcc检查动态库中符号的完整性
- SAP之装运
- 任务驱动教学--让你月薪过5000的教学方式!
- SAP之开票
- 漾七夕
- SAP之SD主数据
- 《VC++深入详解》学习笔记 第五章 文本编程
- SAP 之 采购
- 相约世纪末