There are two different modules I am trying to load, that link against separate versions of the same shared-library.
Here is the pseudocode for the problem; where UserModule needs the same library and symbols as the initial module.
# dummy load initial module
import ctypes
ctypes.CDLL('/path/to/different/libname.so')
# load another module
import UserModule
ImportError: /path/to/UserModule/libUserModule.so: undefined symbol
I can delete the initial shared library using ctypes.CDLL('libdl.so').dlclose(), and then load the next library. But I want a method to them both loaded in memory at the same time without having this messiness.
I also tried to use
# try to load memory locally
import sys
import DLFCN
sys.setdlopenflags( DLFCN.RTLD_NOW | DLFCN.RTLD_LOCAL )
# dummy load initial module
import ctypes
ctypes.CDLL('/path/to/different/libname.so')
# load another module
import UserModule
But it fails with the same error.
Is there any way to load a module with the same name into memory in python, to be usable with different modules?
Edit: To be more precise with the question. Python loads in a shared library into memory. When I try to import another module which links to a different shared library with the same name, it seems that python is not loading in this new shared library. Why would this occur?