SWIG Master Class

Introduction

This tutorial is an advanced in-depth look at SWIG, a tool for building C/C++ extensions to Python.
Rather than simply repeating the user-manual, the main focus of this course is on
the internals of what makes Swig tick and how it is put together.

Software

You will need to have Swig installed in a standard location on your
machine to proceed with the demonstrations. Note: Swig is often
preinstalled on many Linux distributions. It is also pre-installed on
OS-X Leopard. Be aware that these installations often use older
versions of Swig that may be out of date with certain details of the
presentation slides.

Samples

The following download includes a number of samples we will be using
to illustrate concepts.

The samples include both some simple C code, simple C++ code, along
with distutils setup.py files needed to get the samples to compile.
The samples should work on all Unix-based systems (Linux, BSD, OS-X).
The samples may work on Windows provided that you have configured
your machine to properly build extension modules (which is nontrivial).

The following code samples are provided:

SwigMaster/csample. A C extension module.

SwigMaster/cppsample. A C++ extension module.

Much of the tutorial will be based on taking these basic examples
and expanding them with various features.