Reputation: 3004
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?
Upvotes: 2
Views: 414
Reputation: 88711
You can make python dlopen
shared objects with the RTLD_GLOBAL
flag by calling setdlopenflags
in sys
, e.g.:
sys.setdlopenflags(dl.RTLD_NOW | dl.RTLD_GLOBAL)
before your module is loaded. (There's a discussion on swig-users about this)
Upvotes: 2