Welcome to SWIG
[ Chinese ]
SWIG is a software development tool that connects programs written in
C and C++ with a variety of high-level programming
languages. SWIG is used with different types of target languages including common scripting languages such as
Perl, PHP, Python, Tcl and Ruby. The list of
supported languages also includes
non-scripting languages such as C#, Common Lisp (CLISP, Allegro CL, CFFI, UFFI), D, Go language,
Java including Android, Lua, Modula-3, OCAML, Octave and R.
Also several interpreted and compiled Scheme implementations (Guile, MzScheme/Racket, Chicken)
are supported. SWIG is most
commonly used to create high-level interpreted or compiled programming
environments, user interfaces, and as a tool for testing and prototyping C/C++ software.
SWIG is typically used to parse C/C++ interfaces and generate the 'glue code' required for the above target languages to call into the C/C++ code.
SWIG can also export its parse tree in the form of XML and Lisp s-expressions.
SWIG is free software and the code that SWIG generates is compatible with both commercial and non-commercial projects.
- 2014/02/09 - SWIG-2.0.12 released
- This is a maintenance release backporting some fixes from the pending 3.0.0 release.
- Octave 3.8 support added.
- C++11 support for new versions of erase/insert in the STL containers.
- Compilation fixes on some systems for the generated Lua, PHP, Python and R wrappers.
- 2013/09/15 - SWIG-2.0.11 released
- Minor bug fixes and enhancements mostly in Python, but also
C#, Lua, Ocaml, Octave, Perl, PHP, Python, R, Ruby, Tcl.
- 2013/05/27 - SWIG-2.0.10 released
- Ruby 1.9 support is now complete.
- Add support for Guile 2.0 and Guile 1.6 support (GH interface) has
- Various small language neutral improvements and fixes.
- Various bug fixes and minor improvements specific to C#, CFFI, D,
Java, Octave, PHP, Python,
- Minor bug fix in ccache-swig.
- Development has moved to Github with Travis continuous integration
testing - patches using https://github.com/swig/swig are welcome.
- 2013/05/03 - SWIG license explanation
We have recently updated the SWIG legal page to provide clarification on the SWIG license. There has been some confusion as to how the GPL license may or may not affect the code generated by SWIG. Please take a look at the updated SWIG legal page.
We are indebted to the Software Freedom Law Center for all the help given in providing the legal explanations and for originally helping set up the license for version 2.0.
- 2013/01/03 - SWIG on Github
With the new year we have switched SWIG development to a new development model - Git on Github. The old Subversion history (including the even older CVS history) has been migrated and is now viewable in Github - https://github.com/swig/swig. If you have used SWIG we would really appreciate improvements you have made for incorporation into the mainline SWIG releases. So, feel free to use Github to fork and send your pull requests or patches.
Improvements to the documentation are also very welcome - the html source can be found at https://github.com/swig/swig/tree/master/Doc/Manual.
Information for getting going is on the SWIG website: SWIG Bleeding Edge.
We have also turned on the new SourceForge Allura system which is much slicker than the old SourceForge for submitting bugs/patches - SWIG on SourceForge.
Happy new year!
- 2012/12/16 - SWIG-2.0.9 released
- Improved typemap matching.
- Ruby 1.9 support is much improved.
- Various bug fixes and minor improvements in C#, CFFI, Go, Java,
Modula3, Octave, Perl, Python, R, Ruby, Tcl and in ccache-swig.
- 2012/11/07 - Summer of Code 2012
GSoC 2012 was SWIG's third Summer of Code, and this year we
received five slots for projects related to SWIG. Out of five,
four students completed the program successfully with valuable
additions to SWIG.
Dmitry Kabak, mentored by Marko Klopcic, worked on SWIG
internals to parse the source code documentation comments within
the C/C++ header files and use them to document the target
language wrapper classes/functions. Dmitry's efforts
complemented the existing support added in GSoC 2008. In
summary, all previously known bugs have been fixed and the
original source code for comment translation was re-factored to
improve performance and maintainability. Parsing of C/C++ source
code has been improved, so that every declaration/definition can
now be commented. Translation of Doxygen tags to Javadoc and
Python docstrings has been improved and corresponding regression
tests have been implemented. The project mentor, Marko Klopcic
has some great ideas for the future GSoC. The work can be tried
out on the branch gsoc2012-doxygen.
Leif Middelschulte, mentored by Vadim Zeitlin, worked on the C
target language module for SWIG. Leif has improved the module
to a working level. He also rationalized and documented the use
of C typemaps and more generally improved documentation and
testing. Finally, the generated C bindings were made more
type-safe to disallow passing of objects of different types.
Unfortunately, a lot of work still remains to be done. In
particular, many problems remain with template support. Leif's
GSoC work can be accessed in the subversion branch gsoc2012-c.
Neha Narang, mentored by Oliver Buchtala, has worked on a
from Ashish Sharma (JSC) and Oliver Buchtala (V8, design for
unified module). Neha implemented basic features: global
functions and variables, classes, single inheritance, constants,
enums and exception handling. Taking her programming skills in
consideration, some tasks needed more support where Oliver
complemented her work: overloaded functions, using unified
typemap library, namespaces. She added 12 common examples and
started the test-suite writing 32 tests. Additionally, she
created detailed documentation describing design rationale and
module usage. The module is in a good shape considering it is a
new module, but some tasks are left. The next tasks will enhance
the test-suite, and add director support and bring the generator
addressing the V8 engine into a similar state. Neha's work in
Swati Sharma, mentored by Ashish Sharma, spent her summer
working on the Objective C module for SWIG. SWIG had initial
support for generating Objective C wrappers over C++ which was
added in GSoC 2009. These wrappers will be used to make C/C++
objects available to MacOS X, iphone and ipad applications. The
goal for the summer was to have a cleaner implementation and get
the code in a good shape for merging into trunk. Swati finished
close to meeting the goal with an almost completely re- written,
clean implementation fixing many rough edges. We now have a
more comprehensive set of typemaps for Objective-C and C++ type
conversions. Almost 90% of the test-suite works and a number of
new runtime tests have been added. Makefiles have been
reorganized, and the structure of the generated code redesigned
to equally support Apple's cocoa framework on MacOS X and
GNUStep on Linux/Windows. Swati is very keen to add more
features in the coming months, especially, the director support,
support for clang, and updated module documentation. Swati's
work can be accessed in the branch gsoc2012-objc.
We would like to thank Google for sponsoring the Summer of Code.
A special thanks to all the mentors for their hard work and
William Fulton, the co-administrator, for his guidance and
By: Ashish Sharma, GSoC 2012 administrator for SWIG
- 2012/08/20 - SWIG-2.0.8 released
- Fix a couple of regressions introduced in 2.0.5 and 2.0.7.
- Improved using declarations and using directives support.
- Minor fixes/enhancements for C#, Java, Octave, Perl and Python.
- 2012/05/26 - SWIG-2.0.7 released
- Important regression fixes since 2.0.5 for typemaps in general and
- Fixes and enhancements for Go, Java, Octave and PHP.
- 2012/04/30 - SWIG-2.0.6 released
This release fixes a bug in SWIG-2.0.5, please use SWIG-2.0.6 instead.
- Regression fix for Python STL wrappers on some systems.
Feedback and questions concerning this site should be posted to the swig-devel mailing list.
Last modified : Sat Mar 2 14:43:51 2013