|
From: William S F. <ws...@fu...> - 2011-09-19 21:24:18
|
On 19/09/11 14:55, Teemu Ikonen wrote: > Hello all, > > I'm trying to compile a Python SWIG interface to to Coin3D > (coin3d.org) called pivy (see > http://hg.sim.no/Pivy/default/file/8eab90908f2a/interfaces for the > interface code). The interface generation used to work perfectly with > the swig 1.3 series, but with swig 2.0.4 compilation of the generated > wrapper code fails. > > It turns out that the problem appears when a call to a function with a > function pointer reference argument is made. The function causing the > problem has this signature: > > static SbBool getHeaderData(const SbString& headerstring, > SbBool& isbinary, > float& ivversion, > SoDBHeaderCB *& precallback, > SoDBHeaderCB *& postcallback, > void *& userdata, > SbBool substringok = FALSE); > > where SoDBHeaderCB is > > typedef void SoDBHeaderCB(void * data, SoInput * input); > > Version 1.3 produces this call in the generated Python extension code: > > result = (SbBool)SoDB::getHeaderData((SbString const > &)*arg1,*arg2,*arg3,*arg4,*arg5,*arg6,arg7); > > and version 2.0.4: > > result = (SbBool)SoDB::getHeaderData((SbString const > &)*arg1,*arg2,*arg3,arg4,arg5,*arg6,arg7); > > i.e. args 4 and 5 are not dereferenced, although rest of the argument > unpacking code in the Python extension is identical between the two > swig versions. When compiling, a matching getHeaderData function is > not found, causing this error with swig 2.0.4: > > pivy/coin_wrap.cpp: In function 'PyObject* > _wrap_SoDB_getHeaderData__SWIG_0(PyObject*, PyObject*)': > pivy/coin_wrap.cpp:35402:96: error: no matching function for call to > 'SoDB::getHeaderData(const SbString&, SbBool&, float&, void > (**&)(void*, SoInput*), void (**&)(void*, SoInput*), void*&, SbBool&)' > pivy/coin_wrap.cpp:35402:96: note: candidate is: > /usr/include/Inventor/SoDB.h:65:17: note: static SbBool > SoDB::getHeaderData(const SbString&, SbBool&, float&, void (*&)(void*, > SoInput*), void (*&)(void*, SoInput*), void*&, SbBool) > /usr/include/Inventor/SoDB.h:65:17: note: no known conversion for > argument 4 from 'void (**)(void*, SoInput*)' to 'void (*&)(void*, > SoInput*)' > > See here http://people.debian.org/~lucas/logs/2011/08/22/pivy_0.5.0~svn765-2_lsid64.buildlog > for a full Debian build log. > > There are no typemaps affecting function pointers in the interface > code that I can find, so this looks to me like a genuine regression in > swig. Any hints on how to get this interface working? > It is now fixed for swig-2.0.5, see http://swig.svn.sourceforge.net/swig/?rev=12814&view=rev Until it is released, you could use %exception as a workaround to replace the call to the wrapped function. William |