Python dlopen/dlfunc/dlsym wrappers

﹥>﹥吖頭↗ 提交于 2019-12-12 14:33:49

问题


Anybody knows if actually exists a wrapper or ported library to access to Unix dynamic linker on Python?


回答1:


Would ctypes do what you want?




回答2:


The module is called dl:

>>> import dl
>>> dl.open("libfoo.so")
<dl.dl object at 0xb7f580c0>
>>> dl.open("libfoo.so").sym('bar')
1400432

... though it's nasty and you might want to consider using ctypes or an extension module.

Edit

Apparently, dl is deprecated in 2.6 so you'll want to use ctypes which has a better API anyhow.



来源:https://stackoverflow.com/questions/627786/python-dlopen-dlfunc-dlsym-wrappers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!