问题
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