mardi 3 mars 2015

Swig Python not wrapping methods



I am attempting to wrap with SWIG a c file that has a long list of user defined include "*.h" files.


Looking at the swig complied *.py file all methods contained in certain *.h files seemed to be included in wrapped code and none of the methods in different *.h files.


While the file does not throw errors while compiling or setup, I am getting a segmentation fault (core dumped) when running the one of the non-included methods. Since the method does not appear in the *.py file I cannot seem to debug it using gdb or pdb.


gdb does seem to trace through the included wrapped methods that are found in *.py file.


Here is the include statements in the rtserver.c file



#include "rtypes.h"
#include "option.h"

#include "tcpipmsg.h"

#include "dmap.h"
#include "rprm.h"
#include "fitdata.h"
#include "radar.h"
#include "rmsg.h"
#include "rmsgrcv.h"
#include "errlog.h"

#include "fitpacket.h"
#include "fork.h"

#include "errstr.h"
#include "hlpstr.h"

#include "version.h"

#include "rtserver.h"


The rtserver.i file



%module rtserver
%import "fitdata.i"

%{
#include <zlib.h>
#include "rtypes.h"
#include "option.h"

#include "tcpipmsg.h"

#include "dmap.h"
#include "rprm.h"
#include "fitdata.i"
#include "radar.h"
#include "rmsg.h"
#include "rmsgrcv.h"
#include "errlog.h"

#include "fitpacket.h"
#include "fork.h"

#include "version.h"
#include "rtserver.h"
%}

%include "rtypes.h"
%include "option.h"
%include "tcpipmsg.h"
%include "dmap.h"
%include "radar.h"
%include "rmsg.h"
%include "rmsgrcv.h"
%include "errlog.h"

%include "fitpacket.h"
%include "fork.h"
%include "version.h"
%include "rtserver.h"


Here is the gcc -shared statement:



gcc -shared -g rtserver_wrap.o connect.o fitpacket.o fork.o msgmem.o socket.o radar.o rmsgrcv.o rprm.o option.o fit.o dmap.o convert.o merge.o errlog.o time.o tcpipmsg.o printinfo.o fitwrite.o rtserver.o -o _rtserver.so


In this instance methods from rmsgrcv.h and tcpipmsg.h are included but not fit.h or rprm.h.


This is an example from rtserver.py of one of the wrapped messages:



def RMsgRcvDecodeData(*args):
return _rtserver.RMsgRcvDecodeData(*args)
RMsgRcvDecodeData = _rtserver.RMsgRcvDecodeData



Aucun commentaire:

Enregistrer un commentaire