[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyKDE] Importing a generated library
From:       Ulrich Berning <ulrich.berning () desys ! de>
Date:       2004-01-27 12:32:29
Message-ID: 40165A5D.6090003 () desys ! de
[Download RAW message or body]

Jahn Otto Næsgaard Andersen schrieb:

>Hi,
>
>I have sip'ed a C++ class and compiled the resulting files with
>
>g++ -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -pipe -fPIC -O2 -Wall -W
>-D_REENTRANT -c -I.. -I. -I/usr/local/include/python2.3
>-I/home/jotto/work/hololib/src   sipHoloLibcmodule.cpp
>
>g++ -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -pipe -fPIC -O2 -Wall -W
>-D_REENTRANT -c -I.. -I. -I/usr/local/include/python2.3
>-I/home/jotto/work/hololib/src   sipHoloLibBird.cpp
>
>and then linked everything together with
>
>g++ -shared -Wl,-rpath,/usr/lib/qt-x11-free-3.2.3/lib
>-L/usr/local/lib/python2.3/site-packages -L/usr/local/lib/vtk -lvtkCommon
>-lvtkRendering -lvtkGraphics -lvtkHybrid -L/usr/lib/qt-x11-free-3.2.3/lib
>-lqt-mt -o hololib.so *.o /home/jotto/work/hololib/build/*.o
>
>
>The .o files in /home/jotto/work/hololib/build are C++ .o files that I
>don't need to access directly from python. Note that I am dynamically
>linking in qt and VTK.
>
>It compiles and links without errors, but when I copy the hololib.so to
>python's site-packages, I get the following error when I try to import:
>
>
>  
>
>>>>from hololib import *
>>>>        
>>>>
>Traceback (most recent call last):
>  File "<stdin>", line 1, in ?
>ImportError: dynamic module does not define init function (inithololib)
>
>
>I try to check the defined symbols in hololib.so with nm:
>
>jotto@holodeck(~/work/py_hololib/sipcode)$ nm hololib.so | grep initHol
>000172a0 T initHoloLib
>0002ad28 d _ZZ11initHoloLibE7methods
>
>It seems to me like initHoloLib is defined.
>
>I'm using RedHat 8.0, Python 2.3, SIP 4.0rc2 and gcc 3.2.
>
>Any ideas?
>
>
>
>Btw, thank you for all the help I have got so far! I think I'm close to
>the goal now :-)
>
>
>Jahn Otto
>
>_______________________________________________
>PyKDE mailing list    PyKDE@mats.imk.fraunhofer.de
>http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
>  
>
The exceptions message tells you exactly what is going wrong.

Your init function is initHoloLib, but you import hololib which expects 
an inithololib function.

Either your module name should be HoloLib.so (change the link target to 
-o HoloLib.so) or your init function should be inithololib (change 
%Module HoloLib to %Module hololib in your sip file).


Ulli






_______________________________________________
PyKDE mailing list    PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic