|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
Problem with recognising a typemap defined in terms of a typedefThe following .i file fails to use the typemap for MatrixF:
$ swig -o goo.cc -c++ -python -module goo goo.i && grep TYPEMAP goo.cc $ swig -version SWIG Version 1.3.40 If I declare the typemap in terms of the "raw" type all is well (i.e. %typemap(in) Matrix * () { /* TYPEMAP Matrix */ } ) I realise that you can define different typemaps for e.g. Matrix and MatrixF, but my reading of the manual implies that both should be tried in order; here no typemap is applied at all. The code won't compile, by the way, as I removed the %inlines for clarity. R class Matrix {}; typedef Matrix MatrixF; %typemap(in) MatrixF * () { /* TYPEMAP MatrixF */ } void goo(Matrix *mat) { } ------------------------------------------------------------------------------ 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 recognising a typemap defined in terms of a typedef> If I declare the typemap in terms of the "raw" type all is well (i.e.
> %typemap(in) Matrix * () { /* TYPEMAP Matrix */ } > ) > > I realise that you can define different typemaps for e.g. Matrix and > MatrixF, but my reading of the manual implies that both should be > tried in order; here no typemap is applied at all. The code won't > compile, by the way, as I removed the %inlines for clarity. > > R > > class Matrix {}; > typedef Matrix MatrixF; > > %typemap(in) MatrixF * () { /* TYPEMAP MatrixF */ } > > void goo(Matrix *mat) { } It's my understanding that the typemap for MatrixF* will only be used if your function declaration has a parameter of type MatrixF*. On the other hand, if the function declaration uses MatrixF*, then SWIG will use the MatrixF* typemap if it exists, otherwise it will use the Matrix* typemap if it exists. ------------------------------------------------------------------------------ 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 recognising a typemap defined in terms of a typedefDavid Piepgrass wrote:
>> If I declare the typemap in terms of the "raw" type all is well (i.e. >> %typemap(in) Matrix * () { /* TYPEMAP Matrix */ } >> ) >> >> I realise that you can define different typemaps for e.g. Matrix and >> MatrixF, but my reading of the manual implies that both should be >> tried in order; here no typemap is applied at all. The code won't >> compile, by the way, as I removed the %inlines for clarity. >> >> R >> >> class Matrix {}; >> typedef Matrix MatrixF; >> >> %typemap(in) MatrixF * () { /* TYPEMAP MatrixF */ } >> >> void goo(Matrix *mat) { } > > It's my understanding that the typemap for MatrixF* will only be used if your function declaration has a parameter of type MatrixF*. On the other hand, if the function declaration uses MatrixF*, then SWIG will use the MatrixF* typemap if it exists, otherwise it will use the Matrix* typemap if it exists. > type is a typedef already, that is SWIG won't try every single typedef to Matrix that it can find if it parses Matrix *. William ------------------------------------------------------------------------------ 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 recognising a typemap defined in terms of a typedefI figured out that the typemap defined for a typedef wasn't being
applied to a declaration in terms of the underlying type but wasn't sure whether this was a bug or a feature. William says that it's a feature, so the docs could be clearer. For example, > Therefore, typemaps are unaffected by typedef, namespaces, and other > declarations that might hide the underlying type This is true, but the opposite is not true --- underlying types are unaware of typedefs, and I think it'd be wise to add a note to the manual. 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 recognising a typemap defined in terms of a typedefRobert Lupton the Good wrote:
> I figured out that the typemap defined for a typedef wasn't being > applied to a declaration in terms of the underlying type but wasn't sure > whether this was a bug or a feature. > > William says that it's a feature, so the docs could be clearer. For > example, >> Therefore, typemaps are unaffected by typedef, namespaces, and other >> declarations that might hide the underlying type > > This is true, but the opposite is not true --- underlying types are > unaware of typedefs, and I think it'd be wise to add a note to the manual. > version viewable online at: http://swig.svn.sourceforge.net/viewvc/swig/trunk/Doc/Manual/Typemaps.html#Typemaps_nn18 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 |
| Free embeddable forum powered by Nabble | Forum Help |