Problem on SWIG/C++/Python

clio wangye1 at auburn.edu
Tue Sep 25 11:50:53 EDT 2001


Hi,

I am trying to make a C++ code be used by Python. I used swig to build 
the interface between Python and C++.
This is the interface file:

/*clientapi.i*/

%module clientapi

%{
#include "nr.hh"
#include "dr.hh"
%}

extern NRSimpleAttributeFactory<char *> TargetAttr;
extern NRSimpleAttributeFactory<int> AppDummyAttr;
extern NRSimpleAttributeFactory<char *> AppStringAttr;
extern NRSimpleAttributeFactory<int> AppCounterAttr;

extern int lookup_service( char * sv_type, char * spec_svname, NRAttrVec 
*In_list, NRAttrVec *Out_list, int &intertype );
extern int service_exec( char *serv_name, NRAttrVec *Sv_In, NRAttrVec * 
& Sv_Out, int intertype );
--------------------------------

"NRSimpleAttributeFactory" and "NRAttrVec" are defined in "nr.hh", the 
two functions are what I want to use in Python code.

I get it compiled and get the shared library, clientapimodule.so.
But I saw this in Python:

Python 1.5.2 (#1, Mar  3 2001, 01:35:43)  [GCC 2.96 20000731 (Red Hat 
Linux 7.1 2 on linux-i386
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
 >>> import clientapi
Traceback (innermost last):
  File "<stdin>", line 1, in ?
ImportError: ./clientapimodule.so: undefined symbol: __builtin_new
 >>>

Anybody can tell me why I got this error and how to fix this problem. 
Thank you!

Clio




More information about the Python-list mailing list