[PyQt] SIP Problem dynamic loading in wrapped library
Jens Thoms Toerring
jt at toerring.de
Thu Mar 31 22:35:00 BST 2011
Hi,
yesterday I wrote about a problem with a SIP wrapped
shared library (written in C++) I have that in turn
dynamically loads further shared libraries - which fails
due to undefined symbols, but which definitely are defined
in the wrapped library. All this is currently tested under
Linux, so what I have tried to get around this is rather
Linux specific.
I haven't found a good solution yet but a work-around:
if I set LD_PRELOAD to the wrapped library when starting
Python (which should result, as far as I understand it, in
the wrapped library getting loaded before the SIP wrapper
library, which is linked against it) loading further shared
libraries from within the wrapped library suddenly works.
I am not really happy with this solution but I tell you
about it anyway in the hope that it rings a bell with some
of you and perhaps someone can explain to me what's going
on and, if I'm lucky, come up with a better solution;-)
BTW: since David Boddie mentioned that setting the
'QLibrary::ExportExternalSymbolsHint' for the shared
libraries might be required I also tried to make Python
use the RTLD_GLOBAL flag when opening shared libraries
with dlopen() in the hope that this would get the symbols
from the SIP wrapper and the wrapped library exported with
(where 'ZZPy' is the SIP wrapper for my 'ZZ' lib)
import sys as sys
if hasattr( sys, "setdlopenflags" ) :
import DLFCN
old_dlopen_flags = sys.getdlopenflags( )
sys.setdlopenflags( old_dlopen_flags | DLFCN.RTLD_GLOBAL )
import ZZPy as zz
sys.setdlopenflags( old_dlopen_flags )
else :
import ZZPy as zz
Unfortunately, this had no noticable positive effects.
Another thing I tried was adding '-rdynamic' to the compile
and link options for both the SIP wrapper and the wrapped
library, alas also without success:-(
Thanks for your attention and best regards, Jens
--
\ Jens Thoms Toerring ________ jt at toerring.de
\_______________________________ http://toerring.de
More information about the PyQt
mailing list