dlopen打开的so库的引用计数
来源:互联网 发布:awesome note for mac 编辑:程序博客网 时间:2024/06/18 08:31
http://stackoverflow.com/questions/4732018/what-happens-to-the-global-variables-in-shared-library-when-dlclose-is-called-on?rq=1
If dlclose
reduces the reference count to zero and the library is actually unloaded, any future reloading of the library should reset all variables with static storage duration in the library to their original values.
However, if the library was opened more than once, all but the final call to dlclose
will just decrement the reference count. Sometimes it may not be obvious whether a library was opened more than once, since it might have gotten loaded as a dependency of some other library without you knowing, unless it's a module local to your program, so it's probably not a good idea to rely on this "reset" behavior.
Employed Russian added:
Even if the library is
dlopen()
ed anddlclose()
d exactly once, and is not a dependency of something else, the act of referencing symbols from it (viadlsym()
) will also increment the reference count (and make the library not unloadable); at least on Linux.
I have no idea if this information is accurate or not. In the future, please post new information as a comment or a new answer, not an edit to other people's answers. If you just edit someone else's answers, you make them take responsibility for the correctness of your answer, which they may not want.
是这样的吗? dlsym()也会增加dl的引用计数? 那什么时候引用计数会变为 0 呢?- dlopen打开的so库的引用计数
- dlsym dlopen打开动态链接库后返回的指针
- python的引用计数
- 自己的引用计数
- GC的引用计数
- 引用计数的问题
- JNI 如何使用dlopen,dlsym调用第三方自定义的 .so库(包括JNI->JNI)
- JNI 如何使用dlopen,dlsym调用第三方自定义的 .so库( JNI->C,C++)
- 用g++编译生成动态连接库*.so的方法及连接(dlopen() dlsym() dlclose())
- linux下so库的加载和使用(dlopen/dlsym/dlclose)
- C中调用.so库中的函数与dlopen调用函数的区别
- 自定义so的引用
- dlopen dlerror dlclose dlsym 未定义的引用的解决方案
- Android中so库的引用问题
- 编动态链接库时,提示 对‘dlopen’未定义的引用.该如何解决
- 动态库的动态链接、打开、调用,使用dlopen、dlsym和dlclose
- COM的引用计数规则
- 组件的引用计数问题
- epoll去实现一个服务器
- linux 启动过程
- 如何:使用后台辅助线程
- ExtJs3引包的问题
- 绑定cpu技术
- dlopen打开的so库的引用计数
- http://www.jmedved.com/2011/12/downloading-file-with-progress/
- Rb-tree中删除元素后树形调整函数_Rb_tree_rebalance_for_erase
- HDU 2438 三分
- Why Google better than baidu
- ios 手机号码验证
- rcp(插件开发)如何获取显示在编辑区的所有编辑器及获取其中之一
- 省赛训练之基础(一)
- C8051F330 Flash访问单元