I have a C++ library that I am wrapping with SWIG to make accessible in python. It is my understanding (from experience) that when SWIG wraps a C++ library in python, upon loading it places the C++ library symbols in a “local” scope. That is – a scope which does not enable future dynamically linked libraries to find the symbols.
(I’m getting this definition of “local” from man dlopen(3) )
Is there any way to get SWIG to place these symbols into the “global” scope, such that any future dynamically linked libraries can find them?
You can make python
dlopenshared objects with theRTLD_GLOBALflag by callingsetdlopenflagsinsys, e.g.:before your module is loaded. (There’s a discussion on swig-users about this)