I am trying to load a .so library in Python using ctypes. This library has many files in /home/me/my_library. When I load
from ctypes import *
lib = CDLL('/home/me/my_library/main.so')
I get
OSError: not_main.so: cannot open shared object file: No such file or directory
Note that the error is with not_main.so and not with main.so. All the files are within /home/me/my_library. I think the problem is that I have to add the path to this library, which in Windows can be done using os.add_dll_directory. How would I do this in Linux? Is there a cross-platform way of doing this?
Note I have tried with os.environ['LD_LIBRARY_PATH'] = '/home/me/my_library/' but it does not work.