SWIG (Simplified Wrapper and Interface Generator)
Tagline: SWIG is a compiler that integrates C and C++ with languages
including Perl, Python, Tcl, Ruby, PHP, Java, C#, D, Go, Lua,
Octave, R, Scheme (Guile, MzScheme/Racket), Scilab, Ocaml.
SWIG can also export its parse tree into XML.
SWIG reads annotated C/C++ header files and creates wrapper code (glue
code) in order to make the corresponding C/C++ libraries available to
the listed languages, or to extend C/C++ programs with a scripting
language.
Up-to-date SWIG related information can be found at
https://www.swig.org
A SWIG FAQ and other hints can be found on the SWIG Wiki:
https://github.com/swig/swig/wiki
License
=======
Please see the LICENSE file for details of the SWIG license. For
further insight into the license including the license of SWIG's
output code, please visit
https://www.swig.org/legal.html
Release Notes
=============
Please see the CHANGES.current file for a detailed list of bug fixes and
new features for the current release. The CHANGES file contains bug fixes
and new features for older versions. A summary of changes in each release
can be found in the RELEASENOTES file.
Documentation
=============
The Doc/Manual directory contains the most recent set of updated
documentation for this release. The documentation is available in
three different formats, each of which contains identical content.
These format are, pdf (Doc/Manual/SWIGDocumentation.pdf), single
page html (Doc/Manual/SWIGDocumentation.html) or multiple page html
(other files in Doc/Manual). Please select your chosen format and
copy/install to wherever takes your fancy.
There is some technical developer documentation available in the
Doc/Devel subdirectory. This is not necessarily up-to-date, but it
has some information on SWIG internals.
Documentation is also online at
https://www.swig.org/doc.html.
Backwards Compatibility
=======================
The developers strive their best to preserve backwards compatibility
between releases, but this is not always possible as the overriding
aim is to provide the best wrapping experience. Where backwards
compatibility is known to be broken, it is clearly marked as an
incompatibility in the CHANGES and CHANGES.current files.
See the documentation for details of the SWIG_VERSION preprocessor
symbol if you have backward compatibility issues and need to use more
than one version of SWIG.
Installation
============
Please read the Doc/Manual/Preface.html#Preface_installation for
full installation instructions for Windows, Unix and Mac OS X
using the release tarball/zip file. The INSTALL file has generic
build and installation instructions for Unix users.
Users wishing to build and install code from Github should
visit
https://swig.org/svn.html to obtain the more detailed
instructions required for building code obtained from Github - extra
steps are required compared to building from the release tarball.
Testing
=======
The typical 'make -k check' can be performed on Unix operating systems.
Please read Doc/Manual/Preface.html#Preface_testing for details.
Examples
========
The Examples directory contains a variety of examples of using SWIG
and it has some browsable documentation. Simply point your browser to
the file "Example/index.html".
The Examples directory also includes Visual C++ project 6 (.dsp) files for
building some of the examples on Windows. Later versions of Visual Studio
will convert these old style project files into a current solution file.
Known Issues
============
There are minor known bugs, details of which are in the bug tracker, see
https://www.swig.org/bugs.html.
Troubleshooting
===============
In order to operate correctly, SWIG relies upon a set of library
files. If after building SWIG, you get error messages like this,
$ swig foo.i
:1. Unable to find 'swig.swg'
:3. Unable to find 'tcl8.swg'
it means that SWIG has either been incorrectly configured or
installed. To fix this:
1. Make sure you remembered to do a 'make install' and that
the installation actually worked. Make sure you have
write permission on the install directory.
2. If that doesn't work, type 'swig -swiglib' to find out
where SWIG thinks its library is located.
3. If the location is not where you expect, perhaps
you supplied a bad option to configure. Use
./configure --prefix=pathname to set the SWIG install
location. Also, make sure you don't include a shell
escape character such as ~ when you specify the path.
4. The SWIG library can be changed by setting the SWIG_LIB
environment variable. However, you really shouldn't
have to do this.
If you are having other troubles, you might look at the SWIG Wiki at
https://github.com/swig/swig/wiki.
Participate!
============
Please report any errors and submit patches (if possible)! We only
have access to a limited variety of hardware (Linux, Solaris, OS-X,
and Windows). All contributions help.
If you would like to join the SWIG development team or contribute a
language module to the distribution, please contact the swig-devel
mailing list, details at
https://www.swig.org/mail.html.
-- The SWIG Maintainers
Below are the changes for the current release.
See the CHANGES file for changes in older releases.
See the RELEASENOTES file for a summary of changes in each release.
Issue # numbers mentioned below can be found on Github. For more details, add
the issue number to the end of the URL:
https://github.com/swig/swig/issues/
Version 4.3.0 (20 Oct 2024)
===========================
2024-10-20: wsfulton
#3051 Fix seg fault passing invalid unicode values when expecting a
std::string type - fix for python-3.13.
2024-10-19: olly
[ruby] Documentation comments now use `true` and `false` for bool
parameter default values, instead of `True` and `False` (which are
the Python names and wrong for Ruby!)
2024-10-16: wsfulton
#874 Add nested classes to the parse tree dumped out by -xml.
2024-10-16: wsfulton
#2213 Documentation for the XML output options of SWIG's parse tree has
been added to the Extending chapter.
2024-10-09: wsfulton
Remove -xmllang option used with -xml, which had no effect on the output.
2024-10-06: wsfulton
[PHP] #2907 Fix returning NULL from functions with output
parameters.
Ensures OUTPUT and INOUT typemaps are handled consistently wrt
return type.
Added:
void SWIG_Php_AppendOutput(zval *target, zval *o, int is_void);
The t_output_helper function is deprecated. Replace t_output_helper
in typemaps with SWIG_AppendOutput which calls SWIG_Php_AppendOutput
appropriately setting the is_void parameter using the $isvoid special
variable. If t_output_helper is currently being used and a completely
backwards compatible (but technically incorrect) solution is required,
then use SWIG_Php_AppendOutput and pass 1 instead of $isvoid for the
is_void parameter.
The t_output_helper fragment is also deprecated and is no longer
needed as the SWIG_Php_AppendOutput function is now always
generated.
2024-10-05: wsfulton
[Ruby] Removed backwards compatible output_helper fragment and
macro.
Use SWIG_AppendOutput instead of output_helper (does not require
the output_helper fragment).
*** POTENTIAL INCOMPATIBILITY ***
2024-10-05: wsfulton
[Ruby] #2907 Fix returning NULL from functions with output
parameters.
Ensures OUTPUT and INOUT typemaps are handled consistently wrt
return type.
New declaration of SWIG_Ruby_AppendOutput is now:
SWIG_Ruby_AppendOutput(VALUE target, VALUE o, int is_void);
The 3rd parameter is new and the new $isvoid special variable
should be passed to it, indicating whether or not the wrapped
function returns void. If SWIG_Python_AppendOutput is currently being
used and a completely backwards compatible (but technically incorrect)
solution is required, then pass 1 for the is_void parameter.
Also consider replacing with:
SWIG_AppendOutput(VALUE target, VALUE o);
which calls SWIG_Ruby_AppendOutput with same parameters but adding
$isvoid for final parameter.
*** POTENTIAL INCOMPATIBILITY ***
2024-09-29: clintonstimpson
[Python] #2350 Switch implementation from static types to heap
types using PyType_FromSpec() introduced in Python 3.
This currently only applies to the default code generation and is
not available for the -builtin code generation.
2024-09-29: wsfulton
[Python] Single line docstring comments are stripped of leading and
trailing whitespace.
2024-09-29: olly
SWIG can now handle arbitrary expressions as a subscript (i.e. in
`[`...`]`). We don't actually need to parse expressions in this
context so we can just skip to the matching closing square bracket.
2024-09-29: olly
C++11 auto variables for which SWIG can't parse the initialiser
now give a warning and are ignored rather than SWIG exiting with a
parse error.
2024-09-26: olly
SWIG now recognises --version as an alias for -version (it has
supported --help as an alias for -help since 2006).
2024-09-25: wsfulton
[MzScheme/Racket] #920 #2830 MzScheme/Racket Deprecation notice.
This language module no longer works with modern Racket versions
(Racket 8 and later) due to the introduction of a different C API.
We are thus putting out a plea for a Racket maintainer to step
forward and rewrite the MzScheme module for Racket 8, otherwise it
will be removed in swig-4.4.
2024-09-25: olly
SWIG can now handle arbitrary expressions in the parameter list of
a method call. We don't actually need to parse expressions in this
context so we can just skip to the matching closing parenthesis.
2024-09-25: olly
Add support for C99 _Bool. SWIG now treats _Bool as an alias for
the bool keyword when in C mode.
2024-09-23: olly
#3031 Improve support for C++11 trailing return types. SWIG now
supports const references, const and non-const rvalue references,
and enum types with an explicit `enum`, `enum class` or `enum
struct`.
2024-09-22: wsfulton
#3023 The binary executables in the Windows distribution are now
64-bit now instead of 32-bit. Any 32-bit Windows OS users will need
to build their own version using instructions in Windows.html or
the "Getting Started Guide" for Windows on the Wiki at
https://github.com/swig/swig/wiki/Getting-Started#windows.
2024-09-21: wsfulton
#2879 Don't show warning SWIGWARN_LANG_SMARTPTR_MISSING (520) if
class is ignored.
2024-09-21: olly
SWIG was ignoring `final` if specified after `noexcept`.
2024-09-20: olly
[Javascript] Fix problems with v8 support. The tests and examples
now work, and configure can now successfully probe for v8 without
assistance on Debian and Ubuntu.
2024-09-19: wsfulton
#2866 Fix incorrect variable setters being generated when wrapping
reference member variables. A setter is no longer generated if the
type of the reference member variable is non-assignable.
2024-09-18: olly
Fix parse error for a misplaced Doxygen comment which is the only
thing in a class/struct.
2024-09-18: olly
Fix parse error for %include/#include in a class/struct followed
by a member declaration.
2024-09-16: olly
#2995 SWIG now has generic handling for converting integer and
boolean literal values for use in target language code, replacing
code to do with in many of the target language backends. This is
mainly an internal clean-up but it does fix a bug in the code it
replaces when wrapping code such as this:
typedef enum { T = (bool)1 } b;
With suitable enum wrapping settings, SWIG could incorrect wrap T
with value 0 in C#, D and Java.
Such cases now work correctly for D, but for C# and Java SWIG now
generates invalid C#/Java code because the C++ enum initialiser
expression isn't valid for initialising a C#/Java enum - this is
really an improvement over generating code which compiled but used
the wrong value!
If you are affected by this, use %csconstvalue/%javaconstvalue to
specify the value of such enumerators as a suitable C#/Java
expression.
2024-09-16: olly
#2560 Document complex.i in the manual.
2024-09-15: FredBonThermo
[C#] #2835 Support -doxygen option for converting doxygen comments
to XML formatted C# comments.
2024-09-14: wsfulton
#2987 C++ reference errors when passing in a 'NULL' change of
behaviour. Most languages now use "NullReferenceError" in the
error message where they previously used "ValueError". Also
exception changes:
Guile: "swig-null-reference-error" instead of "swig-value-error"
MzScheme: "swig-null-reference-error" instead of "swig-value-error"
PHP: TypeError instead of ValueError
Python: Consistently raises TypeError instead of a mix of
ValueError and TypeError.
Ruby: Consistently raises NullReferenceError instead of a mix
of ArgumentError and NullReferenceErrorError.
The consistent raising of a TypeError instead of ValueError for
Python ensures that incorrectly passing 'None' into a C++ reference
argument will correctly convert the error into a NotImplemented
error for the rich comparisons implementations per PEP 207.
*** POTENTIAL INCOMPATIBILITY ***
2024-09-13: vadz
[C] #2086 Add support for C as a target language. This support is
currently experimental.
2024-09-12: olly
Remove remains of %nestedworkaround and the nestedworkaround
feature it uses, which were deprecated over 10 years ago in SWIG
3.0.0. Since then uses of these have done nothing except emit a
warning.
2024-09-11: wsfulton
[C# Java] #1188 Add the %interface_additional macro to the family
of %interface macros for adding additional interfaces for the
%generated interface to extend/derive from.
2024-09-11: olly
#197 #675 #1677 #2047 Fix incorrect inclusion of "enum " when
qualifying C++11 "enum class" enumerator names.
2024-09-11: olly
[Perl] #630 Fix wrapping of C++11 enum class when -const command
line option is specified.
2024-09-07: wsfulton
#2875 Fix swig-4.1.0 regression using the %interface family of
macros for multiple inheritance and common bases.
2024-09-06: olly
[Python] Stop documenting to define SWIG_FILE_WITH_INIT - this does
not actually do anything (and apparently never has!)
2024-09-05: wsfulton
#2845 Fix duplicate friend wrappers for friend declarations in
nested classes.
2024-09-03: olly
#3010 Improve handling of zero bytes in input files. This is
certainly a corner case, but GCC and clang both accept zero bytes
at least in comments, and SWIG's current handling is to ignore
the zero byte and all following characters up to and including the
next newline, so for example if a // comment contains a zero byte
SWIG would quietly ignore the next line.
2024-08-30: olly
#2996 Fix generic string literal handling to handle embedded zero
bytes. This allows such strings to work for C# (with %csconst), D
(with %dmanifestconst), Go and Java (with %javaconst). For other
target languages SWIG-generated wrappers still truncate such string
literals at a zero byte (which is probably the best we can do for
target languages where the native string can't contain zero bytes).
2024-08-23: wsfulton
[Java] #2991 Document solutions for mismatch in C++ access
specifiers and Java access modifiers in an inheritance hierarchy.
2024-08-19: wsfulton
[Python] #2993 Add missing std::filesystem namespace to
std_filesystem.i.
2024-08-17: olly
#904 #1907 #2579 Fix string literal and character literal wrapping
bugs.
2024-08-15: olly
Fix parsing of octal string escapes. We now stop when the next
character is digit 8 or 9, and stop after 3 octal digits even if
the next character is an octal digit.
2024-08-15: olly
SWIG now gives an error for digits 8 and 9 in octal constants -
previously these were quietly accepted resulting in a bogus value.
C++11 binary constants are now treated similarly - only digits 0
and 1 were allowed before, but trying to use other digits now gives
a clearer error.
2024-08-12: olly
#657 Allow unmatched ' and " in #error and #warning.
2024-08-09: wsfulton
[Java] #409 Add the constantsmodifiers pragma so that the
visibility for the Java constants interface can be changed from
public to default.
2024-08-02: vadz
[Python] #2966 Fix overloaded Doxygen comments. Sometimes the
Doxygen comments were not combined into one Pydoc comment.
2024-08-01: olly
Fix wrapping of string constants containing bytes 0-8, 11, 12 or
14-31 followed by a digit '0' to '7'. We were emitting these bytes
as a one or two character octal escape sequence which when
interpreted would include the following character.
2024-07-27: olly
#2087 Fix parsing of `noexcept` on a function pointer type used
as the type of a function parameter. We currently generate
invalid C++ code if we try to wrap the function parameter, but
at least the user can `%ignore` the parameter or the whole
function, whereas the parse error was hard to work around.
2024-07-26: olly
Support parsing `noexcept(X)` in expressions, including deducing
its type (which is always `bool`).
2024-07-21: wsfulton
[Python] Add missing slot for init in struct _specialization_cache
needed for python-3.13 builtin wrappers.
2024-07-21: shadchin
[Python] #2968 Add missing tp_versions_used slot needed for
python-3.13.
2024-07-19: olly
-Wallkw now includes keywords for Javascript.
2024-07-19: vadz
[Javascript] #2940 Names of object properties can be keywords in
Javascript so don't auto-rename them to have a leading underscore.
2024-07-18: olly
#1917 Stop removing `f` and `F` suffixes from float literals.
This was resulting in incorrect generated C# and Java code. For
some cases such as `#define CONSTANT 1.0f` this was a regression
introduced in 4.2.0 when we started more correctly wrapping these
as `float` rather than `double`.
2024-07-15: vadz
#2941 Suppress warning WARN_PARSE_USING_UNDEF for ignored using
declarations.
2024-07-03: wsfulton
#2860 Enhance Windows.html documentation for the popular Visual C++
compiler recommending users to correctly set the __cplusplus macro
in order to benefit from modern standards based features that SWIG
provides.
2024-07-02: erezgeva
[Python, Ruby] #2870 Change the thread safety options for the
director code that manages C++ director pointer ownership. Please
define SWIG_THREADS to turn on thread safety. For Python, this can
also be done via the threads module option or -threads.
Implementation now includes a C++11 std::mutex option as priority
over WIN32 and pthread mutexes. See director_guard.swg for further
implementation details.
2024-06-28: vadz
#2935 Fix instantiation of specialized template where the primary
template is a forward class template declaration.
2024-06-16: wsfulton
#2927 Don't ignore overloaded friend functions that are also
declared constexpr.
2024-06-15: wsfulton
[Python] Removed deprecated pytuplehlp.swg file and t_output_helper.
Use SWIG_AppendOutput as a direct replacement for t_output_helper.
*** POTENTIAL INCOMPATIBILITY ***
2024-06-15: vadz
[Python] #2907 Fix returning null from functions with output
parameters. Ensures OUTPUT and INOUT typemaps are handled
consistently wrt return type.
New declaration of SWIG_Python_AppendOutput is now:
SWIG_Python_AppendOutput(PyObject* result, PyObject* obj, int is_void);
The 3rd parameter is new and the new $isvoid special variable
should be passed to it, indicating whether or not the wrapped
function returns void. If SWIG_Python_AppendOutput is currently being
used and a completely backwards compatible (but technically incorrect)
solution is required, then pass 1 for the is_void parameter.
Also consider replacing with:
SWIG_AppendOutput(PyObject* result, PyObject* obj);
which calls SWIG_Python_AppendOutput with same parameters but adding $isvoid
for final parameter.
*** POTENTIAL INCOMPATIBILITY ***
2024-06-15: wsfulton
#2907 Add $isvoid special variable which expands to 1 if the
wrapped function has a void return, otherwise expands to 0.
2024-06-14: jschueller
#2863 Support Python 3.13 (currently in prerelease).
2024-06-13: erezgeva
#2609 Fix Java typemap (const char *STRING, size_t LENGTH) to
marshall as Java String instead of Java byte[]. If the old
behaviour is required, replace with typemap (const void *BYTES,
size_t LENGTH).
Add multi-argument typemaps to most languages:
(const char *STRING, size_t LENGTH)
All languages now use a target language string type for this
typemap.
New multi-argument typemaps have been added to most target
languages for use with C raw data (cdata):
(const void *BYTES, size_t LENGTH) to
Statically typed languages use a byte array for this typemap, while
scripting languages remain using a string.
*** POTENTIAL INCOMPATIBILITY ***
* Raw C data: Go uses byte array and int64 for size.
Users can use the (const char *STRING, size_t LENGTH) typemaps for
strings.
2024-06-06: olly
Support alignof(T) for arbitrary type T, and deduce the type of
alignof(T) as size_t.
2024-06-06: olly
#2919 Support parsing `sizeof(X)` for any expression or type X by
skipping balanced parentheses. We don't need to actually parse X
since the type of sizeof is always size_t.
2024-06-05: leakec
#2873 Fix -fvirtual and using declarations for inheriting base
class methods corner case.
2024-05-31: wsfulton
[C#, D, Java, Javascript, Lua] Fix %nspace and %nspacemove for
nested classes and enums in a class. For example:
%nspace Space::OuterClass80;
namespace Space {
struct OuterClass80 {
struct InnerClass80 {
struct BottomClass80 {};
};
enum InnerEnum80 { ie80a, ie80b };
};
}
Previously the following were additionally required for some
languages:
%nspace Space::OuterClass80::InnerClass80;
%nspace Space::OuterClass80::InnerClass80::Bottom80;
Now the appropriate nspace setting is taken from the outer class.
A new warning has also been introduced to check and correct
conflicting nspace usage, for example if the following is
additionally added:
%nspacemove(AnotherSpace) Space::OuterClass80::InnerClass80;
The following warning appears as an inner class can't be moved
outside of the outer class:
Warning 406: Ignoring nspace setting (AnotherSpace) for 'Space::OuterClass80::InnerClass80',
Warning 406: as it conflicts with the nspace setting (Space) for outer class 'Space::OuterClass80'.
2024-05-31: wsfulton
[C#, D, Java, Javascript, Lua] #2782 Enhance the nspace feature
with %nspacemove for moving a class or enum into a differently
named %target language equivalent of a namespace.
2024-05-31: binaire10
[Ruby] #2906 Fix SWIG wrappers for std::map and std::vector to
work with Ruby's "select".
2024-05-30: olly
#2914 Handle alternative operator names in C++ preprocessor
expressions. Handle full set of alternative operator names in
C++ expressions (previously only "and", "or" and "not" were
understood).
2024-05-15: olly
#2868 Support C++17 fold expressions.
2024-05-15: olly
#2876 Report error if parser stack depth exceeded. Previously SWIG
would quietly exit with status 0 in this situation.
2024-04-12: pfusik
[Javascript] #2869 Fix JavaScript _wrap_getCPtr on 64-bit Windows
2024-04-12: wsfulton
[Javascript, MzScheme, Python, Ruby] #202 Remove the vast majority
of the /*@SWIG:...*/ locator strings in the generated wrappers for
these 4 languages to help with reproducible builds.
2024-04-08: thewtex
[Python] #2856 Include stdlib.h for more recent Python Stable ABI
2024-03-28: olly
Fix preprocessor to handle C-style comment ending **/ in macro
argument.
2024-03-27: wsfulton
[Python] #2844 Fix for using more than one std::string_view type in
a method.
2024-03-27: wsfulton
[R] #2847 Add missing std::vector<long> and std::vector<long long>
typemaps which were missing depending on whether or not
SWIGWORDSIZE64 was defined.
2024-03-25: wsfulton
[Python] #2826 Stricter stable ABI conformance.
1. Use Py_DecRef and Py_IncRef when Py_LIMITED_API is defined
instead of macro equivalents, such as Py_INCREF.
2. Don't use PyUnicode_GetLength from python-3.7 and later.
3. Use PyObject_Free instead of deprecated equivalents.
2024-03-25: olly
#2848 Fix elision of comma before ##__VA_ARGS__ which we document
as supported but seems to have not worked since before 2009.
2024-03-11: wsfulton
[C#] #2829 Improve handling and documentation of missing enum base
type information.
2024-03-07: wsfulton
[Ocaml] Fix SWIGTYPE MOVE 'in' typemap to fix compilation error.
2024-03-07: wsfulton
Add SWIGTYPE MOVE 'typecheck' typemaps to remove warning 472
(SWIGWARN_TYPEMAP_TYPECHECK_UNDEF).
2024-03-06: wsfulton
Add support for std::unique_ptr & typemaps. Non-const inputs
implement move semantics from proxy class to C++ layer, otherwise
const inputs and all reference returns behave like any other lvalue
reference to a class.
2024-03-06: wsfulton
[Javascript, MzScheme, Octave] Support NULL being passed into char*
typemaps.
2024-03-06: christophe-calmejane,wsfulton
#2650 Add support for movable std::unique_ptr by adding in
std::unique_ptr && input typemaps. The std::unique && output
typemaps do not support move semantics by default and behave like
lvalue references.
2024-03-06: wsfulton
Add missing use of move constructor instead of copy constructor
when passing movable types by value. This was previously
implemented only for parameters passed to a global function or
static member function and is now extended to parameters passed to
member methods as well as constructors.
2024-03-01: olly
[Java] #2819 Suppress Java removal warnings for uses of
System.runFinalization(). SWIG will need to stop relying on
finalize methods, but we know that and meanwhile these warnings
make the testsuite output noisy. Fix use of deprecated form
of Runtime.exec() in the doxygen example.
2024-02-28: wsfulton
#1754 Fix compilation errors in generated code when instantiating a
templated static method within a template (non-static methods and
constructors were always okay). For example:
template <typename T> class X {
template <class InputIterator>
static void fn(InputIterator first, InputIterator last) {
...
}
};
class SimpleIterator { ... };
%extend X<int> {
%template(fn) fn<SimpleIterator>;
}
This file contains a brief overview of the changes made in each release.
A detailed description of changes are available in the CHANGES.current
and CHANGES files.
Release Notes
=============
Detailed release notes are available with the release and are also
published on the SWIG web site at
https://swig.org/release.html.
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.
SWIG-4.2.1 summary:
- Tcl 9.0 support.
- Octave 9.0 support.
- Improvements wrapping friend functions.
- Variadic templated functions within a template support.
- Type deduction enhancements.
- Stability and regression fixes.
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.
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.
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.
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.
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.
SWIG-4.0.0 summary:
- Support for Doxygen documentation comments which are parsed and
converted into JavaDoc or PyDoc comments.
- STL wrappers improved for C#, Java and Ruby.
- C++11 STL containers added for Java, Python and Ruby.
- Improved support for parsing C++11 and C++14 code.
- Various fixes for shared_ptr.
- Various C preprocessor corner case fixes.
- Corner case fixes for member function pointers.
- Python module overhaul by simplifying the generated code and turning
most optimizations on by default.
- %template improvements wrt scoping to align with C++ explicit
template instantiations.
- Added support for a command-line options file (sometimes called a
response file).
- Numerous enhancements and fixes for all supported target languages.
- SWIG now classifies the status of target languages into either
'Experimental' or 'Supported' to indicate the expected maturity
level.
- Support for CFFI, Allegrocl, Chicken, CLISP, S-EXP, UFFI, Pike,
Modula3 has been removed.
- Octave 4.4-5.1 support added.
- PHP5 support removed, PHP7 is now the supported PHP version.
- Minimum Python version required is now 2.7, 3.2-3.7 are the only
other versions supported.
- Added support for Javascript NodeJS versions 2-10.
- OCaml support is much improved and updated, minimum OCaml version
required is now 3.12.0.
SWIG-3.0.12 summary:
- Add support for Octave-4.2.
- Enhance %extend to support template functions.
- Language specific enhancements and fixes for C#, D, Guile, Java, PHP7.
SWIG-3.0.11 summary:
- PHP 7 support added.
- C++11 alias templates and type aliasing support added.
- Minor fixes and enhancements for C# Go Guile Java Javascript Octave
PHP Python R Ruby Scilab XML.
SWIG-3.0.10 summary:
- Regression fixes for smart pointers and importing Python modules.
SWIG-3.0.9 summary:
- Add support for Python's implicit namespace packages.
- Fixes to support Go 1.6.
- C++11 std::array support added for Java.
- Improved C++ multiple inheritance support for Java/C# wrappers.
- Various other minor fixes and improvements for C#, D, Go, Java,
Javascript, Lua, Python, R, Ruby, Scilab.
SWIG-3.0.8 summary:
- pdf documentation enhancements.
- Various Python 3.5 issues fixed.
- std::array support added for Ruby and Python.
- shared_ptr support added for Ruby.
- Minor improvements for CFFI, Go, Java, Perl, Python, Ruby.
SWIG-3.0.7 summary:
- Add support for Octave-4.0.0.
- Remove potential Android security exploit in generated Java classes.
- Minor new features and bug fixes.
SWIG-3.0.6 summary:
- Stability and regression fixes.
- Fixed parsing of C++ corner cases.
- Language improvements and bug fixes for C#, Go, Java, Lua, Python, R.
SWIG-3.0.5 summary:
- Added support for Scilab.
- Important Python regression fix when wrapping C++ default arguments.
- Minor improvements for C#, Go, Octave, PHP and Python.
SWIG-3.0.4 summary:
- Python regression fix when wrapping C++ default arguments.
- Improved error messages.
SWIG-3.0.3 summary:
- Add support for C++11 strongly typed enumerations.
- Numerous bug fixes and minor enhancements for C#, D, Go, Java,
Javascript, PHP, Perl and Python wrappers.
SWIG-3.0.2 summary:
- Bug fix during install and a couple of other minor changes.
SWIG-3.0.1 summary:
- Javascript module added. This supports JavascriptCore (Safari/Webkit),
v8 (Chromium) and node.js currently.
- A few notable regressions introduced in 3.0.0 have been fixed - in
Lua, nested classes and parsing of operator <<.
- The usual round of bug fixes and minor improvements for:
C#, GCJ, Go, Java, Lua, PHP and Python.
SWIG-3.0.0 summary:
- This is a major new release focusing primarily on C++ improvements.
- C++11 support added. Please see documentation for details of supported
features:
https://www.swig.org/Doc3.0/CPlusPlus11.html
- Nested class support added. This has been taken full advantage of in
Java and C#. Other languages can use the nested classes, but require
further work for a more natural integration into the target language.
We urge folk knowledgeable in the other target languages to step
forward and help with this effort.
- Lua: improved metatables and support for %nspace.
- Go 1.3 support added.
- Python import improvements including relative imports.
- Python 3.3 support completed.
- Perl director support added.
- C# .NET 2 support is now the minimum. Generated using statements are
replaced by fully qualified names.
- Bug fixes and improvements to the following languages:
C#, Go, Guile, Java, Lua, Perl, PHP, Python, Octave, R, Ruby, Tcl
- Various other bug fixes and improvements affecting all languages.
- Note that this release contains some backwards incompatible changes
in some languages.
- Full detailed release notes are in the changes file.
SWIG-2.0.12 summary:
- 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.
SWIG-2.0.11 summary:
- Minor bug fixes and enhancements mostly in Python, but also
C#, Lua, Ocaml, Octave, Perl, PHP, Python, R, Ruby, Tcl.
SWIG-2.0.10 summary:
- Ruby 1.9 support is now complete.
- Add support for Guile 2.0 and Guile 1.6 support (GH interface) has
been dropped.
- 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.
SWIG-2.0.9 summary:
- 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.
SWIG-2.0.8 summary:
- 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.
SWIG-2.0.7 summary:
- Important regression fixes since 2.0.5 for typemaps in general and
in Python.
- Fixes and enhancements for Go, Java, Octave and PHP.
SWIG-2.0.6 summary:
- Regression fix for Python STL wrappers on some systems.
SWIG-2.0.5 summary:
- Official Android support added including documentation and examples.
- Improvements involving templates:
1) Various fixes with templates and typedef types.
2) Some template lookup problems fixed.
3) Templated type fixes to use correct typemaps.
- Autodoc documentation generation improvements.
- Python STL container wrappers improvements including addition of
stepped slicing.
- Approximately 70 fixes and minor enhancements for the following
target languages: AllegroCL, C#, D, Go, Java, Lua, Ocaml, Octave,
Perl, PHP, Python, R, Ruby, Tcl, Xml.
SWIG-2.0.4 summary:
- This is mainly a Python oriented release including support for Python
built-in types for superior performance with the new -builtin option.
The -builtin option is especially suitable for performance-critical
libraries and applications that call wrapped methods repeatedly.
See the python-specific chapter of the SWIG manual for more info.
- Python 3.2 support has also been added and various Python bugs have
been fixed.
- Octave 3.4 support has also been added.
- There are also the usual minor generic improvements, as well as bug
fixes and enhancements for D, Guile, Lua, Octave, Perl and Tcl.
SWIG-2.0.3 summary:
- A bug fix release including a couple of fixes for regressions in the
2.0 series.
SWIG-2.0.2 summary:
- Support for the D language has been added.
- Various bug fixes and minor enhancements.
- Bug fixes particular to the Clisp, C#, Go, MzScheme, Ocaml, PHP, R,
Ruby target languages.
SWIG-2.0.1 summary:
- Support for the Go language has been added.
- New regular expression (regex) encoder for renaming symbols based on
the Perl Compatible Regular Expressions (PCRE) library.
- Numerous fixes in reporting file and line numbers in error and warning
messages.
- Various bug fixes and improvements in the C#, Lua, Perl, PHP, Ruby
and Python language modules.
SWIG-2.0.0 summary:
- License changes, see LICENSE file and
https://www.swig.org/legal.html.
- Much better nested class/struct support.
- Much improved template partial specialization and explicit
specialization handling.
- Namespace support improved with the 'nspace' feature where namespaces
can be automatically translated into Java packages or C# namespaces.
- Improved typemap and symbol table debugging.
- Numerous subtle typemap matching rule changes when using the default
(SWIGTYPE) type. These now work much like C++ class template partial
specialization matching.
- Other small enhancements for typemaps. Typemap fragments are also now
official and documented.
- Warning and error display refinements.
- Wrapping of shared_ptr is improved and documented now.
- Numerous C++ unary scope operator (::) fixes.
- Better support for boolean expressions.
- Various bug fixes and improvements in the Allegrocl, C#, Java, Lua,
Octave, PHP, Python, R, Ruby and XML modules.
SWIG-1.3.40 summary:
- SWIG now supports directors for PHP.
- PHP support improved in general.
- Octave 3.2 support added.
- Various bug fixes/enhancements for Allegrocl, C#, Java, Octave, Perl,
Python, Ruby and Tcl.
- Other generic fixes and minor new features.
SWIG-1.3.39 summary:
- Some new small feature enhancements.
- Improved C# std::vector wrappers.
- Bug fixes: mainly Python, but also Perl, MzScheme, CFFI, Allegrocl
and Ruby
SWIG-1.3.38 summary:
- Output directory regression fix and other minor bug fixes
SWIG-1.3.37 summary:
- Python 3 support added
- SWIG now ships with a version of ccache that can be used with SWIG.
This enables the files generated by SWIG to be cached so that repeated
use of SWIG on unchanged input files speeds up builds quite considerably.
- PHP 4 support removed and PHP support improved in general
- Improved C# array support
- Numerous Allegro CL improvements
- Bug fixes/enhancements for Python, PHP, Java, C#, Chicken, Allegro CL,
CFFI, Ruby, Tcl, Perl, R, Lua.
- Other minor generic bug fixes and enhancements
SWIG-1.3.36 summary:
- Enhancement to directors to wrap all protected members
- Optimisation feature for objects returned by value
- A few bugs fixes in the PHP, Java, Ruby, R, C#, Python, Lua and
Perl modules
- Other minor generic bug fixes
SWIG-1.3.35 summary:
- Octave language module added
- Bug fixes in Python, Lua, Java, C#, Perl modules
- A few other generic bugs and runtime assertions fixed
SWIG-1.3.34 summary:
- shared_ptr support for Python
- Support for latest R - version 2.6
- Various minor improvements/bug fixes for R, Lua, Python, Java, C#
- A few other generic bug fixes, mainly for templates and using statements
SWIG-1.3.33 summary:
- Fix regression for Perl where C++ wrappers would not compile
- Fix regression parsing macros
SWIG-1.3.32 summary:
- shared_ptr support for Java and C#
- Enhanced STL support for Ruby
- Windows support for R
- Fixed long-standing memory leak in PHP Module
- Numerous fixes and minor enhancements for Allegrocl, C#, cffi, Chicken, Guile,
Java, Lua, Ocaml, Perl, PHP, Python, Ruby, Tcl.
- Improved warning support
SWIG-1.3.31 summary:
- Python modern classes regression fix
SWIG-1.3.30 summary:
- Python-2.5 support
- New language module: R
- Director support added for C#
- Numerous director fixes and improvements
- Improved mingw/msys support
- Better constants support in Guile and chicken modules
- Support for generating PHP5 class wrappers
- Important Java premature garbage collection fix
- Minor improvements/fixes in cffi, php, allegrocl, perl, chicken, lua, ruby,
ocaml, python, java, c# and guile language modules
- Many many other bug fixes
SWIG-1.3.29 summary:
- Numerous important bug fixes
- Few minor new features
- Some performance improvements in generated code for Python
SWIG-1.3.28 summary:
- More powerful renaming (%rename) capability.
- More user friendly warning handling.
- Add finer control for default constructors and destructors. We discourage
the use of the 'nodefault' option, which disables both constructors and
destructors, leading to possible memory leaks. Use instead 'nodefaultctor'
and/or 'nodefaultdtor'.
- Automatic copy constructor wrapper generation via the 'copyctor' option/feature.
- Better handling of Windows extensions and types.
- Better runtime error reporting.
- Add the %catches directive to catch and dispatch exceptions.
- Add the %naturalvar directive for more 'natural' variable wrapping.
- Better default handling of std::string variables using the %naturalvar directive.
- Add the %allowexcept and %exceptionvar directives to handle exceptions when
accessing a variable.
- Add the %delobject directive to mark methods that act like destructors.
- Add the -fastdispatch option to enable smaller and faster overload dispatch
mechanism.
- Template support for %rename, %feature and %typemap improved.
- Add/doc more debug options, such as -dump_module, -debug_typemaps, etc.
- Unified typemap library (UTL) potentially providing core typemaps for all
scripting languages based on the recently evolving Python typemaps.
- New language module: Common Lisp with CFFI.
- Python, Ruby, Perl and Tcl use the new UTL, many old reported and hidden
errors with typemaps are now fixed.
- Initial Java support for languages using the UTL via GCJ, you can now use
Java libraries in your favorite script language using gcj + swig.
- Tcl support for std::wstring.
- PHP4 module update, many error fixes and actively maintained again.
- Allegrocl support for C++, also enhanced C support.
- Ruby support for bang methods.
- Ruby support for user classes as native exceptions.
- Perl improved dispatching in overloaded functions via the new cast and rank
mechanism.
- Perl improved backward compatibility, 5.004 and later tested and working.
- Python improved backward compatibility, 1.5.2 and later tested and working.
- Python can use the same cast/rank mechanism via the -castmode option.
- Python implicit conversion mechanism similar to C++, via the %implicitconv
directive (replaces and improves the implicit.i library).
- Python threading support added.
- Python STL support improved, iterators are supported and STL containers can
use now the native PyObject type.
- Python many performance options and improvements, try the -O option to test
all of them. Python runtime benchmarks show up to 20 times better performance
compared to 1.3.27 and older versions.
- Python support for 'multi-inheritance' on the python side.
- Python simplified proxy classes, now swig doesn't need to generate the
additional 'ClassPtr' classes.
- Python extended support for smart pointers.
- Python better support for static member variables.
- Python backward compatibility improved, many projects that used to work
only with swig-1.3.21 to swig-1.3.24 are working again with swig-1.3.28
- Python test-suite is now 'valgrinded' before release, and swig also
reports memory leaks due to missing destructors.
- Minor bug fixes and improvements to the Lua, Ruby, Java, C#, Python, Guile,
Chicken, Tcl and Perl modules.
SWIG-1.3.27 summary:
- Fix bug in anonymous typedef structures which was leading to strange behaviour
SWIG-1.3.26 summary:
- New language modules: Lua, CLISP and Common Lisp with UFFI.
- Big overhaul to the PHP module.
- Change to the way 'extern' is handled.
- Minor bug fixes specific to C#, Java, Modula3, Ocaml, Allegro CL,
XML, Lisp s-expressions, Tcl, Ruby and Python modules.
- Other minor improvements and bug fixes.
SWIG-1.3.25 summary:
- Improved runtime type system. Speed of module loading improved in
modules with lots of types. SWIG_RUNTIME_VERSION has been increased
from 1 to 2, but the API is exactly the same; only internal changes
were made.
- The languages that use the runtime type system now support external
access to the runtime type system.
- Various improvements with typemaps and template handling.
- Fewer warnings in generated code.
- Improved colour documentation.
- Many C# module improvements (exception handling, prevention of early
garbage collection, C# attributes support added, more flexible type
marshalling/asymmetric types.)
- Minor improvements and bug fixes specific to the C#, Java, TCL, Guile,
Chicken, MzScheme, Perl, Php, Python, Ruby and Ocaml modules).
- Various other bug fixes and memory leak fixes.
SWIG-1.3.24 summary:
- Improved enum handling
- More runtime library options
- More bugs fixes for templates and template default arguments, directors
and other areas.
- Better smart pointer support, including data members, static members
and %extend.
SWIG-1.3.23 summary:
- Improved support for callbacks
- Python docstring support and better error handling
- C++ default argument support for Java and C# added.
- Improved c++ default argument support for the scripting languages plus
option to use original (compact) default arguments.
- %feature and %ignore/%rename bug fixes and mods - they might need default
arguments specified to maintain compatible behaviour when using the new
default arguments wrapping.
- Runtime library changes: Runtime code can now exist in more than one module
and so need not be compiled into just one module
- Further improved support for templates and namespaces
- Overloaded templated function support added
- More powerful default typemaps (mixed default typemaps)
- Some important %extend and director code bug fixes
- Guile now defaults to using SCM API. The old interface can be obtained by
the -gh option.
- Various minor improvements and bug fixes for C#, Chicken, Guile, Java,
MzScheme, Perl, Python and Ruby
- Improved dependencies generation for constructing Makefiles.
SWIG-1.3.22 summary:
- Improved exception handling and translation of C errors or C++
exceptions into target language exceptions.
- Improved enum support, mapping to built-in Java 1.5 enums and C#
enums or the typesafe enum pattern for these two languages.
- Python - much better STL support and support for std::wstring,
wchar_t and FILE *.
- Initial support for Modula3 and Allegro CL.
- 64 bit TCL support.
- Java and C#'s proxy classes are now nearly 100% generated from
typemaps and/or features for finer control on the generated code.
- SWIG runtime library support deprecation.
- Improved documentation. SWIG now additionally provides documentation
in the form of a single HTML page as well as a pdf document.
- Enhanced C++ friend declaration support.
- Better support for reference counted classes.
- Various %fragment improvements.
- RPM fixes.
- Various minor improvements and bug fixes for C#, Chicken, Guile, Java,
MzScheme, Perl, Php, Python, Ruby and XML.