| 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.0.0 (in progress) |
| =========================== |
| |
| 2017-09-23: wsfulton |
| Issue #1098. Fix overloading of shared_ptr with underlying pointer types, eg: |
| |
| void m(std::shared_ptr<T> p); |
| void m(T &p); |
| void m(T *p); |
| |
| Only the first method is wrapped and the others are ignored/shadowed. |
| The implementation is done via a new attribute in the 'typecheck' typemap called |
| 'equivalent'. If specified, it must contain the equivalent pointer type for overloading |
| and can only be used for the special SWIG_TYPECHECK_POINTER precedence level. |
| The shared_ptr 'typecheck' typemaps have been modified accordingly. |
| Here is a simplified version: |
| |
| %typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="T *") |
| T, |
| T CONST &, |
| T CONST *, |
| T *CONST&, |
| std::shared_ptr< T >, |
| std::shared_ptr< T > &, |
| std::shared_ptr< T > *, |
| std::shared_ptr< T > *& |
| { ... } |
| |
| Overloading with any of these types will result in SWIG ignoring all but the first |
| overloaded method by default. Without the 'equivalent' attribute, wrapping the overloaded |
| methods resulted in types being shadowed (scripting languages) or code that did not |
| compile (statically typed languages). |
| |
| 2017-09-19: futatuki |
| [Python] #1003 Add --with-2to3=/path/to/2to3 option to configure. |
| |
| 2017-09-18: wsfulton |
| Fix type promotion wrapping constant expressions of the form: |
| # define EXPR_MIXED1 (0x80 + 11.1) - 1 |
| This was previously an integral type instead of a floating point type. |
| |
| 2017-09-17: wsfulton |
| Fix generated code for constant expressions containing wchar_t L literals such as: |
| # define __WCHAR_MAX (0x7fffffff + L'\0') |
| # define __WCHAR_MIN (-__WCHAR_MAX - 1) |
| |
| 2017-09-10: mlamarre |
| [Python] Patch #1083. Define_DEBUG to 1 to do exactly like Visual Studio |
| /LDd, /MDd or /MTd compiler options. |
| |
| 2017-08-25: wsfulton |
| Issue #1059. Add support for C++11 ref-qualifiers on non-static member functions. |
| Members with lvalue ref-qualifiers such as: |
| |
| struct RQ { |
| void m1(int x) &; |
| void m2(int x) const &; |
| }; |
| |
| are wrapped like any other member function. Member functions with rvalue ref-qualifiers |
| are ignored by default, such as: |
| |
| struct RQ { |
| void m3(int x) &&; |
| void m4(int x) const &&; |
| }; |
| |
| example.i:7: Warning 405: Method with rvalue ref-qualifier m3(int) && ignored. |
| example.i:8: Warning 405: Method with rvalue ref-qualifier m4(int) const && ignored. |
| |
| These can be unignored and exposed to the target language, see further documentation in |
| CPlusPlus11.html. |
| |
| 2017-08-16: wsfulton |
| Fix #1063. Add using declarations to templates into typedef table. |
| |
| Using declarations to templates were missing in SWIG's internal typedef tables. |
| This led to a few problems, such as, templates that did not instantiate and generated |
| C++ code that did not compile as SWIG did not know what scope the template was |
| in. This happened mostly when a using declaration was used on a template type in a |
| completely unrelated namespace. |
| |
| 2017-08-16: wsfulton |
| Fix type lookup in the presence of using directives and using declarations. |
| |
| Fix some cases of type lookup failure via a combination of both using directives and |
| using declarations resulting in C++ code that did not compile as the generated type was |
| not fully qualified for use in the global namespace. Example below: |
| |
| namespace Space5 { |
| namespace SubSpace5 { |
| namespace SubSubSpace5 { |
| struct F {}; |
| } |
| } |
| using namespace SubSpace5; |
| using SubSubSpace5::F; |
| void func(SubSubSpace5::F f); |
| } |
| |
| 2017-08-16: wsfulton |
| Issue #1051. %template scope enforcement and class definition fixes. |
| |
| The scoping rules around %template have been specified and enforced. |
| The %template directive for a class template is the equivalent to an |
| explicit instantiation of a C++ class template. The scope for a valid |
| %template instantiation is now the same as the scope required for a |
| valid explicit instantiation of a C++ template. A definition of the |
| template for the explicit instantiation must be in scope where the |
| instantiation is declared and must not be enclosed within a different |
| namespace. |
| |
| For example, a few %template and C++ explicit instantiations of std::vector |
| are shown below: |
| |
| // valid |
| namespace std { |
| %template(vin) vector<int>; |
| template class vector<int>; |
| } |
| |
| // valid |
| using namespace std; |
| %template(vin) vector<int>; |
| template class vector<int>; |
| |
| // valid |
| using std::vector; |
| %template(vin) vector<int>; |
| template class vector<int>; |
| |
| // ill-formed |
| namespace unrelated { |
| using std::vector; |
| %template(vin) vector<int>; |
| template class vector<int>; |
| } |
| |
| // ill-formed |
| namespace unrelated { |
| using namespace std; |
| %template(vin) vector<int>; |
| template class vector<int>; |
| } |
| |
| // ill-formed |
| namespace unrelated { |
| namespace std { |
| %template(vin) vector<int>; |
| template class vector<int>; |
| } |
| } |
| |
| // ill-formed |
| namespace unrelated { |
| %template(vin) std::vector<int>; |
| template class std::vector<int>; |
| } |
| |
| When the scope is incorrect, an error now occurs such as: |
| |
| cpp_template_scope.i:34: Error: 'vector' resolves to 'std::vector' and |
| was incorrectly instantiated in scope 'unrelated' instead of within scope 'std'. |
| |
| Previously SWIG accepted the ill-formed examples above but this led to |
| numerous subtle template scope problems especially in the presence of |
| using declarations and using directives as well as with %feature and %typemap. |
| |
| Actually, a valid instantiation is one which conforms to the C++03 |
| standard as C++11 made a change to disallow using declarations and |
| using directives to find a template. |
| |
| // valid C++03, ill-formed C++11 |
| using std::vector; |
| template class vector<int>; |
| |
| Similar fixes for defining classes using forward class references have |
| also been put in place. For example: |
| |
| namespace Space1 { |
| struct A; |
| } |
| namespace Space2 { |
| struct Space1::A { |
| void x(); |
| } |
| } |
| |
| will now error out with: |
| |
| cpp_class_definition.i:5: Error: 'Space1::A' resolves to 'Space1::A' and |
| was incorrectly instantiated in scope 'Space2' instead of within scope 'Space1'. |
| |
| 2017-08-16: wsfulton |
| Fix scope lookup for template parameters containing unary scope operators. |
| |
| Fixes cases like: |
| |
| namespace Alloc { |
| template<typename T> struct Rebind { |
| typedef int Integer; |
| }; |
| } |
| %template(RebindBucket) Alloc::Rebind< Bucket >; |
| OR |
| %template(RebindBucket) Alloc::Rebind< ::Bucket >; |
| |
| Alloc::Rebind< Bucket >::Integer Bucket1(); |
| Alloc::Rebind< ::Bucket >::Integer Bucket2(); |
| Alloc::Rebind<::template TemplateBucket<double>>::Integer Bucket3(); |
| |
| 2017-08-16: wsfulton |
| For templates only, the template parameters are fully resolved when |
| handling typemaps. Without this, it is too hard to have decent rules |
| to apply typemaps when parameter types are typedef'd and template |
| parameters have default values. |
| |
| Fixes %clear for typedefs in templates, eg: |
| |
| %typemap("in") XXX<int>::Long "..." |
| template typename<T> struct XXX { |
| typedef long Long; |
| }; |
| %clear XXX<int>::Long; |
| |
| as the typemap was previously incorrectly stored as a typemap for long |
| instead of XXX<int>::Long. |
| |
| 2017-08-05: olly |
| [C++11] Allow static_assert at the top level (and disallow it right |
| after template<T>). Fixes https://github.com/swig/swig/issues/1031 |
| reported by Artem V L. |
| |
| 2017-08-02: wsfulton |
| Fix incorrectly shown warning when an empty template instantiation was used on a |
| class used as a base class and that base class was explicitly ignored with %ignore. |
| Example of the warning which will no longer appear: |
| |
| Warning 401: Base class 'Functor< int,int >' has no name as it is an empty |
| template instantiated with '%template()'. Ignored. |
| |
| 2017-07-17: fflexo |
| [Java] #674 Add std_list.i to add support for std::list containers. The Java proxy |
| extends java.util.AbstractSequentialList and makes the C++ std::list container look |
| and feel much like a java.util.LinkedList from Java. |
| |
| 2017-07-07: wsfulton |
| [Python] Fix display of documented template types when using the autodoc |
| feature. For example when wrapping: |
| |
| %feature("autodoc"); |
| template<typename X> struct T {}; |
| %template(TInteger) T<int>; |
| |
| the generated documentation contains: |
| """Proxy of C++ T< int > class.""" |
| instead of: |
| """Proxy of C++ T<(int)> class.""" |
| and |
| """__init__(TInteger self) -> TInteger""" |
| instead of |
| """__init__(T<(int)> self) -> TInteger""" |
| |
| 2017-06-27: nihaln |
| [PHP] Update the OUTPUT Typemap to add return statement to the |
| PHP Wrapper. |
| |
| 2017-06-27: nihaln |
| [PHP] Update the enum and value examples to use the OO wrappers |
| rather than the flat functions produced with -noproxy. There's |
| not been a good reason to use -noproxy for since PHP5 OO wrapping |
| was fixed back in 2005. |
| |
| 2017-06-23: m7thon |
| [Python] fix and improve default argument handling: |
| |
| 1. Fix negative octals. Currently not handled correctly by `-py3` |
| (unusual case, but incorrect). |
| 2. Fix arguments of type "octal + something" (e.g. `0640 | 04`). |
| Currently drops everything after the first octal. Nasty! |
| 3. Fix bool arguments "0 + something" (e.g. `0 | 1`) are always |
| "False" (unusual case, but incorrect). |
| 4. Remove special handling of "TRUE" and "FALSE" from |
| `convertValue` since there's no reason these have to match |
| "true" and "false". |
| 5. Remove the Python 2 vs. Python 3 distinction based on the |
| `-py3` flag. Now the same python code is produced for default |
| arguments for Python 2 and Python 3. For this, octal default |
| arguments, e.g. 0644, are now wrapped as `int('644', 8)`. This |
| is required, as Python 2 and Python 3 have incompatible syntax |
| for octal literals. |
| |
| Fixes #707 |
| |
| 2017-06-21: futatuki |
| #1004 - Fix ccache-swig executable name to respect configure's --program-prefix and |
| --program-suffix values if used. |
| |
| 2017-06-21: tamuratak |
| [Ruby] #911 - Add std::wstring support. |
| |
| 2017-06-19: wsfulton |
| [Python] Fix handling of rich comparisons when wrapping overloaded operators: |
| |
| operator< operator<= operator> operator>= operator== operator!= |
| |
| Previously a TypeError was always thrown if the type was not correct. NotImplemented |
| is now returned from these wrapped functions if the type being compared with is |
| not correct. The subsequent behaviour varies between different versions of Python |
| and the comparison function being used, but is now consistent with normal Python |
| behaviour. For example, for the first 4 operator overloads above, a TypeError |
| 'unorderable types' is thrown in Python 3, but Python 2 will return True or False. |
| NotImplemented should be returned when the comparison cannot be done, see PEP 207 and |
| https://docs.python.org/3/library/constants.html#NotImplemented |
| |
| Note that the bug was only present when overloaded operators did not also have a |
| function overload. |
| |
| Fixes SF bug #1208 (3441262) and SF patch #303. |
| |
| *** POTENTIAL INCOMPATIBILITY *** |
| |
| 2017-06-17: fabrice102 |
| [Go] Fix Go callback example. Fixes github #600, #955, #1000. |
| |
| 2017-06-16: wsfulton |
| Make sure warning and error messages are not split up by other processes writing to |
| stdout at the same time. |
| |
| 2017-06-16: wsfulton |
| [R] Fix wrapping function pointers containing rvalue and lvalue reference parameters. |
| |
| 2017-06-13: olly |
| [Perl] Fix testsuite to work without . in @INC - it was removed in |
| Perl 5.26 for security reasons, and has also been removed from |
| older versions in some distros. Fixes |
| https://github.com/swig/swig/issues/997 reported by lfam. |
| |
| 2017-06-03: wsfulton |
| Fix %import on a file containing a file scope %fragment forced inclusion to not |
| generate the fragment contents as %import should not result in code being generated. |
| The behaviour is now the same as importing code insertion blocks. |
| Wrapping FileC.i in the following example will result in no generated code, whereas |
| previously "#include <limits.h>" was generated: |
| |
| // FileA.i |
| %fragment("<limits.h>", "header") %{ |
| #include <limits.h> |
| %} |
| |
| %{ |
| #include <stdio.h> |
| %} |
| %fragment("<limits.h>"); |
| |
| // FileC.i |
| %import "FileA.i" |
| |
| *** POTENTIAL INCOMPATIBILITY *** |
| |
| 2017-05-26: Volker Diels-Grabsch, vadz |
| [Java] #842 Extend from java.util.AbstractList<> and implement java.util.RandomAccess for |
| std::vector wrappers. This notably allows to iterate over wrapped vectors in a natural way. |
| 2017-05-30: davidcl |
| [Scilab] #994 Undefined symbol error when loading in Scilab 6 |
| |
| 2017-05-25: asibross |
| [Java] #370 #417 Missing smart pointer handling in Java director extra methods |
| swigReleaseOwnership() and swigTakeOwnership(). |
| |
| 2017-05-23: wsfulton |
| [Java] #230 #759 Fix Java shared_ptr and directors for derived classes java compilation |
| error. |
| |
| For shared_ptr proxy proxy classes, add a protected method swigSetCMemOwn for modifying |
| the swigCMemOwn and swigCMemOwnDerived member variables which are used by various other |
| methods for controlling memory ownership. |
| |
| 2017-05-21: Sghirate |
| [Java, C#, D] #449 Remove unnecessary use of dynamic_cast in directors to enable |
| non-RTTI compilation. |
| |
| 2017-05-21: wsfulton |
| [Python] #993 Fix handling of default -ve unsigned values, such as: |
| void f(unsigned = -1U); |
| |
| 2017-05-20: jschueller |
| [Python] #991 Fix E731 PEP8 warning: do not assign a lambda expression |
| |
| 2017-05-16: nihal95 |
| [PHP] Add %pragma version directive to allow the version of the |
| extension to be set. Patch #970, fixes #360. |
| |
| 2017-05-13: yag00 |
| Patch #975 - Add support for noexcept on director methods. |
| |
| 2017-04-27: redbrain |
| Issue #974, Patch #976 - Fix preprocessor handling of macros with commas in a comment. |
| |
| 2017-04-25: jleveque |
| [Lua] #959 - Fix Visual Studio C4244 conversion warnings in Lua wrappers. |
| |
| 2017-04-21: tamuratak |
| [Ruby] #964 - Add shared_ptr director typemaps. |
| |
| 2017-04-20: wsfulton |
| [Ruby] #586, #935 Add assert for invalid NULL type parameter when calling SWIG_Ruby_NewPointerObj. |
| |
| 2017-04-20: tamuratak |
| [Ruby] #930, #937 - Fix containers of std::shared_ptr. |
| Upcasting, const types (eg vector<shared_ptr<const T>>) and NULL/nullptr support added. |
| |
| 2017-04-12: smarchetto |
| [Scilab] New parameter targetversion to specify the Scilab target version (5, 6, ..) for code generation |
| With Scilab 6 target specified, identifier names truncation is disabled (no longer necessary) |
| |
| 2017-03-24: tamuratak |
| [Ruby] Fix #939 - Wrapping std::vector<bool> fix due to incorrect null checks |
| on VALUE obj. |
| |
| 2017-03-17: vadz |
| [C#] #947 Add support for std::complex<T> |
| |
| 2017-03-17: wsfulton |
| [Go] Fix handling of typedef'd function pointers and typedef'd member function pointers |
| such as: |
| |
| typedef int (*FnPtr_td)(int, int); |
| int do_op(int x, int y, FnPtr_td op); |
| |
| 2017-03-16: wsfulton |
| Add support for member const function pointers such as: |
| |
| int fn(short (Funcs::* parm)(bool)) const; |
| |
| Also fix parsing of references/pointers and qualifiers to member |
| pointers such as: |
| |
| int fn(short (Funcs::* const parm)(bool)); |
| int fn(short (Funcs::* & parm)(bool)); |
| |
| 2017-03-10: wsfulton |
| Extend C++11 alternate function syntax parsing to support const and noexcept, such as: |
| |
| auto sum1(int x, int y) const -> int { return x + y; } |
| auto sum2(int x, int y) noexcept -> int { return x + y; } |
| |
| 2017-02-29: tamuratak |
| [Ruby] #917 - Add Enumerable module to all container class wrappers. It was missing |
| for std::list, std::multiset, std::unordered_multiset and std::unordered_map. |
| |
| 2017-02-27: assambar |
| [C++11] Extend parser to support throw specifier in combination |
| with override and/or final. |
| |
| 2017-02-10: tamuratak |
| [Ruby] #883 - Add support for C++11 hash tables: |
| std::unordered_map |
| std::unordered_set |
| std::unordered_multimap |
| std::unordered_multiset |
| |
| 2017-02-08: jcsharp |
| [C#] #887 Improve std::vector<T> wrapper constructors - |
| Replace constructor taking ICollection with IEnumerable and also add IEnumerable<T> |
| constructor to avoid the boxing and unboxing overhead of the original constructor, |
| when the type parameter is a value type. |