Welcome to SWIG
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
Javascript, Perl, PHP, Python, Tcl and Ruby. The list of
supported languages also includes
non-scripting languages such as C#, D, Go language,
Java including Android, Lua, OCaml, Octave, Scilab and R.
Also the Guile Scheme implementation is 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.
SWIG is free software and the code that SWIG generates is compatible with both commercial and non-commercial projects.
Recent News
- 2025/12/08 - SWIG-4.4.1 released
- Fix errors with some combinations of Py_LIMITED_API and recent Python versions.
- A couple of other minor fixes/improvements.
- 2025/10/20 - SWIG-4.4.0 released
- Python-3.14 and early Python-3.15 support including modernisations:
- Remove some DeprecationWarnings.
- Added support for free-threading Python.
- Multi-phase module initialization.
- Use heap types instead of static types.
- Go minimum version is now 1.20.
- Removed support for MzScheme/Racket.
- Minor typemap improvements.
- compactdefaultarg feature improvements and fixes.
- Fewer C, C++ and Java compiler warnings in generated code.
- c++-14 auto return type parsing fixes.
- Various improvements related to parsing expressions.
- Runtime type system thread safety fixes.
- Minor fixes and improvements specific to:
C#, D, Guile, Java, Javascript, Lua, Perl, PHP, Python, Tcl.
- 2025/04/15 - SWIG-4.3.1 released
- Small number of regression fixes for Python and Java.
- Corner case operator precedence bug fix affecting type deduction.
- Octave 10 compilation errors fix.
- 2024/10/20 - SWIG-4.3.0 released
SWIG-4.3.0 summary:
- Add experimental support for C as a target language.
- MzScheme/Racket is deprecated and planned for removal in SWIG-4.4.
- The distributed Windows binary is now a 64-bit executable.
- Add some missing use of move semantics for performance improvements.
- Enhanced handling of namespaces when using the nspace feature.
- STL wrapper enhancements for std::unique_ptr, std::string_view,
std::filesystem.
- Various enum and enum class wrapping improvements.
- Other C++ handling improvements around templates, friends, C++11
trailing return types and C++17 fold expressions.
- Many parser improvements for both C and C++, especially expressions.
- Improvements to handling of string and character literals.
- Minor preprocessor fixes.
- Python: Stricter stable ABI conformance, add support for python-3.13.
- C#: Add support for converting Doxygen comments into XML C# comments.
- Various other target language specific enhancements and updates for
Java, Javascript, Lua, MzScheme, Ocaml, Octave, Perl, Python, R, Ruby.
- 2024/02/24 - SWIG-4.2.1 released
SWIG-4.2.1 is primarily a stability and regression fix release, but also includes:
- Tcl 9.0 support.
- Octave 9.0 support.
- Improvements wrapping friend functions.
- Variadic templated functions within a template support.
- Type deduction enhancements.
- 2023/12/31 - SWIG-4.2.0 released
SWIG-4.2.0 summary:
- Various template wrapping improvements: template template parameters,
variadic templates, partially specialized templates, const template
parameters and improved error checking instantiating templates.
- Improved decltype() support for expressions.
- C++14 auto without trailing return type and C++11 auto variables.
- Numerous C++ using declarations improvements.
- Numerous fixes for constructors, destructors and assignment operators:
implicit, default and deleted and related non-assignable variable
wrappers.
- STL: std::array and std::map improvements, std::string_view support
added.
- Various C preprocessor improvements.
- Various issues fixed to do with architecture specific long type.
- Various Doxygen improvements.
- D1/Tango support removed. D2/Phobos is now the supported D version
and SWIG now generates code which works with recent D2 releases.
- New Javascript generator targeting Node.js binary stable ABI Node-API.
- Octave 8.1 support added.
- PHP7 support removed, PHP8 is now the supported PHP version.
- Python STL container wrappers now use the Python Iterator Protocol.
- Python stable ABI support added.
- Python 3.12 support added.
- Ruby 3.2 and 3.3 support.
- Scilab 2023.* support added.
- Various minor enhancements for C#, Go, Guile, Javascript, Lua, Ocaml,
Perl, PHP, R, Racket, Ruby, Scilab and Tcl.
- A number of deprecated features have been removed.
- 2022/11/30 - SWIG-4.1.1 released
SWIG-4.1.1 summary:
- Couple of stability fixes.
- Stability fix in ccache-swig when calculating hashes of inputs.
- Some template handling improvements.
- R - minor fixes plus deprecation for rtypecheck typemaps being optional.
- 2022/10/24 - SWIG-4.1.0 released
SWIG-4.1.0 summary:
- Add Javascript Node v12-v18 support, remove support prior to v6.
- Octave 6.0 to 6.4 support added.
- Add PHP 8 support.
- PHP wrapping is now done entirely via PHP's C API - no more .php wrapper.
- Perl 5.8.0 is now the oldest version SWIG supports.
- Python 3.3 is now the oldest Python 3 version SWIG supports.
- Python 3.9-3.11 support added.
- Various memory leak fixes in Python generated code.
- Scilab 5.5-6.1 support improved.
- Many improvements for each and every target language.
- Various preprocessor expression handling improvements.
- Improved C99, C++11, C++14, C++17 support. Start adding C++20 standard.
- Make SWIG much more move semantics friendly.
- Add C++ std::unique_ptr support.
- Few minor C++ template handling improvements.
- Various C++ using declaration fixes.
- Few fixes for handling Doxygen comments.
- GitHub Actions is now used instead of Travis CI for continuous integration.
- Add building SWIG using CMake as a secondary build system.
- Update optional SWIG build dependency for regex support from PCRE to PCRE2.
- 2020/06/08 - SWIG-4.0.2 released
SWIG-4.0.2 summary:
- A few fixes around doxygen comment handling.
- Ruby 2.7 support added.
- Various minor improvements to C#, D, Java, OCaml, Octave, Python, R, Ruby.
- Considerable performance improvement running SWIG on large interface files.
- 2019/08/21 - SWIG-4.0.1 released
SWIG-4.0.1 summary:
- SWIG now cleans up on error by removing all generated files.
- Add Python 3.8 support.
- Python Sphinx compatibility added for Doxygen comments.
- Some minor regressions introduced in 4.0.0 were fixed.
- Fix some C++17 compatibility problems in Python and Ruby generated code.
- Minor improvements/fixes for C#, Java, Javascript, Lua, MzScheme, Ocaml, Octave and Python.
More news
Feedback and questions regarding this website as well as patches for improvement should be raised on the SWIG www Github project.
Last modified : Mon Oct 20 19:09:59 2025
|