Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#763 Typemaps are ignored inside %extend block

closed
5
2006-10-30
2006-10-30
Petr Novotny
No

I am extending a class. The typemaps that were
declared outside the %extend{} block are ignored; the
typemaps from within the block are used.

machine!user:~/swigbug [321]> cat bug.i
%module bug;

class B {
};

%typemap(out) int { print("Int typemap\n"); }
%extend B {
%typemap(out) long { print("long typemap\n"); }
int fn1();
long fn2();
}

machine!user:~/swigbug [322]> ../swig-
1.3.29/bin/swig -c++ -perl5 bug.i
machine!user:~/swigbug [323]> grep typemap *cxx
/* The TmpMask is for in/out typemaps that use
temporal objects */
print("long typemap\n");
machine!user:~/swigbug [324]>

The expected outcome is that the "grep" shows
both "Int typemap" and "long typemap". What happens
is that the "long typemap" (the one defined inside %
extend block) is applied but the "Int typemap" (the
one defined outside) is not.

Discussion

  • Logged In: YES
    user_id=7557

    Not a bug. %extend extends the class in the place where
    the class is defined---typemaps must be in effect before the
    class definition.

     
    • status: open --> closed