SWIG – anatomy of a wrapper function

This bit of documentation was in Swig 1.1 but never made it into later versions. I find it extremely helpful. Hopefully, the maintainers would re-include these in future documentation.

Wrapping C or C++ code for consumption by scripting languages takes several phases. The next few diagrams show the anatomy of a wrapper function and how typemaps get applied.

Typemaps are executed in the following order:

  1. %typemap(default)
  2. %typemap(arginit)
  3. %typemap(ignore) – deprecated, use numinputs=0
  4. %typemap(in[,numinputs=0])
  5. %typemap(check)
  6. %typemap(out)
  7. %typemap(argout)
  8. %typemap(freearg)
  9. %typemap(ret)

About this entry