A typemap is a code generation rule that is attached to a specific C datatype.
We can e.g. convert integers from Python to C defining the following typemap:
(see: typemap_simple1)
%module example %typemap(in) long { $1 = (long) PyLong_AsLong($input); printf("Received an integer : %ld\n",$1); }
%inline %{ long fact(long n) { if (n <= 1) { return 1; } return n * fact(n – 1); } %}