SWIG is a programmer's tool designed to make it easier to use C and C++ code from other popular programming languages such as Python, Perl, Ruby, PHP, Java, and C#. 2009 was SWIG's second Summer of Code, and this year we mentored five projects related to SWIG. All five students were very active over the summer period and produced some great new features. In no particular order:
Matevz Jekovec has been busy working at the coal face of SWIG to add support for C++0x, the forthcoming C++ standard. Matevz has managed to achieve close to full support for C++0x. The C++0x Wikipaedia article http://en.wikipedia.org/wiki/C%2B%2B0x details the numerous planned new C++0x features and Matevž has put together a SWIG C++0x page (http://swig.svn.sourceforge.net/viewvc/swig/branches/gsoc2009-matevz/Doc/Manual/Cpp0x.html) documenting the new SWIG support for each of these. In summary the enhanced C++ language can now be parsed by SWIG, which in itself is a great step. There is much more than just this though, as most of the information parsed is used to create useful wrappers of C++0x code. The work can be tried out on the C++0x branch http://swig.svn.sourceforge.net/viewvc/swig/branches/gsoc2009-matevz which should be merged fairly soon into a forthcoming release.
Miklos Vajna has been working on SWIG's PHP support to implement an advanced SWIG feature already supported for most other target languages, but not PHP. The feature is called "directors" and allows cross-language polymorphism - wrapped C++ classes can be subclassed in PHP and virtual method calls work in the natural way, whether they're made from PHP or C++ code. You can read more in the new PHP Director documentation http://www.swig.org/Doc1.3/Php.html#Php_nn3 . Miklos made such great progress that we were able to merge this support into SWIG 1.3.40, which was released even before the Summer of Code finished. Miklos also spent some time working on improving SWIG's testsuite for PHP, and fixing bugs in the PHP support.
Ashish Sharma spent the summer adding support for Objective-C as a new target language. Objective-C is a major language on the Mac OS X platform. This means that now SWIG can be used to generate Objective-C wrappers over C++ code. In particular the wrappers include proxy classes, which preserve the class hierarchy from the C++ code. Ultimately this means that from the user's perspective, proxy objects look no different to objects originally written in Objective-C. Adding a new target language is quite a considerable task and Ashish is keen to add plenty more improvements over the coming months. Ashish's work is in Subversion and can be accessed in the ashishs99 branch http://swig.svn.sourceforge.net/viewvc/swig/branches/gsoc2009-ashishs99 .
Baozeng Ding has also added a new target language, in this case for the Scilab language, a free numerical computing package. He has coded up support for all the C features: variables, functions, constants, enums, structs, unions, pointers and arrays and also intends to develop it further in the near future. Documentation for SWIG and Scilab can be viewed online direct from Baozeng's Subversion branch http://swig.svn.sourceforge.net/viewvc/swig/branches/gsoc2009-sploving/Doc/Manual/Scilab.html .
Kosei Moriyama has been working on Perl bindings for the Xapian library using SWIG, to replace some existing bindings implemented by hand. He's achieved almost complete compatibility with the API of the existing bindings (the only real omission is callbacks which are waiting for completion of director support for Perl in SWIG). He has also wrapped features which weren't previously accessible from Perl. You can view Kosei's work online in his Subversion branch http://trac.xapian.org/browser/branches/gsoc2009-kosei .
Finally, many thanks to Google for sponsoring the summer of code and a special thanks for all the hard work done by the students, mentors and Olly Betts, the co-administrator.