I am trying to use a third-party .so, P4API.so which calls clock_gettime defined in librt.so and would like users of my script not to have to set LD_PRELOAD. Therefore, in the init .py file , I have:
import ctypes
librt = ctypes.cdll.LoadLibrary('librt.so')
This loads the library in order, but running the script still emits:
ImportError: /path/to/P4API.so: undefined symbol: clock_gettime
I tried:
__builtins__['clock_gettime'] = librt.clock_gettime
but it doesn’t work either.
How can I get P4API.so to recognize loaded librt?
source
share