Title C target language backend
Student Maciej Drwal
Mentor William S Fulton
Abstract
The aim of the project is to create SWIG module to support ANSI C as a target language. The main motivation for extending SWIG with this feature is to give the developers ability to easily interface C++ libraries from the C code. In addition, the C backend will be useful tool to customize C APIs in automated way, utilizing advanced SWIG features.

Since the layered approach for generating wrappers in SWIG is based on "flattening" classes to collections of C-style functions (in order to perform type conversions, error handling, etc.), and then constructing target language wrappers, many aspects of C wrappers can be introduced fairly straightforward. The main objective of design process is to provide convenient interface to intermediary C functions without high-level abstraction provided by most other language backends. For instance, the constructors, destructors and all class' methods will be called as global functions with pointer to structural object representation as the first argument. The wrappers will also provide different functions for overloaded methods, operators and methods with default argument values. It will be also possible to make the code more robust with additional error checks.

The nature of C module will differ from most other modules, since the C language doesn't provide substitutes for similiar concepts, shared by most high-level programming languages, like inheritance or exception handling, and it doesn't involve any runtime system.

SWIG will become much more versatile tool with C target language module. It will be very useful for projects which make use of both C and C++ languages.