From: FermiPhysics <ant...@ya...> - 2009-07-30 14:31:38
|
I am trying to wrap a C++ class for Python. The platform is scientific Linux. The class I want my Python code to have access to is called feb. It inherits from a class called Frames. Here is the code for my feb.i file: %module feb %{ #include "feb.h" #include "Frames.h" #include "trips.h" #include "FrameTypes.h" %} class Frames { public: Frames(); virtual ~Frames(); unsigned char *message; void MakeDeviceFrameTransmit(Devices, Broadcasts, Directions, unsigned int, unsigned int); virtual void MakeMessage(); bool CheckForErrors(); inline unsigned char *GetOutgoingMessage(); void DeleteOutgoingMessage(); }; class feb : public Frames { feb(int, bool, febAddresses, int reg); ~feb(); febAddresses inline GetBoardNumber(); int inline GetFWB(); int inline GetMaxHits(); bool inline GetInit(); inline unsigned char *GetBuffer(); void inline SetMaxHits(int a); void inline SetInitialized(bool a); void SetFEBDefaultValues(); void ShowValues(); void MakeMessage(); void DecodeMessage(int); inline trips *GetTrip(int i); int inline WriteMessageLength(); unsigned char inline GetTripPowerOff(); unsigned short inline GetHVActual(); unsigned short inline GetHVTarget(); unsigned short inline GetHVPeriodAuto(); }; I include both the feb and Frames class declarations here. I used the following commands to generate the code: swig -c++ -python -o feb_wrap.cpp feb.i g++ -fPIC feb.cpp g++ -fPIC feb_wrap.cpp -I/home/users/chris/include/python2.6 g++ -shared feb.o feb_wrap.o -o _feb.so This worked fine, and I got a module _feb.so. Running swig also produced a module feb.py to import. When I ran python and tried to import it I got this error >>> import feb Traceback (most recent call last): File "<stdin>", line 1, in <module> File "feb.py", line 28, in <module> _feb = swig_import_helper() File "feb.py", line 25, in swig_import_helper import _feb ImportError: ./_feb.so: undefined symbol: _ZTV6Frames I think this could have to do with my inheritance situation, since the symbol probably comes from the Frames class. Where is my mistake? Thanks in advance, Chris -- View this message in context: http://www.nabble.com/ImportError%3A-undefined-symbol...what-could-this-mean--tp24739582p24739582.html Sent from the swig-user mailing list archive at Nabble.com. |