Python dlopen / dlfunc / dlsym covers

Does anyone know if a shell or ported library really exists to access the dynamic Unix linker in Python?

+3
source share
2 answers

Will ctypes do what you want?

+7
source

The module is called dl :

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

... although this is nasty, and you might want to use ctypes or an extension module.

Edit

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

+2
source

Source: https://habr.com/ru/post/1704462/


All Articles