dlsym RTLD_DEFAULT
来源:互联网 发布:速卖通打单软件 编辑:程序博客网 时间:2024/06/05 19:35
今天看alsa-lib的代码,发现一个场景是会调到
dlsym(RTLD_DEFAULT, name);
也就是说,handle=RTLD_DEFAULT,在网上查了下,这种情况下会发生的事情是,会在当前进程中按照 default library search order搜索name这个symbol,网上的介绍摘录如下:
http://www.qnx.de/developers/docs/6.4.0/neutrino/lib_ref/d/dlsym.html?lang=cn
If handle is a handle returned by dlopen(), you must not have closed that shared object by calling dlclose(). The dlsym() functions also searches for the named symbol in the objects loaded as part of the dependencies for that object.
If handle is RTLD_DEFAULT, dlsym() searches all objects in the current process, in load-order.
In the case of RTLD_DEFAULT, if the objects being searched were loaded with dlopen(), dlsym() searches the object only if the caller is part of the same dependency hierarchy, or if the object was loaded with global search access (using the RTLD_GLOBAL mode).
http://www.linux.com/learn/docs/man/2818-dlsym3
dlsym()
The function dlsym() takes a "handle" of a dynamic library returned by dlopen() and the null-terminated symbol name, returning the address where that symbol is loaded into memory. If the symbol is not found, in the specified library or any of the libraries that were automatically loaded by dlopen() when that library was loaded, dlsym() returns NULL. (The search performed by dlsym() is breadth first through the dependency tree of these libraries.) Since the value of the symbol could actually be NULL (so that a NULL return from dlsym() need not indicate an error), the correct way to test for an error is to call dlerror() to clear any old error conditions, then call dlsym(), and then call dlerror() again, saving its return value into a variable, and check whether this saved value is not NULL.
There are two special pseudo-handles, RTLD_DEFAULT and RTLD_NEXT. The former will find the first occurrence of the desired symbol using the default library search order. The latter will find the next occurrence of a function in the search order after the current library. This allows one to provide a wrapper around a function in another shared library.
- dlsym RTLD_DEFAULT
- dlsym参数RTLD_DEFAULT、RTLD_NEXT
- dlsym
- dlsym
- dlsym函数
- dlsym函数
- dlopen dlsym dlclose解析
- dlopen, dlsym 的简介
- dlopen dlsym dlclose dlerror
- dlopen dlsym dlclose dlerror
- linux dlopen于dlsym
- dlopen和dlsym
- dlopen和dlsym
- dlopen和dlsym
- dlopen;dlclose;dlsym
- dlopen与dlsym用法
- HAL dlopen dlsym
- dlopen与dlsym
- MFC,单文档视图创建顺序
- LVM、checkfs先于ISCSI initiator加载引起的开机错误
- 自定义标签库
- (三)CvSeq数据结构
- C#实现脚本计算
- dlsym RTLD_DEFAULT
- 测试人员应具备的几种思维方式,你是否也具备了?
- window下配置apache+php5.3+memcache
- vc如何派生CWNd类
- Fedora 14 下内核编译 最新内核 kernel 2.6.38以及删除自己编译的内核
- s3c6410存储器映射
- C#调用非托管DLL函数bitblt实现截屏
- 测试leader的职责和技能,对比一下自己
- C++中的引用