From: William S F. <ws...@fu...> - 2009-11-01 20:43:20
|
David 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. > Yes that is right, SWIG will only use typedef for typemap lookups if the 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 |