On Monday 11 August 2003 9:32 pm, David Boddie wrote: > After lots of experimentation, I've come to the conclusion that I'm > fundamentally misunderstanding how to use various siplib functions. > > In particular, I thought I knew how to use the sipMapCppToSelf function, > but it appears that the various sipClass_ pointers I'm using are not > initialised. This might explain the crashes I've been encountering. > > In my library I do the following: > > 1. I initialise the Python interpreter and import a Python module. > > 2. The Python module imports all the modules it needs, including the > qt module (which is linked at compile time, but only resolved at > runtime). (I'm also linking against libsip.so, too). > > 3. I attempt to convert a QWidget* (the "parent" variable) to a Python > object using > > pArg1 = sipMapCppToSelf(parent, sipClass_QWidget); > > (pArg1 is a PyObject*) > > When parent is NULL, this succeeds; otherwise it fails. I discovered > that sipClass_QWidget has the value 0 so suspected that sipMapCppToSelf > catches the bad parent value normally but gets confused when it has to > deal with a NULL sipClass_QWidget value. > > The only thing I'm doing to make sipClass_QWidget visible to my library is > to declare > > extern SIP_IMPORT PyObject *sipClass_QWidget; > > Am I supposed to perform some sort of initialisation?
The initialisation happens in the call to libqtc.sipRegisterClasses() in qt.py. Ultimately it is done by sipRegisterClasses(). > Sorry if this is mentioned somewhere in the sources or available > documentation. If it is then I'd be happy to be redirected to it. Phil _______________________________________________ PyKDE mailing list [EMAIL PROTECTED] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde