|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Problem with SwigValueWrapperThis one I do think is a bug rather than a "feature"; the non-use of
SwigValueWrapper when it's needed, and the ignoring of a %feature ("valuewrapper"). This is swig 1.3.40 and -python -c++. // -*- c++ -*- %module hoo %inline %{ template<typename Matrix> class MatrixBase { private: MatrixBase() {} }; class Matrix { }; template<typename T> class TMatrix { }; %} //%template(MMatrix) MatrixBase<Matrix>; // makes no difference //%feature("valuewrapper") MatrixBase<Matrix>; // makes no difference %typemap(in) MatrixBase<Matrix>() { } %inline %{ #if 1 void size(MatrixBase<Matrix> mat); // fails #else void size(MatrixBase<TMatrix<int> > mat); // OK #endif %} With "#if 1" (i.e. void size(MatrixBase<Matrix> mat);) the generated code uses: SWIGINTERN PyObject *_wrap_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; MatrixBase< Matrix > arg1 ; and fails to compile due to MatrixBase's private constructor. With "#if 0" the code uses SwigValueWrapper and all is well: SWIGINTERN PyObject *_wrap_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; SwigValueWrapper< MatrixBase< TMatrix< int > > > arg1 ; I'm actually most concerned about %feature("valuewrapper") MatrixBase<Matrix>; being apparently ignored as I have a class that should have a private default constructor, but in fact has one that just crashes... R ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Swig-user mailing list Swig-user@... https://lists.sourceforge.net/lists/listinfo/swig-user |
|
|
Re: Problem with SwigValueWrapperRobert Lupton the Good wrote:
> This one I do think is a bug rather than a "feature"; the non-use of > SwigValueWrapper when it's needed, and the ignoring of a %feature > ("valuewrapper"). This is swig 1.3.40 and -python -c++. > > // -*- c++ -*- > %module hoo > > %inline %{ > template<typename Matrix> > class MatrixBase { > private: > MatrixBase() {} > }; > > class Matrix { }; > > template<typename T> > class TMatrix { }; > %} > > //%template(MMatrix) MatrixBase<Matrix>; // makes no difference > //%feature("valuewrapper") MatrixBase<Matrix>; // makes no difference > > %typemap(in) MatrixBase<Matrix>() { } > > %inline %{ > #if 1 > void size(MatrixBase<Matrix> mat); // fails > #else > void size(MatrixBase<TMatrix<int> > mat); // OK > #endif > %} > > With "#if 1" (i.e. void size(MatrixBase<Matrix> mat);) the generated > code uses: > > SWIGINTERN PyObject *_wrap_size(PyObject *SWIGUNUSEDPARM(self), > PyObject *args) { > PyObject *resultobj = 0; > MatrixBase< Matrix > arg1 ; > > and fails to compile due to MatrixBase's private constructor. With > "#if 0" the code > uses SwigValueWrapper and all is well: > > SWIGINTERN PyObject *_wrap_size(PyObject *SWIGUNUSEDPARM(self), > PyObject *args) { > PyObject *resultobj = 0; > SwigValueWrapper< MatrixBase< TMatrix< int > > > arg1 ; > > I'm actually most concerned about %feature("valuewrapper") > MatrixBase<Matrix>; being apparently ignored as I have a class that > should have a private default constructor, but in fact has one that > just crashes... > template parameter 'Matrix' and the class 'Matrix'. If you change template<typename Matrix> ... to template<typename M> ... you can work around the problem. Alternatively, you need your feature declarations before the class that you want to attach them to, so use this: %feature("valuewrapper") MatrixBase; before MatrixBase is defined. William ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Swig-user mailing list Swig-user@... https://lists.sourceforge.net/lists/listinfo/swig-user |
|
|
ruby 1.9.1 wrapper file compile error ID GC_VALUE::hash_id = rb_intern("hash");Hi
The wrapper module of SWIG 1.3.40 s not 100% ruby 1.9.1 compatible since they changed rb_intern(char *) and ID GC_VALUE::hash_id = rb_intern("hash"); does not compile any more... see: http://sourceforge.net/tracker/index.php?func=detail&aid=2859614&group_id=16 45&atid=101645 Is there any patch or workaround available yet? Best, SirAnn ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Swig-user mailing list Swig-user@... https://lists.sourceforge.net/lists/listinfo/swig-user |
| Free embeddable forum powered by Nabble | Forum Help |