diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 418834786..374976d2a 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -120,8 +120,11 @@ jobs:
- SWIGLANG: php
VER: '7.4'
- SWIGLANG: php
+ VER: '8.0'
- SWIGLANG: php
VER: '8.1'
+ - SWIGLANG: php
+ VER: '8.2'
- SWIGLANG: python
PY2: 2
- SWIGLANG: python
@@ -186,6 +189,7 @@ jobs:
CPPSTD: c++11
- SWIGLANG: scilab
VER: '5.5.2'
+ continue-on-error: true # downloads have moved, awaiting URL redirect
- SWIGLANG: scilab
os: ubuntu-18.04 # scilab 6.0
- SWIGLANG: scilab
diff --git a/.github/workflows/nuget.yml b/.github/workflows/nuget.yml
new file mode 100644
index 000000000..40ab4244c
--- /dev/null
+++ b/.github/workflows/nuget.yml
@@ -0,0 +1,62 @@
+name: Windows Nuget Build
+
+on:
+ push:
+ paths-ignore:
+ - 'CHANGES*'
+ - 'Doc/**'
+ - 'appveyor.yml'
+ pull_request:
+ branches: master
+ paths-ignore:
+ - 'CHANGES*'
+ - 'Doc/**'
+ - 'appveyor.yml'
+
+permissions:
+ contents: read # to fetch code (actions/checkout)
+
+jobs:
+ build:
+
+ runs-on: windows-2019
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ with:
+ submodules: recursive
+
+ - name: Install Dependencies
+ shell: powershell
+ run: |
+ nuget install CMake-win64 -Version 3.15.5 -OutputDirectory C:\Tools\CMake
+ nuget install Bison -Version 3.7.4 -OutputDirectory C:\Tools\bison
+ nuget install PCRE2 -Version 10.39 -OutputDirectory C:\Tools\pcre2
+
+ - name: Build
+ shell: powershell
+ run: |
+ $env:PATH="C:\Tools\CMake\CMake-win64.3.15.5\bin;C:\Tools\bison\Bison.3.7.4\bin;" + $env:PATH
+ $PCRE_ROOT="C:\Tools\pcre2\PCRE2.10.39.0"
+ $PCRE_PLATFORM="x64"
+ $WORKING_DIR=(Get-Location).ToString() -replace "\\","/"
+ cmake -G "Visual Studio 16 2019" -A "x64" `
+ -DCMAKE_INSTALL_PREFIX="$WORKING_DIR/install2" `
+ -DCMAKE_C_FLAGS="/DPCRE2_STATIC" `
+ -DCMAKE_CXX_FLAGS="/DPCRE2_STATIC" `
+ -DPCRE2_INCLUDE_DIR="$PCRE_ROOT/include" `
+ -DPCRE2_LIBRARY="$PCRE_ROOT/lib/pcre2-8-static.lib" `
+ -S . -B build
+ cmake --build build --config Release
+
+ - name: Install
+ shell: powershell
+ run: |
+ cmake --install build --config Release
+
+ - name: Test
+ shell: powershell
+ working-directory: install2/bin
+ run: |
+ swig.exe -version
diff --git a/.gitignore b/.gitignore
index 4fee29d54..307def526 100644
--- a/.gitignore
+++ b/.gitignore
@@ -81,7 +81,6 @@ Tools/javascript/Makefile
config.log
config.status
preinst-swig
-swig.spec
# Build Artifacts
.dirstamp
diff --git a/ANNOUNCE b/ANNOUNCE
index e78be2268..73ddb2b77 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,8 +1,8 @@
-*** ANNOUNCE: SWIG 4.1.0 (in progress) ***
+*** ANNOUNCE: SWIG 4.2.0 (in progress) ***
-http://www.swig.org
+https://www.swig.org
-We're pleased to announce SWIG-4.1.0, the latest SWIG release.
+We're pleased to announce SWIG-4.2.0, the latest SWIG release.
What is SWIG?
=============
@@ -19,20 +19,20 @@ and user interface development for large C/C++ systems.
Release Notes
=============
Detailed release notes are available with the release and are also
-published on the SWIG web site at http://swig.org/release.html.
+published on the SWIG web site at https://swig.org/release.html.
Availability
============
The release is available for download on Sourceforge at
- https://prdownloads.sourceforge.net/swig/swig-4.1.0.tar.gz
+ https://prdownloads.sourceforge.net/swig/swig-4.2.0.tar.gz
A Windows version is also available at
- https://prdownloads.sourceforge.net/swig/swigwin-4.1.0.zip
+ https://prdownloads.sourceforge.net/swig/swigwin-4.2.0.zip
Please report problems with this release to the swig-devel mailing list,
-details at http://www.swig.org/mail.html.
+details at https://www.swig.org/mail.html.
--- The SWIG Developers
diff --git a/CCache/ccache.c b/CCache/ccache.c
index c5c510388..a28d38324 100644
--- a/CCache/ccache.c
+++ b/CCache/ccache.c
@@ -735,13 +735,15 @@ static void from_cache(int first)
}
/* send the cpp stderr, if applicable */
- fd_cpp_stderr = open(cpp_stderr, O_RDONLY | O_BINARY);
- if (fd_cpp_stderr != -1) {
- copy_fd(fd_cpp_stderr, 2);
- close(fd_cpp_stderr);
- unlink(cpp_stderr);
- free(cpp_stderr);
- cpp_stderr = NULL;
+ if (cpp_stderr) {
+ fd_cpp_stderr = open(cpp_stderr, O_RDONLY | O_BINARY);
+ if (fd_cpp_stderr != -1) {
+ copy_fd(fd_cpp_stderr, 2);
+ close(fd_cpp_stderr);
+ unlink(cpp_stderr);
+ free(cpp_stderr);
+ cpp_stderr = NULL;
+ }
}
/* send the stderr */
diff --git a/CCache/ccache.yo b/CCache/ccache.yo
index 2477662dc..fd5ba89c3 100644
--- a/CCache/ccache.yo
+++ b/CCache/ccache.yo
@@ -409,7 +409,7 @@ ccache was adapted to create ccache-swig for use with SWIG by William Fulton.
If you wish to report a problem or make a suggestion then please email
the SWIG developers on the swig-devel mailing list, see
-url(http://www.swig.org/mail.html)(http://www.swig.org/mail.html)
+url(https://www.swig.org/mail.html)(https://www.swig.org/mail.html)
ccache is released under the GNU General Public License version 2 or
later. Please see the file COPYING for license details.
diff --git a/CCache/mdfour.c b/CCache/mdfour.c
index b098e0215..5b304852b 100644
--- a/CCache/mdfour.c
+++ b/CCache/mdfour.c
@@ -88,8 +88,8 @@ static void copy64(uint32 *M, const unsigned char *in)
int i;
for (i=0;i<16;i++)
- M[i] = (in[i*4+3]<<24) | (in[i*4+2]<<16) |
- (in[i*4+1]<<8) | (in[i*4+0]<<0);
+ M[i] = ((uint32)in[i*4+3]<<24) | ((uint32)in[i*4+2]<<16) |
+ ((uint32)in[i*4+1]<<8) | ((uint32)in[i*4+0]<<0);
}
static void copy4(unsigned char *out,uint32 x)
diff --git a/CHANGES b/CHANGES
index 3ddd94d2b..049f449c3 100644
--- a/CHANGES
+++ b/CHANGES
@@ -5,6 +5,1355 @@ 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.1.1 (30 Nov 2022)
+===========================
+
+2022-11-29: bero
+ Fix mismatch between #pragma GCC diagnostic push and pop statements
+
+2022-11-26: wsfulton
+ #2449 Fix undefined behaviour in ccache-swig calculating md4 hashes and possibly
+ also handling errors when CCACHE_CPP2 is set.
+
+2022-11-25: wsfulton
+ #961 Fix syntax error parsing unnamed template parameters with a default value.
+
+2022-11-25: olly
+ #2447 Fix undefined behaviour in swig's parser when handling
+ default parameter expressions containing method calls.
+
+2022-11-13: olly
+ [PHP] #2419 Update the documentation to reflect that SWIG 4.1.0
+ dropped support for -noproxy when generating PHP wrappers.
+
+2022-11-05: wsfulton
+ #2417 Fix -swiglib for Windows when building with CMake.
+
+2022-11-02: wsfulton
+ #2418 Fix infinite loop handling non-type template parameters.
+
+ Fixes infinite loop due to () brackets in a non-type template
+ parameter containing an expression.
+
+2022-10-28: wsfulton
+ [R] R rtypecheck typemaps
+
+ Further switch to use rtypecheck typemaps instead of hard coded logic.
+ The full switch to typemaps is deferred until swig-4.2 as it can't be fully
+ backwards compatible. For now a warning is provided to help the
+ transition. It provides the full typemap that should be placed into
+ a user's interface file, for example:
+
+ %typemap("rtype") int32_t * "integer"
+ void testmethod(int32_t * i);
+ void testmethod();
+
+ If there is no rtypecheck typemap for int32_t *, the warning shown is:
+
+ example.i:7: Warning 750: Optional rtypecheck code is deprecated. Add the
+ following typemap to fix as the next version of SWIG will not work without it:
+ %typemap("rtypecheck") int32_t * %{ (is.integer($arg) || is.numeric($arg)) %}
+
+ The warning is shown for any code that previously used "numeric", "integer" or
+ "character" for the rtype typemap. Copying the rtypecheck typemap as
+ shown into the user interface file will provide the appropriate fix and
+ the warning will disappear. This is important to do as swig-4.2 will
+ not be able to provide this helpful warning.
+
+2022-10-27: wsfulton
+ [R] Allow NULL to be used in overloaded functions taking shared_ptr.
+ Also fixes special variable $argtype expansion in rtypecheck typemaps.
+
+2022-10-26: wsfulton
+ [R] Improve R wrapper error message when calling overloaded methods
+ when incorrect types passed are passed to the overloaded methods.
+
+ Old unhelpful error message:
+ Error in f(...) : could not find function "f"
+
+ Example of new improved error message:
+ Error in use_count(k) :
+ cannot find overloaded function for use_count with argtypes (NULL)
+
+2022-10-26: wsfulton
+ [R] #2386 Fix memory leak in R shared_ptr wrappers.
+ Fix leak when a cast up a class inheritance chain is required.
+
+Version 4.1.0 (24 Oct 2022)
+===========================
+
+2022-10-24: wsfulton, AndLLA
+ [R] #2386 Fix problems in shared_ptr wrappers where the class names
+ were not consistent when using the shared_ptr template or the actual
+ underlying type.
+
+2022-10-24: wsfulton
+ [R] Add support for special variable replacement in the $typemap()
+ special variable macro for R specific typemaps (rtype, rtypecheck,
+ scoercein, scoereout).
+
+2022-10-24: wsfulton
+ [R] Polymorphism in the wrappers was only working for C++ classes,
+ now this works for C++ structs too.
+
+2022-10-19: olly
+ [Lua] #2126 Fix type resolution between multiple SWIG-wrapped
+ modules.
+
+2022-10-17: wsfulton
+ [R] #2385 Add support for std::vector>.
+
+2022-10-14: murillo128
+ [Javascript] #2109 Tweak unsigned long and unsigned long long typemaps
+ to create a v8::Number instead of v8::Integer if the value exceeds
+ the size of v8::Integer. Note that the v8::Number value will be
+ imprecise if the value is > MAX_SAFE_INTEGER.
+
+2022-10-14: olly
+ [R] Arrange that destructors of local C++ objects in the wrapper
+ function get run on SWIG_fail (which calls Rf_error() which calls
+ longjmp()).
+
+2022-10-14: olly
+ [Lua] Arrange that destructors of local C++ objects in the wrapper
+ function get run on SWIG_fail (which calls lua_error() which calls
+ longjmp()).
+
+2022-10-13: wsfulton
+ [R] Add missing SWIGTYPE *const& typemaps for supporting pointers
+ by const reference.
+
+2022-10-10: wsfulton
+ #2160 Fix compile error when using templates with more than one template
+ parameter and used as an input parameter in a virtual method in a
+ director class (problem affecting most of the scripting languages).
+
+2022-10-10: treitmayr, wsfulton
+ [Python, Ruby] #1811 #1823 Fix invalid code generated in some cases when
+ returning a pointer or reference to a director-enabled class instance.
+ This previously only worked in very simple cases, now return types are
+ resolved to fix. A bug in template instantiations using pointers also
+ works now.
+
+2022-10-06: wsfulton
+ [CFFI] #1966 #2200 Remove code for Common Lisp CFFI. We dropped support
+ for it in SWIG 4.0.0 by disabling it as the first stage. This is the
+ final stage for complete removal as there has been no meaningful
+ progress to revive it to the status of experimental language.
+
+2022-10-06: olly
+ [Python] #2390 Remove deprecated and apparently useless defarg.swg
+
+ The only documentation is in the file itself and describes a Python
+ wrapper around the C function defined here, but digging though the
+ git history this Python wrapper doesn't seem to have ever actually
+ been generated by SWIG.
+
+ This file was also marked as deprecated in 2005.
+
+2022-10-06: wsfulton
+ [Java] #2048 Fix quoting for doxygen \image command to quote the output
+ file name generated into the html src attribute.
+
+2022-10-05: benjamin-sch
+ [Python] added an interpreter counter to fix deinitialization
+ issues if multiple subinterpreters are used
+
+2022-10-05: olly, wsfulton
+ #672 Add support for parsing C++11 final classes such as:
+
+ class X final {};
+
+ This no longer gives a syntax error.
+
+2022-10-05: wsfulton
+ [OCaml] Fix %rename for enum items. Previously the rename had no effect.
+
+2022-10-05: olly
+ #1465 Report errors in preprocessor expressions by default
+
+ Until now SWIG quietly ignored such errors unless -Wextra (or -Wall
+ which implies -Wextra) was passed, but this is unhelpful as it tends
+ to hide genuine problems. To illustrate this point, enabling this
+ warning by default revealed a typo in the preproc_defined.i
+ testcase in SWIG's own testsuite.
+
+ If you really don't want to see this warning, you can suppress it
+ with command line option -w202 or by using this in your interface
+ file:
+
+ %warnfilter(SWIGWARN_PP_EVALUATION);
+
+ Both will work with older versions of SWIG too.
+
+2022-10-04: olly
+ #1050 Consistently define SWIG_VERSION both at SWIG-time and in
+ the generated wrapper. Best practice remains to check at SWIG-time
+ where possible because that results in smaller generated wrapper
+ sources.
+
+ SWIGGO and SWIGJAVASCRIPT are now defined in the generated wrappers
+ to match behaviour for all other target languages.
+
+ The undocumented SWIGVERSION macro is no longer defined.
+
+2022-09-29: olly
+ #2303 SWIG's internal hash tables now use a better hash function.
+
+ The old hash function only considerd the last five characters
+ plus the least significant bit of the last-but-sixth character,
+ which as you might guess generated a lot of many-way collisions.
+
+ This change seems to give about a 4% reduction in wallclock time
+ for processing li_std_list_wrap.i from the testsuite for Python.
+ The hash collision rate for this example drops from 39% to 0!
+
+2022-09-29: wsfulton
+ #2303 Type tables are now output in a fixed order whereas previously
+ the order may change with any minor input code change. This shouldn't
+ affect users except SWIG_TypePrettyName may output a different C/C++
+ typedef to a type - it's used mostly for showing errors when the type
+ passed to a function is wrong.
+
+2022-09-29: olly
+ [PHP] Dynamic class properties are no longer supported by default.
+
+ Historically PHP has supported dynamic class properties and SWIG
+ has implemented them too (because we implement the magic __get(),
+ __set() and __isset() methods we need to include explicit
+ handling).
+
+ PHP 8.2 deprecates dynamic class properties - initially they'll
+ warn, and apparently they'll not work by default in PHP 9.0:
+ https://wiki.php.net/rfc/deprecate_dynamic_properties
+
+ In PHP code dynamic properties can be enabled for a class by
+ marking that class with the attribute `#[AllowDynamicProperties]`.
+
+ To follow this PHP change, in SWIG you now need to specify
+ `%feature("php:allowdynamicproperties", 1) Foo;` (or
+ `%feature("php:allowdynamicproperties", 1)` to enable it for
+ all wrapped classes). Unknown features are ignored, so you can add
+ it unconditionally and it'll work with older SWIG too.
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2022-09-19: wsfulton
+ #1484 Fixes for class inheritance with the same name in different namespaces
+ such as:
+
+ namespace A { class Bar {}; }
+ namespace B { template class Bar : public A::Bar {}; }
+
+2022-09-19: wsfulton
+ #2316 Remove swig.spec file and srcrpm makefile target. These are very out of date
+ and don't seem to be used by RPM based Linux distributions which have their
+ own version of swig.spec.
+
+2022-09-17: wsfulton
+ [Go, Guile, Racket, Scilab] Add throws typemaps for std::string so that thrown
+ string exception messages can be seen.
+
+2022-09-17: wsfulton
+ [Racket] Add throws typemaps for char * so that thrown string exception
+ messages can be seen from Racket.
+
+2022-09-17: wsfulton
+ [Javascript, Octave, R] Improve exceptions for %catches and exception
+ specifications for native types. String exception messages are shown as
+ the exception message instead of just the type of the exception.
+
+2022-09-17: wsfulton
+ Add missing typecheck typemaps for std::auto_ptr and std::unique_ptr to
+ fix overloading when using these types.
+
+2022-09-17: wsfulton
+ [Guile] Add error checking to SWIGTYPE and SWIGTYPE & in typemaps to prevent
+ seg faults when passing #nil to these parameter types.
+
+2022-09-16: wsfulton
+ #999 Provide SWIGTYPE MOVE typemaps in swigmove.i for implementing full
+ move semantics when passing parameters by value.
+
+2022-08-31: wsfulton
+ #999 Improve move semantics when using rvalue references.
+ The SWIGTYPE && input typemaps now assume the object has been moved.
+
+ These typemaps have been changed assuming that after the function call,
+ the rvalue reference parameter has been moved. The parameter's proxy class
+ that owns the C++ object thus has the underlying pointer set to null
+ so that the (moved from, but still valid) C++ object cannot be used again
+ and the object is additionally deleted.
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2022-08-28: wsfulton
+ [Octave] SWIG now marshals a C/C++ NULL pointer into the null matrix, [].
+ SWIG has always marshalled the null matrix into a NULL pointer; this remains
+ and now we have consistency in representing a NULL pointer.
+
+2022-08-26: wsfulton
+ [Racket] SWIG now marshals a C/C++ NULL pointer into a null value by calling
+ scheme_make_null(), so that scheme's null? is true for a NULL C/C++ pointer value.
+
+2022-08-18: wsfulton
+ [Racket] Add support for std::unique_ptr in std_unique_ptr.i.
+ Add support for std::auto_ptr in std_auto_ptr.i.
+
+2022-08-13: wsfulton
+ [Guile] Add support for std::unique_ptr in std_unique_ptr.i.
+ Add support for std::auto_ptr in std_auto_ptr.i.
+
+2022-08-11: wsfulton
+ [Lua] Add support for std::unique_ptr in std_unique_ptr.i.
+ Add support for std::auto_ptr in std_auto_ptr.i.
+
+2022-08-05: wsfulton
+ [D] Fix occasional undefined behaviour with inheritance hierarchies, particularly
+ when using virtual inheritance as the pointers weren't correctly upcast from derived
+ class to base class when stored in the base's proxy class.
+
+2022-08-05: wsfulton
+ [D] Add support for std::unique_ptr in std_unique_ptr.i.
+ Add support for std::auto_ptr in std_auto_ptr.i.
+
+2022-08-03: wsfulton
+ [Javascript] Add support for std::unique_ptr in std_unique_ptr.i.
+ Add support for std::auto_ptr in std_auto_ptr.i.
+
+2022-08-02: wsfulton
+ [Octave] Add support for std::unique_ptr in std_unique_ptr.i.
+ Add support for std::auto_ptr in std_auto_ptr.i.
+
+2022-08-01: wsfulton
+ [Python] Add initialisers for additional members in PyHeapTypeObject
+ (builtin mode) for Python-3.11 - _ht_tpname, _spec_cache.
+
+2022-07-30: wsfulton
+ C++20 has deprecated std::basic_string<>::reserve() and the C++11 method
+ std::basic_string<>::shrink_to_fit() is a replacement that can be used.
+ std_string.i and std_wstring.i provided wrappers for reserve with the following
+ template instantiations:
+
+ %template(string) std::basic_string;
+ %template(wstring) std::basic_string;
+
+ The reserve method is no longer wrapped, however the shrink_to_fit() method
+ can be used as an alternative from the target language (the generated wrappers
+ call reserve() instead if C++<=20).
+
+ Note that std::basic_string<>::reserve(size_t n) is still wrapped unchanged.
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2022-07-30: wsfulton
+ [Tcl] Add support for std::unique_ptr in std_unique_ptr.i.
+ Add support for std::auto_ptr in std_auto_ptr.i.
+
+2022-07-27: ZackerySpytz, olly
+ #1678 Support parsing C++20 templated lambdas.
+
+2022-07-27: ZackerySpytz, olly
+ #1622 Add support for the C++20 spaceship operator (<=>).
+
+2022-07-26: olly
+ [Tcl] https://sourceforge.net/p/swig/bugs/977/
+ Fix handling of long long on 32-bit platforms. This fix raises
+ SWIG's minimum supported Tcl version to 8.4.0 (which was released
+ just under 20 years ago).
+
+2022-07-26: olly
+ Fix incorrect operator precedence in preprocessor expressions.
+
+2022-07-25: olly
+ Support for C++14 binary integer literals in preprocessor expressions.
+
+2022-07-20: wsfulton
+ [C#, Java] Ensure the order of interfaces generated in proxy interfaces for the
+ %interface family of macros is the same as that parsed from the bases in C++.
+
+2022-07-20: jicks, Ingener74, olly
+ #422 [Python] Fix mishandling of a Python class inheriting from
+ multiple SWIG-wrapped director classes.
+
+2022-07-19: wsfulton
+ #692 [C#, Java, Perl, Python, Ruby] std::unique_ptr and std::auto_ptr typemaps
+ provided for inputs types in std_unique_ptr.i and std_auto_ptr.i.
+
+ Now these smart pointers can be used as input parameters to functions. A proxy
+ class instance transfers memory ownership of the underlying C++ object from the
+ proxy class to a smart pointer instance passed to the wrapped function.
+
+2022-07-19: jschueller
+ [Python] #2314 Drop support for Python 3.2.
+
+2022-07-19: olly
+ Remove remaining support code for classic macos, which has not been
+ supported by Apple for over 20 years now.
+
+2022-07-12: wsfulton
+ #999 Performance optimisation for parameters passed by value that are C++11 movable.
+ The C++ wrappers create a temporary variable for a parameter to be passed to a
+ function. This is initially default constructed and then copy assigned from the
+ instance being passed in from the target language. This is unchanged, however,
+ when the temporary variable is passed to the wrapped function, it is now done using
+ std::move. If the type is move constructible, the move constructor will be used
+ instead of the copy constructor.
+
+2022-07-12: wsfulton
+ [Perl] Add std::auto_ptr support in std_auto_ptr.i library file.
+
+2022-07-12: erezgeva
+ [Perl] Add std::unique_ptr support in std_unique_ptr.i library file.
+
+2022-07-07: jmarrec
+ #1158 #2286 Add basic support for C++11 attributes. These are now
+ crudely ignored by SWIG's parser's tokeniser, which is better than
+ failing with a parse error.
+
+2022-07-05: ianlancetaylor
+ [Go] #2245 Handle NULL pointers for string* conversions.
+ Rearrange generation of director methods and rename
+ receiver argument from p to swig_p.
+
+2022-07-03: wsfulton
+ #999 Performance optimisation for directors for classes passed by value. The directorin
+ typemaps in the director methods now use std::move on the input parameter when
+ copying the object from the stack to the heap prior to the callback into the target
+ language, thereby taking advantage of move semantics if available.
+
+2022-07-02: wsfulton
+ #1722 [C#, Java, Python, Ruby] Add std::unique_ptr support. Ported from std::auto_ptr.
+ Use the %unique_ptr(T) macro as follows for usage std::unique_ptr. For example, for
+ a class called Klass:
+
+ %include "std_unique_ptr.i"
+ %unique_ptr(Klass)
+
+ Support is currently limited to only returning a std::unique_ptr from a function.
+
+2022-06-29: wsfulton
+ #999 #1044 Enhance SWIGTYPE "out" typemaps to use std::move when copying
+ objects, thereby making use of move semantics when wrapping a function returning
+ by value if the returned type supports move semantics.
+
+ Wrapping functions that return move only types 'by value' now work out the box
+ without having to provide custom typemaps.
+
+ The implementation removed all casts in the "out" typemaps to allow the compiler to
+ appropriately choose calling a move constructor, where possible, otherwise a copy
+ constructor. The implementation also required modifying SwigValueWrapper to
+ change a cast operator from:
+
+ SwigValueWrapper::operator T&() const;
+
+ to
+
+ #if __cplusplus >=201103L
+ SwigValueWrapper::operator T&&() const;
+ #else
+ SwigValueWrapper::operator T&() const;
+ #endif
+
+ This is not backwards compatible for C++11 and later when using the valuewrapper feature
+ if a cast is explicitly being made in user supplied "out" typemaps. Suggested change
+ in custom "out" typemaps for C++11 and later code:
+
+ 1. Try remove the cast altogether to let the compiler use an appropriate implicit cast.
+ 2. Change the cast, for example, from static_cast to static_cast, using the
+ __cplusplus macro if all versions of C++ need to be supported.
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2022-06-15: wsfulton
+ #2039 Add move assignment operator to SwigValueWrapper used by the
+ valuewrapper feature.
+
+2022-06-04: sethrj
+ Enhance $typemap to support typemap attributes.
+
+ $typemap(method:attribute, typepattern)
+
+ For example:
+
+ %typemap(cstype, out="object") XClass "XClass"
+ %typemap(cscode) BarClass %{
+ $typemap(cstype:out, XClass) bar() {
+ return null;
+ }
+
+ which expands to
+
+ object bar() {
+ return null;
+ }
+
+2022-05-30: wsfulton
+ [C#, D] Add new special variable expansion: $imfuncname.
+ Expands to the function name called in the intermediary class.
+
+2022-05-30: LindleyF
+ [Java] #2042 Add new special variable expansion: $imfuncname.
+ Expands to the function name called in the intermediary class.
+
+2022-05-28: jkuebart
+ [Java] On some versions of Android, specifically Android 6,
+ detaching the current thread from the JVM after every invocation
+ causes a memory leak.
+
+ Offer SWIG_JAVA_DETACH_ON_THREAD_END to configure a behaviour
+ where the JVM is only detached in the thread destructor.
+
+ See https://developer.android.com/training/articles/perf-jni#threads.
+
+2022-05-27: xypron
+ [Python] #2277 Define PY_SSIZE_T_CLEAN macro before #include "Python.h" as
+ recommended in Python 3.7 and later.
+
+ To avoid this macro definition, add the following to your interface file so
+ that SWIG_NO_PY_SSIZE_T_CLEAN is defined at the beginning of the C++ wrappers:
+
+ %begin %{
+ #define SWIG_NO_PY_SSIZE_T_CLEAN
+ %}
+
+2022-05-26: rokups
+ [C#] #1323 Modify SwigDerivedClassHasMethod for a more efficient director
+ implementation when calling virtual methods that are not overridden.
+
+2022-05-15: erezgeva, eiselekd
+ [Lua, Perl, Octave, PHP, Tcl] #2275 #2276 #2283 Add argcargv.i library containing
+ (int ARGC, char **ARGV) multi-argument typemaps.
+
+ Document this library in Typemaps.html.
+
+2022-05-07: KrisThielemans
+ [Python] Fix "too many initializers for 'PyHeapTypeObject'" errors
+ using PyPy 3.8 and later.
+
+2022-05-04: wsfulton
+ [C#] Add C# wchar_t * director typemaps
+
+2022-04-20: cminyard
+ Fix an issue where newlines were not properly generated
+ for godirectorin typemaps. If you have a virtual function
+ not assigned to zero, in some cases it won't generate a
+ newline and you will see errors:
+ example.go:1508:3: expected ';', found swig_r
+ when compiling the go code.
+
+ Also add an example of using goin and godirectorin and add
+ a test for this situation.
+
+2022-04-29: jason-daly, JerryJoyce, wsfulton
+ [C#] #1233 Add wchar_t * and std::wstring Unicode string support on Linux.
+
+2022-04-11: robinst
+ #2257 Fix new Ruby 3.2 warning "undefining the allocator of T_DATA
+ class swig_runtime_data".
+
+2022-04-07: olly
+ #1750 SWIG now recognises and ignores Doxygen group commands `@{` and `@}`.
+
+2022-04-06: wsfulton
+ ./configure now enables C++11 and later C++ standards testing by default (when
+ running: 'make check').
+
+ The options to control this testing are the same:
+
+ ./configure --enable-cpp11-testing
+ ./configure --disable-cpp11-testing
+
+ But the former is now the default and the latter can be used to turn off C++11 and
+ later C++ standards testing.
+
+2022-04-06: wsfulton
+ [Python] #1635 The "autodoc" feature no longer overrides Doxygen comments
+ in the generated docstring.
+
+ If a "docstring" feature is present it will still override a Doxygen comment.
+ If the "autodoc" feature is also present, the combined "autodoc" and "docstring"
+ will override the Doxygen comment. If no "docstring" is present then the
+ "autodoc" feature will not be generated when there is a Doxygen comment.
+
+ This way the "autodoc" feature can be specified and used to provide documentation
+ for 'missing' Doxygen comments.
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2022-04-01: olly
+ Remove undocumented and non-functional -browse command line option.
+
+2022-03-26: eltoder
+ [Python] #1684 Use different capsule names with and without -builtin
+
+ Types generated with and without -builtin are not compatible. Mixing
+ them in a common type list leads to crashes. Avoid this by using
+ different capsule names: "type_pointer_capsule" without -builtin and
+ "type_pointer_capsule_builtin" with.
+
+2022-03-25: wsfulton
+ The debug command line options that display parse tree nodes
+ (-debug-module, -debug-top, -debug-symtabs) now display previously hidden
+ linked list pointers which are useful for debugging parse trees.
+
+ Added new command line option -debug-quiet. This suppresses the display
+ of most linked list pointers and symbol table pointers in the parse tree nodes.
+
+ The keys in the parse tree node are now shown in alphabetical order.
+
+2022-03-24: wsfulton
+ #2244 Fix using declaration in derived class bugs when all the base
+ class's overloaded methods were overridden in the derived class -
+ fixes "multiply defined" errors.
+
+2022-03-23: wsfulton
+ [Python] #1779 The -py3 option is deprecated and now has no effect on the
+ code generated. Use of this option results in a deprecated warning.
+ The related SWIGPYTHON_PY3 macro that this option defined is no longer generated.
+
+ Note that %pythonnondynamic feature generates a metaclass that works on both
+ Python 2 and Python 3.
+
+2022-03-21: wsfulton
+ [Python] #1779 pyabc.i for abstract base classes now supports versions of
+ Python prior to 3.3 by using the collection module for these older versions.
+ Python-3.3 and later continue to use the collections.abc module.
+ The -py3 option no longer has any effect on the %pythonabc feature.
+
+2022-03-21: jschueller, jim-easterbrook, wsfulton
+ [Python] #2137 C++ static member functions no longer generate a "flattened"
+ name in the Python module. For example:
+
+ s = example.Spam()
+ s.foo() # Spam::foo() via an instance
+ example.Spam.foo() # Spam::foo() using class method
+ example.Spam_foo() # Spam::foo() "flattened" name
+
+ The "flattened" name is no longer generated, but can be generated
+ by using the new -flatstaticmethod option.
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2022-03-18: ianlancetaylor
+ [Go] #337 Implement %extend base methods in child classes.
+
+2022-03-17: olly
+ [Python] #1779 SWIG's Python test-suite and examples are now
+ run with Python 3 by default. To run them with Python 2, set
+ PY2 to a non-empty value, e.g.:
+
+ make check-python-test-suite PY2=1
+
+2022-03-16: olly
+ [Go] #683 -intgosize is now optional - if not specified the
+ generated C/C++ wrapper code will use ptrdiff_t for intgo and
+ size_t for uintgo.
+
+2022-03-15: ianlancetaylor
+ [Go] Add typemaps for std::string*.
+
+2022-03-15: ianlancetaylor
+ [Go] Don't convert arrays to pointers if there is a "gotype"
+ typemap entry.
+
+2022-03-15: ianlancetaylor
+ [Go] Add documentation note about Go and C++ exceptions.
+
+2022-03-12: wsfulton
+ #1524 %interface family of macros no longer contain the getter/setter
+ methods for wrapping variables. The interface only contains
+ virtual and non-virtual instance methods, that is, no static methods.
+ Enums are also no longer added to the interface (affects Java only where
+ they were missing from the proxy class, C# never had them in the interface).
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2022-03-12: wsfulton
+ #1277 Fixes for the family of %interface macros, %interface,
+ %interface_impl and %interface_custom fixes for overloaded methods
+ in an inheritance chain.
+
+ When C++ methods are not able to be overloaded in a derived class,
+ such as when they differ by just const, or the target language
+ parameters types are identical even when the C++ parameter types
+ are different, SWIG will ignore one of the overloaded methods with
+ a warning. A %ignore is required to explicitly ignore one of the
+ overloaded methods to avoid the warning message. Methods added
+ in the derived classes due to one of the %interface macros are now
+ similarly ignored/not added to the derived class.
+
+ The methods added to the derived classes can now also be modified
+ via %feature and %rename.
+
+2022-03-08: ianlancetaylor
+ [Go] Treat a nil argument as a NULL pointer.
+
+2022-03-08: ianlancetaylor
+ [Go] Add documentation notes about thread local storage.
+
+2022-03-08: olly
+ #1006 SWIG now copes with an interface filename specified on the
+ command line which contains a closing parenthesis `)`, and more
+ generally with attributes to `%include` and `%import` which
+ are quoted and contain parentheses.
+
+2022-03-07: Omar Medina
+ [Tcl] https://sourceforge.net/p/swig/bugs/1290/
+ Fix SWIG_AsWCharPtrAndSize() to actually assign to result
+ variable. It looks like SWIG/Tcl wide character handling is
+ currently fundamentally broken except on systems which use wide
+ characters as the system encoding, but this should fix wrapping
+ functions which take a wide string as a parameter on Microsoft
+ Windows.
+
+2022-03-07: olly
+ [Javascript] #682 Fix handling of functions which take void*.
+
+2022-03-06: olly
+ SWIG should now reliably exit with status 0 if the run was
+ successful and status 1 if there was an error (or a warning and
+ -Werror was in effect).
+
+ Previously in some situations SWIG would try to exit with the
+ status set to the number of errors encountered, but that's
+ problematic - for example if there were 256 errors this would
+ result in exit status 0 on most platforms. Also some error
+ statuses have special meanings e.g. those defined by .
+ Also SWIG/Javascript tried to exit with status -1 in a few places
+ (which typically results in exit status 255).
+
+2022-03-05: wsfulton
+ #1441 Fix using declaration in derived class incorrectly introducing a method
+ from a base class when the using declaration is declared before the method
+ declaration. Problem occurred when within a namespace and the parameter types
+ in the method signatures were not fully qualified.
+
+2022-03-05: ianlancetaylor
+ [Go] Treat non-const references as pointers.
+
+2022-03-05: ianlancetaylor
+ In SWIG Go testsuite, fail test if "go build" fails.
+
+2022-03-03: olly
+ #1901 #2223 SWIG should now always exit cleanly if memory
+ allocation fails, including removing any output files created
+ during the current run.
+
+ Previously most places in the code didn't check for a NULL return
+ from malloc()/realloc()/calloc() at all, typically resulting in
+ undefined behaviour; some places used assert() to check for a NULL
+ return (which is a misuse of assert() and such checks disappear if
+ built with NDEBUG defined leaving us back with undefined
+ behaviour).
+
+2022-03-03: olly
+ #891 Report errors for typemap attributes without a value
+ (previously SWIG segfaulted) and for typemap types with a value
+ (previously the value was quietly ignored).
+
+ The old way of specifying a language name in the typemap attributes
+ is no longer supported (it has been deprecated for 16 years).
+
+2022-03-02: geographika, wsfulton
+ [Python] #1951 Add Python variable annotations support.
+
+ Both function annotations and variable annotations are turned on using the
+ "python:annotations" feature. Example:
+
+ %feature("python:annotations", "c");
+
+ struct V {
+ float val;
+ };
+
+ The generated code contains a variable annotation containing the C float type:
+
+ class V(object):
+ val: "float" = property(_example.V_val_get, _example.V_val_set)
+ ...
+
+ Python 3.5 and earlier do not support variable annotations, so variable
+ annotations can be turned off with a "python:annotations:novar" feature flag.
+ Example turning on function annotations but not variable annotations globally:
+
+ %feature("python:annotations", "c");
+ %feature("python:annotations:novar");
+
+ or via the command line:
+
+ -features python:annotations=c,python:annotations:novar
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2022-02-27: wsfulton
+ [Python] #735 #1561 Function annotations containing C/C++ types are no longer
+ generated when using the -py3 option. Function annotations support has been
+ moved to a feature to provide finer grained control. It can be turned on
+ globally by adding:
+
+ %feature("python:annotations", "c");
+
+ or by using the command line argument:
+
+ -features python:annotations=c
+
+ Also see entry dated 2022-03-02, regarding variable annotations.
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2022-02-26: wsfulton
+ #655 #1840 Add new warning WARN_LANG_USING_NAME_DIFFERENT to warn when a
+ method introduced by a using declaration in a derived class cannot
+ be used due to a conflict in names.
+
+2022-02-24: olly
+ #1465 An invalid preprocessor expression is reported as a pair of
+ warnings with the second giving a more detailed message from the
+ expression evaluator. Previously SWIG prefixed the second message
+ with "Error:" - that was confusing as it's actually only a warning
+ by default so we've now dropped this prefix.
+
+ Before:
+
+ x.i:1: Warning 202: Could not evaluate expression '1.2'
+ x.i:1: Warning 202: Error: 'Floating point constant in preprocessor expression'
+
+ Now:
+
+ x.i:1: Warning 202: Could not evaluate expression '1.2'
+ x.i:1: Warning 202: Floating point constant in preprocessor expression
+
+2022-02-23: olly
+ #1384 Fix a preprocessor expression evaluation bug. A
+ subexpression in parentheses lost its string/int type flag and
+ instead used whatever type was left in the stack entry from
+ previous use. In practice we mostly got away with this because
+ most preprocessor expressions are integer, but it could have
+ resulted in a preprocessor expression incorrectly evaluating as
+ zero. If -Wextra was in use you got a warning:
+
+ Warning 202: Error: 'Can't mix strings and integers in expression'
+
+2022-02-21: davidcl
+ [Scilab] Improve 5.5.2, 6.0.0 and 6.1.0 support.
+
+ For Scilab 5, long names are reduced to small names preserving the
+ class prefix and accessor suffix (get or set).
+
+ For Scilab 6, long names with the class prefix and accessor suffix
+ should be used on the user code.
+
+ The `-targetversion` option has been removed as the generated code
+ now detects the Scilab version in loader.sce or builder.sce.
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2022-02-20: wsfulton
+ Fix %warnfilter warning suppress for warning 315 SWIGWARN_PARSE_USING_UNDEF.
+
+2022-02-17: olly
+ [PHP] https://sourceforge.net/p/swig/bugs/1211/
+ Fix to call cleanup code in exception situations and not to invoke
+ the freearg typemap twice in certain situations.
+
+2022-02-15: olly
+ #300 #368 Improve parser handling of % followed immediately by
+ an identifier. If it's not a recognised directive the scanner
+ now emits MODULO and then rescans what follows, and if the parser
+ then gives a syntax error we report it as an unknown directive.
+ This means that `a%b` is now allowed in an expression, and that
+ things like `%std::vector` now give an error rather
+ than being quietly ignored.
+
+2022-02-11: adr26
+ [Python] #2154 Fix memory leak.
+
+ SWIG python objects were being freed after the corresponding SWIG
+ module information was destroyed in Python 3, causing leaks when as
+ a result the object destructor could not be invoked. To prevent this
+ misordering, SWIG python objects now obtain a reference to the
+ Python capsule wrapping the module information, so that the module
+ information is correctly destroyed after all SWIG python objects
+ have been freed (and corresponding destructors invoked).
+
+2022-02-10: olly
+ [Tcl] https://sourceforge.net/p/swig/bugs/1207/
+ https://sourceforge.net/p/swig/bugs/1213/
+
+ Fix Tcl generic input typemap for std::vector.
+
+2022-02-07: sethrj
+ #2196 Add alternative syntax for specifying fragments in typemaps.
+
+ New syntax:
+ %typemap("in", fragment="frag1", fragment="frag2", fragment="frag3") {...}
+ which is equivalent to:
+ %typemap(in, fragment="frag1,frag2,frag3") {...}
+
+
+2022-02-07: olly
+ #1806 Remove support for the "command" encoder, which was mostly
+ intended for use in `%rename` - most uses can be achieved using
+ the "regex" encoder, so we recommend using that instead.
+
+ The "command" encoder suffers from a number of issues - as the
+ documentation for it admitted, "[it] is extremely slow compared to
+ all the other [encoders] as it involves spawning a separate process
+ and using it for many declarations is not recommended" and that it
+ "should generally be avoided because of performance
+ considerations".
+
+ But it's also not portable. The design assumes that `/bin/sh`
+ supports `<<<` but that's a bash-specific feature so it doesn't
+ work on platforms where `/bin/sh` is not bash - it fails on
+ Debian, Ubuntu and probably some other Linux distros, plus most
+ non-Linux platforms. Microsoft Windows doesn't even have a
+ /bin/sh as standard.
+
+ Finally, no escaping of the passed string is done, so it has
+ potential security issues (though at least with %rename the input
+ is limited to valid C/C++ symbol names).
+
+2022-02-06: olly
+ #2193 -DFOO on the SWIG command line now sets FOO to 1 for
+ consistency with C/C++ compiler preprocessors. Previously
+ SWIG set FOO to an empty value.
+
+ Existing invocations of SWIG with `-DFOO` where the empty value
+ matters can be updated to `-DFOO=` which should work with both
+ old and new releases of SWIG.
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2022-02-06: sethrj
+ #2194 Classes that are non-assignable due to const data or const
+ reference members are now automatically detected.
+
+2022-02-04: friedrichatgc
+ [Octave] #1672 Fix for isobject for Octave 4.4 - 6.0.
+
+2022-02-03: olly
+ [C#] #283 #998 Fix memory leak in directorin typemap for
+ std::string.
+
+2022-02-03: olly
+ [Python] #967 Make `self` parameter available to user typemaps.
+
+2022-02-03: teythoon
+ [Python] #801 Fix -Wunused-parameter warnings with builtin,
+
+2022-02-03: teythoon
+ #801 Fix -Wstrict-prototypes warnings in generated pointer
+ functions.
+
+2022-02-03: olly
+ #660 https://sourceforge.net/p/swig/bugs/1081/
+ Default parameter values containing method calls are now parsed and
+ handled - e.g. `x->foo(3,4)` and `y.z()`.
+
+2022-02-02: olly
+ [Ruby] https://sourceforge.net/p/swig/bugs/1136/ Fix remove of prefix
+ from method name to only remove it at the start.
+
+2022-02-01: olly
+ #231 Handle returning an object by reference in a C++ trailing
+ return type.
+
+2022-02-01: davidcl
+ [Scilab] #745 use SWIG__Init() as a C module init function.
+
+2022-02-01: olly
+ [OCaml] #2083 Fix to work when CAML_SAFE_STRING is on, which it is
+ by default in recent Ocaml releases.
+
+2022-01-31: mreeez
+ https://sourceforge.net/p/swig/bugs/1147/
+ Fix copyToR() generated for a struct in a namespace.
+
+2022-01-29: fschlimb
+ #655 Better handling of using declarations.
+
+2022-01-29: dontpanic92
+ [Go] #676 Fix code generated for a C++ class with a non-capitalised
+ name.
+
+2022-01-26: trex58
+ #1919 #1921 #1923 Various fixes for AIX portability.
+
+2022-01-26: olly
+ #1935 Don't crash on an unclosed HTML tag in a doxygen comment
+ when -doxygen is specified.
+
+2022-01-25: olly
+ Constant expressions now support member access with `.` such as
+ `foo.bar`. Previous this only worked in a case like `x->foo.bar`.
+
+2022-01-25: olly
+ #2091 Support most cases of `sizeof` applied to an expression
+ in constant expressions. Previously there was only support for
+ `sizeof()` and expressions which syntactically look like a
+ type (such as `sizeof(foo)`).
+
+2022-01-25: olly
+ #80 #635 https://sourceforge.net/p/swig/bugs/1139/
+ Add support for parsing common cases of `<` and `>` comparisons
+ in constant expressions. Adding full support for these seems hard
+ to do without introducing conflicts into the parser grammar, but in
+ fact all reported cases have had parentheses around the comparison
+ and we can support that with a few restrictions on the left side of
+ `<`.
+
+2022-01-25: wsfulton
+ New warning 327 for extern templates, eg:
+
+ extern template class std::vector;
+ extern template void Func();
+
+ results in warning
+
+ example.i:3: Warning 327: Extern template ignored.
+ example.i:4: Warning 327: Extern template ignored.
+
+ Extern template classes previously resulted in warning 320.
+
+2022-01-24: romintomasetti
+ #2131 #2157 C++11 extern function template parsing error fix.
+
+2022-01-21: wsfulton
+ #2120 #2138 Replace legacy PCRE dependency with PCRE2.
+ This requires changes for building SWIG from source. See updated
+ html documentation in Preface.html and Windows.html. Updated
+ instructions are also shown when running ./configure if PCRE2 is not
+ found. Note that debian based systems can install PCRE2 using:
+
+ apt install libpcre2-dev
+
+ Note that https://github.com/swig/swig/wiki/Getting-Started also has
+ updated information for building from source.
+
+2022-01-19: olly
+ [PHP] #2027 Automatically generate PHP type declarations for PHP 8.
+ The generate code still compiles for PHP 7.x, but without type
+ declarations since PHP 7.x has much more limited type declaration
+ support.
+
+2022-01-18: olly
+ [Perl] #1629 Perl 5.8.0 is now the oldest version we aim to support.
+
+2022-01-14: wsfulton
+ [Python] Fix %callback and specifying the callback function as a
+ static member function using Python staticmethod syntax, such as
+ Klass.memberfunction instead of Klass_memberfunction when using
+ -builtin and -fastproxy.
+
+2022-01-11: wsfulton
+ [Python] Accept keyword arguments accessing static member functions when
+ using -builtin and kwargs feature and Python class staticmethod syntax.
+ The missing keyword argument support was only when using the
+ class staticmethod syntax, such as Klass.memberfunction, and not when
+ using the flat static method syntax, such as Klass_memberfunction.
+
+2022-01-04: juierror
+ [Go] #2045 Add support for std::array in std_array.i.
+
+2021-12-18: olly
+ [PHP] Add PHP keyword 'readonly' (added in 8.1) to the list SWIG
+ knows to automatically rename. This keyword is special in that PHP
+ allows it to be used as a function (or method) name.
+
+2021-12-07: vstinner
+ [Python] #2116 Python 3.11 support: use Py_SET_TYPE()
+
+2021-12-05: rwf1
+ [Octave] #2020 #1893 Add support for Octave 6 up to and including 6.4.
+ Also add support for compiling with -Bsymbolic which is used by default
+ by mkoctfile.
+
+2021-12-02: jsenn
+ [Python] #2102 Fixed crashes when using embedded Python interpreters.
+
+2021-11-12: wsfulton
+ [Javascript] v8 and node only. Fix mismatched new char[] and free()
+ when wrapping C code char arrays. Now calloc is now used instead of
+ new char[] in SWIG_AsCharPtrAndSize.
+
+2021-10-03: ajrh1
+ [Perl] #2074: Avoid -Wmisleading-indentation in generated code
+ when using gcc11.
+
+2021-10-03: jschueller
+ [CMake] #2065: Add option to enable or disable PCRE support.
+
+2021-09-16: ianlancetaylor
+ [Go] Improved _cgo_panic implementation.
+
+2021-09-16: ianlancetaylor
+ [Go] Don't use crosscall2 for panicking. Instead rely on documented
+ and exported interfaces.
+
+2021-09-14: ianlancetaylor
+ [Go] Remove -no-cgo option (long unsupported in Go)
+
+2021-05-04: olly
+ [PHP] #2014 Throw PHP exceptions instead of using PHP errors
+
+ PHP exceptions can be caught and handled if desired, but if they
+ aren't caught then PHP exits in much the same way as it does for a
+ PHP error.
+
+ In particular this means parameter type errors and some other cases
+ in SWIG-generated wrappers now throw a PHP exception, which matches
+ how PHP's native parameter handling deals with similar situations.
+
+ `SWIG_ErrorCode()`, `SWIG_ErrorMsg()`, `SWIG_FAIL()` and `goto thrown;`
+ are no longer supported (these are really all internal implementation
+ details and none are documented aside from brief mentions in CHANGES
+ for the first three). I wasn't able to find any uses in user interface
+ files at least in FOSS code via code search tools.
+
+ If you are using these:
+
+ Use `SWIG_PHP_Error(code,msg);` instead of `SWIG_ErrorCode(code);
+ SWIG_ErrorMsg(msg);` (which will throw a PHP exception in SWIG >= 4.1
+ and do the same as the individual calls in older SWIG).
+
+ `SWIG_FAIL();` and `goto thrown;` can typically be replaced with
+ `SWIG_fail;`. This will probably also work with older SWIG, but
+ please test with your wrappers if this is important to you.
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2021-05-17: adr26
+ [Python] #1985 Fix memory leaks:
+
+ 1. Python object references were being incorrectly retained by
+ SwigPyClientData, causing swig_varlink_dealloc() never to run / free
+ memory. SwigPyClientData_New() / SwigPyClientData_Del() were updated
+ to fix the object reference counting, causing swig_varlink_dealloc()
+ to run and the memory swig_varlink owns to be freed.
+
+ 2. SwigPyClientData itself was not freed by SwigPyClientData_Del(),
+ causing another heap leak. The required free() was added to
+ SwigPyClientData_Del()
+
+ 3. Fix reference counting/leak of python cached type query
+
+ 4. Fix reference counting/leak of SwigPyObject dict (-builtin)
+
+ 5. Python object reference counting fixes for out-of-memory
+ scenarios were added to: SWIG_Python_RaiseOrModifyTypeError(),
+ SWIG_Python_AppendOutput(), SwigPyClientData_New(),
+ SwigPyObject_get___dict__() and SwigPyObject_format()
+
+ 6. Add error handling for PyModule_AddObject() to
+ SWIG_Python_SetModule() (failure could be caused by OOM or a name
+ clash caused by malicious code)
+
+2021-05-13: olly
+ [UFFI] #2009 Remove code for Common Lisp UFFI. We dropped support
+ for it in SWIG 4.0.0 and nobody has stepped forward to revive it in
+ over 2 years.
+
+2021-05-13: olly
+ [S-EXP] #2009 Remove code for Common Lisp S-Exp. We dropped
+ support for it in SWIG 4.0.0 and nobody has stepped forward to
+ revive it in over 2 years.
+
+2021-05-13: olly
+ [Pike] #2009 Remove code for Pike. We dropped support for it in
+ SWIG 4.0.0 and nobody has stepped forward to revive it in over 2
+ years.
+
+2021-05-13: olly
+ [Modula3] #2009 Remove code for Modula3. We dropped support for it
+ in SWIG 4.0.0 and nobody has stepped forward to revive it in over 2
+ years.
+
+2021-05-13: olly
+ [CLISP] #2009 Remove code for GNU Common Lisp. We dropped support
+ for it in SWIG 4.0.0 and nobody has stepped forward to revive it in
+ over 2 years.
+
+2021-05-13: olly
+ [Chicken] #2009 Remove code for Chicken. We dropped support for it
+ in SWIG 4.0.0 and nobody has stepped forward to revive it in over 2
+ years.
+
+2021-05-13: olly
+ [Allegrocl] #2009 Remove code for Allegro Common Lisp. We dropped
+ support for it in SWIG 4.0.0 and nobody has stepped forward to
+ revive it in over 2 years.
+
+2021-05-04: olly
+ [PHP] #1982 #1457 https://sourceforge.net/p/swig/bugs/1339/
+ SWIG now only use PHP's C API to implement its wrappers, and no
+ longer generates PHP code to define classes. The wrappers should
+ be almost entirely compatible with those generated before, but
+ faster and without some previously hard-to-fix bugs.
+
+ The main notable difference is SWIG no longer generates a .php
+ wrapper at all by default (only if %pragma(php) code=... or
+ %pragma(php) include=... are specified in the interface file).
+ This also means you need to load the module via extension=...
+ in php.ini, rather than letting the dl() in the generated
+ .php wrapper load it (but dl() has only worked for command-line
+ PHP for some years now).
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2021-04-30: olly
+ #1984 Remove support for $source and $target.
+ These were officially deprecated in 2001, and attempts to use them have
+ resulted in a warning (including a pointer to what to update them to)
+ for most if not all of that time.
+
+2021-04-27: wsfulton
+ #1987 [Java] Fix %interface family of macros for returning by const
+ pointer reference.
+
+2021-04-19: olly
+ Fix use of uninitialised variable in the generated code for an
+ empty typecheck typemap, such as the dummy one we include for
+ std::initializer_list.
+
+2021-04-12: olly
+ #1777 [Python] Specifying -py3 now generates a check for Python
+ version >= 3.0.
+
+2021-03-26: olly
+ [PHP] Add PHP keywords 'fn' (added in 7.4) and 'match' (added in
+ 8.0) to the list SWIG knows to automatically rename.
+
+2021-03-23: wsfulton
+ #1942 [Python] Fix compilation error in wrappers when using -builtin
+ and wrapping varargs in constructors.
+
+2021-03-22: goto40
+ #1977 Fix handling of template template parameters.
+
+2021-03-21: olly
+ #1929, #1978 [PHP] Add support for PHP 8.
+
+2021-03-19: wsfulton
+ #1610 Remove -ansi from default compilation flags.
+
+2021-03-19: dot-asm
+ #1934 [Java] Clean up typemaps for long long arrays.
+
+2021-03-19: olly
+ #1527 [PHP] Improve PHP object creation in directorin case.
+ Reportedly the code we were using in this case gave segfaults in
+ PHP 7.2 and later - we've been unable to reproduce these, but the
+ new approach is also simpler and should be bit faster too.
+
+2021-03-18: olly
+ #1655 [PHP] Fix char* typecheck typemap to accept PHP Null like the
+ corresponding in typemap does.
+
+2021-03-18: olly
+ #1900, #1905 [PHP] Fix wrapping of overloaded directed methods with
+ non-void return.
+
+2021-03-11: murillo128
+ #1498 [Javascript] Support type conversion.
+
+2021-03-06: nshmyrev
+ #872 [Javascript] Various typemap issues in arrays_javascript.i fixed.
+
+2021-03-03: vaughamhong
+ #577 [Javascript] Implemented SetModule/GetModule for JSC to allow type sharing
+ across modules.
+
+2021-03-01: xantares, Oliver Buchtala, geographika
+ #1040 Add support for building SWIG with CMake. See documentation in Windows.html.
+
+2021-03-01: vadz
+ #1952 Fix incorrect warning "Unknown Doxygen command: ."
+
+2021-02-28: p2k
+ #969 [Javascript] v8/node - prevent crash calling a constructor without new keyword.
+
+2021-02-28: alecmev
+ #405 #1121 [Javascript] Fix OUTPUT typemaps on methods that don't return void.
+ The output value is appended to the return value.
+
+2021-02-26: murillo128, wsfulton
+ #1269 [Javascript] Fix handling of large positive unsigned long and
+ unsigned long long values.
+
+2021-02-24: tomleavy, yegorich, tungntpham
+ #1746 [Javascript] Add support for Node v12, v14 and v16.
+ SWIG support for Node is now for v6 and later only.
+
+2020-02-09: ZackerySpytz
+ #1872 Fix typos in attribute2ref macros.
+
+2020-10-10: wsfulton
+ [Javascript] Fix so that ccomplex.i interface to file can be used.
+
+2020-10-10: wsfulton
+ #252 complex can now be used as a C identifier and doesn't give a syntax error.
+
+2020-10-10: lpsinger
+ #1770 Correct C complex support.
+ _Complex is now parsed as a keyword rather than complex as per the C99 standard.
+ The complex macro is available in the ccomplex.i library file along with other
+ complex number handling provided by the complex.h header.
+
+2020-10-07: ZackerySpytz
+ [Python] #1812 Fix the error handling for the PyObject_GetBuffer() calls in
+ pybuffer.i.
+
+2020-10-07: treitmayr
+ #1824 Add missing space in director method declaration returning
+ const pointer.
+
+2020-10-07: adelva1984
+ #1859 Remove all (two) exceptions from SWIG executable.
+
+2020-09-25: wsfulton
+ [C#, Java] #1874 Add ability to change the modifiers for the interface
+ generated when using the %interface macros.
+
+ For C# use the 'csinterfacemodifiers' typemap.
+ For Java use the 'javainterfacemodifiers' typemap.
+
+ For example:
+
+ %typemap(csinterfacemodifiers) X "internal interface"
+
+2020-09-24: geefr
+ [C#] #1868 Fix wchar_t* csvarout typemap for member variable wrappers.
+
+2020-08-28: wsfulton
+ [Java] #1862 Fix crashes in swig_connect_director during director class construction
+ when using the director class from multiple threads - a race condition initialising
+ block scope static variables. The fix is guaranteed when using C++11, but most
+ compilers also fix it when using C++03/C++98.
+
+2020-08-16: wsfulton
+ [Python] Add missing initializer for member '_heaptypeobject::ht_module' when using
+ -builtin to complete Python 3.9 support.
+
+2020-08-16: wsfulton
+ [Python] Remove PyEval_InitThreads() call for Python 3.7 and later as Python calls
+ it automatically now. This removes a deprecation warning when using Python 3.9.
+
+2020-08-15: wsfulton
+ [Python] All Python examples and tests are written to be Python 2 and Python 3
+ compatible, removing the need for 2to3 to run the examples or test-suite.
+
+2020-08-13: wsfulton
+ [C#] Add support for void *VOID_INT_PTR for member variables.
+
+2020-07-29: chrisburr
+ #1843 [Python] Compilation error fix in SwigPyBuiltin_SetMetaType when using PyPy.
+
+2020-06-14: ZackerySpytz
+ #1642 #1809 Fix virtual comparison operators in director classes by removing an
+ incorrect space in the function name (for example, operator= = is now operator==).
+
Version 4.0.2 (8 Jun 2020)
==========================
@@ -27,7 +1376,7 @@ Version 4.0.2 (8 Jun 2020)
[D] #1593 Replace broken imports when using newer versions of D.
2020-05-29: ZackerySpytz
- [Python] #1716 Performance improvements converting strings when using Python >= 3.3.
+ [Python] #1716 Performance improvements when converting strings when using Python >= 3.3.
2020-05-28: ZackerySpytz
#1776 Quite dramatically decrease run times when generating very large interface files by changing
@@ -74,8 +1423,8 @@ Version 4.0.2 (8 Jun 2020)
[Ruby] #1651 Add std::auto_ptr<> typemaps.
2020-01-31: ZackerySpytz
- [Python] #1700 More robust error checking for failures in calls to Python C API:
- PyBytes_AsStringAndSize() and PyString_AsStringAndSize().
+ [Python] #1700 The Python C API functions PyBytes_AsStringAndSize() and
+ PyString_AsStringAndSize() are now checked for failure.
2020-01-31: vadz
[Python] #1710 Fix crash parsing empty docstrings.
@@ -115,7 +1464,7 @@ Version 4.0.2 (8 Jun 2020)
2020-01-13: wsfulton
[Python] #1595 Python -builtin constructors silently ignored keyword arguments.
- Instead of silenty ignoring them, now a "TypeError: f() takes no keyword arguments"
+ Instead of silently ignoring them, now a "TypeError: f() takes no keyword arguments"
exception is thrown if keyword arguments are used. Hence constructors and normal methods/
functions behave in the same way. Note, -keyword should be used with -builtin to obtain
keyword argument support.
@@ -200,7 +1549,7 @@ Version 4.0.1 (21 Aug 2019)
VectorOverload(std::vector< Number,std::allocator< Number > >)
VectorOverload(std::vector< int,std::allocator< int > >)
- The problem was due to some error handling that was not cleared during typehecking.
+ The problem was due to some error handling that was not cleared during typechecking.
In this case an error was not cleared when the elements in the list failed the
typecheck for converting to X. Only occurs in Python 3+.
@@ -289,6 +1638,7 @@ Version 4.0.1 (21 Aug 2019)
2019-05-22: ferdynator
[PHP] #1528 Don't add a closing '?>' PHP tag to generated files.
PSR-2 says it MUST be omitted for files containing only PHP.
+
Version 4.0.0 (27 Apr 2019)
===========================
@@ -3302,7 +4652,7 @@ Version 3.0.0 (16 Mar 2014)
project has been further extended. The C++11 support is comprehensive, but by no means complete
or without limitations. Full details for each new feature in C++11 is covered in the
CPlusPlus11.html chapter in the documentation which is included in SWIG and also available
- online at http://www.swig.org/Doc3.0/CPlusPlus11.html.
+ online at https://www.swig.org/Doc3.0/CPlusPlus11.html.
2014-03-14: v-for-vandal
[Lua] Numerous Lua improvements:
@@ -5784,7 +7134,7 @@ Version 2.0.0 (2 June 2010)
2010-02-27: wsfulton
License code changes: SWIG Source is GPL-v3 and library code license is now clearer
- and is provided under a very permissive license. See http://www.swig.org/legal.html.
+ and is provided under a very permissive license. See https://www.swig.org/legal.html.
2010-02-13: wsfulton
[Ruby] A few fixes for compiling under ruby-1.9.x including patch from 'Nibble'.
diff --git a/CHANGES.current b/CHANGES.current
index 6fe039d30..2c9c85330 100644
--- a/CHANGES.current
+++ b/CHANGES.current
@@ -4,1101 +4,183 @@ 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.1.0 (in progress)
+Version 4.2.0 (in progress)
===========================
-2022-09-17: wsfulton
- Add missing typecheck typemaps for std::auto_ptr and std::unique_ptr to
- fix overloading when using these types.
-
-2022-09-17: wsfulton
- [Guile] Add error checking to SWIGTYPE and SWIGTYPE & in typemaps to prevent
- seg faults when passing #nil to these parameter types.
-
-2022-09-16: wsfulton
- #999 Provide SWIGTYPE MOVE typemaps in swigmove.i for implementing full
- move semantics when passing parameters by value.
-
-2022-08-31: wsfulton
- #999 Improve move semantics when using rvalue references.
- The SWIGTYPE && input typemaps now assume the object has been moved.
-
- These typemaps have been changed assuming that after the function call,
- the rvalue reference parameter has been moved. The parameter's proxy class
- that owns the C++ object thus has the underlying pointer set to null
- so that the (moved from, but still valid) C++ object cannot be used again
- and the the object is additionally deleted.
-
- *** POTENTIAL INCOMPATIBILITY ***
-
-2022-08-28: wsfulton
- [Octave] SWIG now marshalls a C/C++ NULL pointer into the null matrix, [].
- SWIG has always marshalled the null matrix into a NULL pointer; this remains
- and now we have consistency in representing a NULL pointer.
-
-2022-08-26: wsfulton
- [Racket] SWIG now marshalls a C/C++ NULL pointer into a null value by calling
- scheme_make_null(), so that scheme's null? is true for a NULL C/C++ pointer value.
-
-2022-08-18: wsfulton
- [Racket] Add support for std::unique_ptr in std_unique_ptr.i.
- Add support for std::auto_ptr in std_auto_ptr.i.
-
-2022-08-13: wsfulton
- [Guile] Add support for std::unique_ptr in std_unique_ptr.i.
- Add support for std::auto_ptr in std_auto_ptr.i.
-
-2022-08-11: wsfulton
- [Lua] Add support for std::unique_ptr in std_unique_ptr.i.
- Add support for std::auto_ptr in std_auto_ptr.i.
-
-2022-08-05: wsfulton
- [D] Fix occasional undefined behaviour with inheritance hierarchies, particularly
- when using virtual inheritance as the pointers weren't correctly upcast from derived
- class to base class when stored in the base's proxy class.
-
-2022-08-05: wsfulton
- [D] Add support for std::unique_ptr in std_unique_ptr.i.
- Add support for std::auto_ptr in std_auto_ptr.i.
-
-2022-08-03: wsfulton
- [Javascript] Add support for std::unique_ptr in std_unique_ptr.i.
- Add support for std::auto_ptr in std_auto_ptr.i.
-
-2022-08-02: wsfulton
- [Octave] Add support for std::unique_ptr in std_unique_ptr.i.
- Add support for std::auto_ptr in std_auto_ptr.i.
-
-2022-08-01: wsfulton
- [Python] Add initialisers for additional members in PyHeapTypeObject
- (builtin mode) for Python-3.11 - _ht_tpname, _spec_cache.
-
-2022-07-30: wsfulton
- C++20 has deprecated std::basic_string<>::reserve() and the C++11 method
- std::basic_string<>::shrink_to_fit() is a replacement that can be used.
- std_string.i and std_wstring.i provided wrappers for reserve with the following
- template instantiations:
-
- %template(string) std::basic_string;
- %template(wstring) std::basic_string;
-
- The reserve method is no longer wrapped, however the shrink_to_fit() method
- can be used as an alternative from the target language (the generated wrappers
- call reserve() instead if C++<=20).
-
- Note that std::basic_string<>::reserve(size_t n) is still wrapped unchanged.
-
- *** POTENTIAL INCOMPATIBILITY ***
-
-2022-07-30: wsfulton
- [Tcl] Add support for std::unique_ptr in std_unique_ptr.i.
- Add support for std::auto_ptr in std_auto_ptr.i.
-
-2022-07-27: ZackerySpytz, olly
- #1678 Support parsing C++20 templated lambdas.
-
-2022-07-27: ZackerySpytz, olly
- #1622 Add support for the C++20 spaceship operator (<=>).
-
-2022-07-26: olly
- [Tcl] https://sourceforge.net/p/swig/bugs/977/
- Fix handling of long long on 32-bit platforms. This fix raises
- SWIG's minimum supported Tcl version to 8.4.0 (which was released
- just under 20 years ago).
-
-2022-07-26: olly
- Fix incorrect operator precedence in preprocessor expressions.
-
-2022-07-25: olly
- Support for C++14 binary integer literals in preprocessor expressions.
-
-2022-07-20: wsfulton
- [C#, Java] Ensure the order of interfaces generated in proxy interfaces for the
- %interface family of macros is the same as that parsed from the bases in C++.
-
-2022-07-20: jicks, Ingener74, olly
- #422 [Python] Fix mishandling of a Python class inheriting from
- multiple SWIG-wrapped director classes.
-
-2022-07-19: wsfulton
- #692 [C#, Java, Perl, Python, Ruby] std::unique_ptr and std::auto_ptr typemaps
- provided for inputs types in std_unique_ptr.i and std_auto_ptr.i.
-
- Now these smart pointers can be used as input parameters to functions. A proxy
- class instance transfers memory ownership of the underlying C++ object from the
- proxy class to a smart pointer instance passed to the wrapped function.
-
-2022-07-19: jschueller
- [Python] #2314 Drop support for Python 3.2.
-
-2022-07-19: olly
- Remove remaining support code for classic macos, which has not been
- supported by Apple for over 20 years now.
-
-2022-07-12: wsfulton
- #999 Performance optimisation for parameters passed by value that are C++11 movable.
- The C++ wrappers create a temporary variable for a parameter to be passed to a
- function. This is initially default constructed and then copy assigned from the
- instance being passed in from the target language. This is unchanged, however,
- when the temporary variable is passed to the wrapped function, it is now done using
- std::move. If the type is move constructible, the move constructor will be used
- instead of the copy constructor.
-
-2022-07-12: wsfulton
- [Perl] Add std::auto_ptr support in std_auto_ptr.i library file.
-
-2022-07-12: erezgeva
- [Perl] Add std::unique_ptr support in std_unique_ptr.i library file.
-
-2022-07-07: olly
- [xml] #2213 XML has been moved to "Experimental" target language
- status. It's not in good shape and is likely to be removed unless
- somebody steps up to bring it up to the expected standard (it fails
- to even meet the criteria for "Experimental" currently).
-
-2022-07-07: jmarrec
- #1158 #2286 Add basic support for C++11 attributes. These are now
- crudely ignored by SWIG's parser's tokeniser, which is better that
- failing with a parse error.
-
-2022-07-05: ianlancetaylor
- [Go] #2245 Handle NULL pointers for string* conversions.
- Rearrange generation of director methods and rename
- receiver argument from p to swig_p.
-
-2022-07-03: wsfulton
- #999 Performance optimisation for directors for classes passed by value. The directorin
- typemaps in the director methods now use std::move on the input parameter when
- copying the object from the stack to the heap prior to the callback into the target
- language, thereby taking advantage of move semantics if available.
-
-2022-07-02: wsfulton
- #1722 [C#, Java, Python, Ruby] Add std::unique_ptr support. Ported from std::auto_ptr.
- Use the %unique_ptr(T) macro as follows for usage std::unique_ptr. For example, for
- a class called Klass:
-
- %include "std_unique_ptr.i"
- %unique_ptr(Klass)
-
- Support is currently limited to only returning a std::unique_ptr from a function.
-
-2022-06-29: wsfulton
- #999 #1044 Enhance SWIGTYPE "out" typemaps to use std::move when copying
- objects, thereby making use of move semantics when wrapping a function returning
- by value if the returned type supports move semantics.
-
- Wrapping functions that return move only types 'by value' now work out the box
- without having to provide custom typemaps.
-
- The implementation removed all casts in the "out" typemaps to allow the compiler to
- appropriately choose calling a move constructor, where possible, otherwise a copy
- constructor. The implementation also required modifying SwigValueWrapper to
- change a cast operator from:
-
- SwigValueWrapper::operator T&() const;
-
- to
-
- #if __cplusplus >=201103L
- SwigValueWrapper::operator T&&() const;
- #else
- SwigValueWrapper::operator T&() const;
- #endif
-
- This is not backwards compatible for C++11 and later when using the valuewrapper feature
- if a cast is explicitly being made in user supplied "out" typemaps. Suggested change
- in custom "out" typemaps for C++11 and later code:
-
- 1. Try remove the cast altogether to let the compiler use an appropriate implicit cast.
- 2. Change the cast, for example, from static_cast to static_cast, using the
- __cplusplus macro if all versions of C++ need to be supported.
-
- *** POTENTIAL INCOMPATIBILITY ***
-
-2022-06-15: wsfulton
- #2039 Add move assignment operator to SwigValueWrapper used by the
- valuewrapper feature.
-
-2022-06-04: sethrj
- Enhance $typemap to support typemap attributes.
-
- $typemap(method:attribute, typepattern)
-
- For example:
-
- %typemap(cstype, out="object") XClass "XClass"
- %typemap(cscode) BarClass %{
- $typemap(cstype:out, XClass) bar() {
- return null;
- }
-
- which expands to
-
- object bar() {
- return null;
- }
-
-2022-05-30: wsfulton
- [C#, D] Add new special variable expansion: $imfuncname.
- Expands to the function name called in the intermediary class.
-
-2022-05-30: LindleyF
- [Java] #2042 Add new special variable expansion: $imfuncname.
- Expands to the function name called in the intermediary class.
-
-2022-05-28: jkuebart
- [Java] On some versions of Android, specifically Android 6,
- detaching the current thread from the JVM after every invocation
- causes a memory leak.
-
- Offer SWIG_JAVA_DETACH_ON_THREAD_END to configure a behaviour
- where the JVM is only detached in the thread destructor.
-
- See https://developer.android.com/training/articles/perf-jni#threads.
-
-2022-05-27: xypron
- [Python] #2277 Define PY_SSIZE_T_CLEAN macro before #include "Python.h" as
- recommended in Python 3.7 and later.
-
- To avoid this macro definition, add the following to your interface file so
- that SWIG_NO_PY_SSIZE_T_CLEAN is defined at the beginning of the C++ wrappers:
-
- %begin %{
- #define SWIG_NO_PY_SSIZE_T_CLEAN
- %}
-
-2022-05-26: rokups
- [C#] #1323 Modify SwigDerivedClassHasMethod for a more efficient director
- implementation when calling virtual methods that are not overridden.
-
-2022-05-15: erezgeva, eiselekd
- [Lua, Perl, Octave, PHP, Tcl] #2275 #2276 #2283 Add argcargv.i library containing
- (int ARGC, char **ARGV) multi-argument typemaps.
-
- Document this library in Typemaps.html.
-
-2022-05-07: KrisThielemans
- [Python] Fix "too many initializers for 'PyHeapTypeObject'" errors
- using PyPy 3.8 and later.
-
-2022-05-04: wsfulton
- [C#] Add C# wchar_t * director typemaps
-
-2022-04-20: cminyard
- Fix an issue where newlines were not properly generated
- for godirectorin typemaps. If you have a virtual function
- not assigned to zero, in some cases it won't generate a
- newline and you will see errors:
- example.go:1508:3: expected ';', found swig_r
- when compiling the go code.
-
- Also add an example of using goin and godirectorin and add
- a test for this situation.
-
-2022-04-29: jason-daly, JerryJoyce, wsfulton
- [C#] #1233 Add wchar_t * and std::wstring Unicode string support on Linux.
-
-2022-04-11: robinst
- #2257 Fix new Ruby 3.2 warning "undefining the allocator of T_DATA
- class swig_runtime_data".
-
-2022-04-07: olly
- #1750 SWIG now recognises and ignores Doxygen group commands `@{` and `@}`.
-
-2022-04-06: wsfulton
- ./configure now enables C++11 and later C++ standards testing by default (when
- running: 'make check').
-
- The options to control this testing are the same:
-
- ./configure --enable-cpp11-testing
- ./configure --disable-cpp11-testing
-
- But the former is now the default and the latter can be used to turn off C++11 and
- later C++ standards testing.
-
-2022-04-06: wsfulton
- [Python] #1635 The "autodoc" feature no longer overrides Doxygen comments
- in the generated docstring.
-
- If a "docstring" feature is present it will still override a Doxygen comment.
- If the "autodoc" feature is also present, the combined "autodoc" and "docstring"
- will override the Doxygen comment. If no "docstring" is present then the
- "autodoc" feature will not be generated when there is a Doxygen comment.
-
- This way the "autodoc" feature can be specified and used to provide documentation
- for 'missing' Doxygen comments.
-
- *** POTENTIAL INCOMPATIBILITY ***
-
-2022-04-01: olly
- Remove undocumented and non-functional -browse command line option.
-
-2022-03-26: eltoder
- [Python] #1684 Use different capsule names with and without -builtin
-
- Types generated with and without -builtin are not compatible. Mixing
- them in a common type list leads to crashes. Avoid this by using
- different capsule names: "type_pointer_capsule" without -builtin and
- "type_pointer_capsule_builtin" with.
-
-2022-03-25: wsfulton
- The debug command line options that display parse tree nodes
- (-debug-module, -debug-top, -debug-symtabs) now display previously hidden
- linked list pointers which are useful for debugging parse trees.
-
- Added new command line option -debug-quiet. This suppresses the display
- of most linked list pointers and symbol table pointers in the parse tree nodes.
-
- The keys in the parse tree node are now shown in alphabetical order.
-
-2022-03-24: wsfulton
- #2244 Fix using declaration in derived class bugs when all the base
- class's overloaded methods were overridden in the derived class -
- fixes "multiply defined" errors.
-
-2022-03-23: wsfulton
- [Python] #1779 The -py3 option is deprecated and now has no effect on the
- code generated. Use of this option results in a deprecated warning.
- The related SWIGPYTHON_PY3 macro that this option defined is no longer generated.
-
- Note that %pythonnondynamic feature generates a metaclass that works on both
- Python 2 and Python 3.
-
-2022-03-21: wsfulton
- [Python] #1779 pyabc.i for abstract base classes now supports versions of
- Python prior to 3.3 by using the collection module for these older versions.
- Python-3.3 and later continue to use the collections.abc module.
- The -py3 option no longer has any effect on the %pythonabc feature.
-
-2022-03-21: jschueller, jim-easterbrook, wsfulton
- [Python] #2137 C++ static member functions no longer generate a "flattened"
- name in the Python module. For example:
-
- s = example.Spam()
- s.foo() # Spam::foo() via an instance
- example.Spam.foo() # Spam::foo() using class method
- example.Spam_foo() # Spam::foo() "flattened" name
-
- The "flattened" name is no longer generated, but can be generated
- by using the new -flatstaticmethod option.
-
- *** POTENTIAL INCOMPATIBILITY ***
-
-2022-03-18: ianlancetaylor
- [Go] #337 Implement %extend base methods in child classes.
-
-2022-03-17: olly
- [Python] #1779 SWIG's Python test-suite and examples are now
- run with Python 3 by default. To run them with Python 2, set
- PY2 to a non-empty value, e.g.:
-
- make check-python-test-suite PY2=1
-
-2022-03-16: olly
- [Go] #683 -intgosize is now optional - if not specified the
- generated C/C++ wrapper code will use ptrdiff_t for intgo and
- size_t for uintgo.
-
-2022-03-15: ianlancetaylor
- [Go] Add typemaps for std::string*.
-
-2022-03-15: ianlancetaylor
- [Go] Don't convert arrays to pointers if there is a "gotype"
- typemap entry.
-
-2022-03-15: ianlancetaylor
- [Go] Add documentation note about Go and C++ exceptions.
-
-2022-03-12: wsfulton
- #1524 %interface family of macros no longer contain the getter/setter
- methods for wrapping variables. The interface only contains
- virtual and non-virtual instance methods, that is, no static methods.
- Enums are also no longer added to the interface (affects Java only where
- they were missing from the proxy class, C# never had them in the interface).
-
- *** POTENTIAL INCOMPATIBILITY ***
-
-2022-03-12: wsfulton
- #1277 Fixes for the family of %interface macros, %interface,
- %interface_impl and %interface_custom fixes for overloaded methods
- in an inheritance chain.
-
- When C++ methods are not able to be overloaded in a derived class,
- such as when they differ by just const, or the target language
- parameters types are identical even when the C++ parameter types
- are different, SWIG will ignore one of the overloaded methods with
- a warning. A %ignore is required to explicitly ignore one of the
- overloaded methods to avoid the warning message. Methods added
- in the derived classes due to one of the %interface macros are now
- similarly ignored/not added to the derived class.
-
- The methods added to the derived classes can now also be modified
- via %feature and %rename.
-
-2022-03-08: ianlancetaylor
- [Go] Treat a nil argument as a NULL pointer.
-
-2022-03-08: ianlancetaylor
- [Go] Add documentation notes about thread local storage.
-
-2022-03-08: olly
- #1006 SWIG now copes with an interface filename specified on the
- command line which contains a closing parenthesis `)`, and more
- generally with attributes to `%include` and `%import` which
- are quoted and contain parentheses.
-
-2022-03-07: Omar Medina
- [Tcl] https://sourceforge.net/p/swig/bugs/1290/
- Fix SWIG_AsWCharPtrAndSize() to actually assign to result
- variable. It looks like SWIG/Tcl wide character handling is
- currently fundamentally broken except on systems which use wide
- characters as the system encoding, but this should fix wrapping
- functions which take a wide string as a parameter on Microsoft
- Windows.
-
-2022-03-07: olly
- [Javascript] #682 Fix handling of functions which take void*.
-
-2022-03-06: olly
- SWIG should now reliably exit with status 0 if the run was
- successful and status 1 if there was an error (or a warning and
- -Werror was in effect).
-
- Previously in some situations SWIG would try to exit with the
- status set to the number of errors encountered, but that's
- problematic - for example if there were 256 errors this would
- result in exit status 0 on most platforms. Also some error
- statuses have special meanings e.g. those defined by .
- Also SWIG/Javascript tried to exit with status -1 in a few places
- (which typically results in exit status 255).
-
-2022-03-05: wsfulton
- #1441 Fix using declaration in derived class incorrectly introducing a method
- from a base class when the using declaration is declared before the method
- declaration. Problem occurred when within a namespace and the parameter types
- in the method signatures were not fully qualified.
-2022-03-05: ianlancetaylor
- [Go] Treat non-const references as pointers.
-
-2022-03-05: ianlancetaylor
- In SWIG Go testsuite, fail test if "go build" fails.
-
-2022-03-03: olly
- #1901 #2223 SWIG should now always exit cleanly if memory
- allocation fails, including removing any output files created
- during the current run.
-
- Previously most places in the code didn't check for a NULL return
- from malloc()/realloc()/calloc() at all, typically resulting in
- undefined behaviour; some places used assert() to check for a NULL
- return (which is a misuse of assert() and such checks disappear if
- built with NDEBUG defined leaving us back with undefined
- behaviour).
-
-2022-03-03: olly
- #891 Report errors for typemap attributes without a value
- (previously SWIG segfaulted) and for typemap types with a value
- (previously the value was quietly ignored).
-
- The old way of specifying a language name in the typemap attributes
- is no longer supported (it has been deprecated for 16 years).
-
-2022-03-02: geographika, wsfulton
- [Python] #1951 Add Python variable annotations support.
-
- Both function annotations and variable annotations are turned on using the
- "python:annotations" feature. Example:
-
- %feature("python:annotations", "c");
-
- struct V {
- float val;
+2023-02-15: wsfulton
+ #1300 Further partial template specialization fixes.
+ Fixes when templates are used as a template parameter in a partially specialized
+ instantiation such as:
+
+ template struct Vect {};
+ template class Foo { ... };
+ template class Foo, TTS> { ... };
+ %template(VectInt) Vect;
+ %template(FooVectIntDouble) Foo, double>; // was previously attempting to use primary template
+
+ Also fixes partial specialization where the same template parameter name is used twice,
+ for example:
+
+ template struct H { ... };
+ template struct H { ... };
+ %template(HInts) H; // was previously attempting to use primary template
+
+2023-01-27: jschueller
+ #2492 [python] Fix unused parameter warnings for self parameter in
+ generated C/C++ wrapper code.
+
+2023-01-14: wsfulton
+ Fix deduction of partially specialized template parameters when the specialized
+ parameter is non-trivial, used in a wrapped method and the type to %template uses
+ typedefs. For example:
+
+ typedef double & DoubleRef;
+ template struct XX {};
+ template struct XX { void fn(T t) {} };
+ %template(XXD) XX;
+
+ The type of the parameter in the instantiated template for fn is now correctly deduced
+ as double.
+
+2023-01-03: wsfulton
+ #983 Fix seg fault when instantiating templates with parameters that are function
+ parameters containing templates, such as:
+
+ %template(MyC) C)>;
+
+2023-01-03: wsfulton
+ Complete support for C++11 variadic function templates. Support was previously limited
+ to just one template parameter. Now zero or more template parameters are supported
+ in the %template instantiation.
+
+2022-12-29: wsfulton
+ #1863 Syntax error fixes parsing more elaborate parameter pack arguments that are
+ used in function pointers, member function pointers:
+
+ template struct VariadicParms {
+ void ParmsFuncPtrPtr(int (*)(V*...)) {}
+ void ParmsFuncPtrPtrRef(int (*)(V*&...)) {}
+ void ParmsFuncPtrPtrRValueRef(int (*)(V*&&...)) {}
+ void ParmsFuncPtrRef(int (*)(V&...)) {}
+ void ParmsFuncPtrRValueRef(int (*)(V&&...)) {}
+
+ void ParmsMemFuncPtrPtr(int (KlassMemFuncs::*)(V*...)) {}
+ void ParmsMemFuncPtrPtrRef(int (KlassMemFuncs::*)(V*&...)) {}
+ void ParmsMemFuncPtrPtrRValueRef(int (KlassMemFuncs::*)(V*&&...)) {}
+ void ParmsMemFuncPtrRef(int (KlassMemFuncs::*)(V&...)) {}
+ void ParmsMemFuncPtrRValueRef(int (KlassMemFuncs::*)(V&&...)) {}
};
- The generated code contains a variable annotation containing the C float type:
+ %template(VariadicParms0) VariadicParms<>;
+ %template(VariadicParms1) VariadicParms;
- class V(object):
- val: "float" = property(_example.V_val_get, _example.V_val_set)
- ...
+ Also in various other places such as within noexcept specifiers:
- Python 3.5 and earlier do not support variable annotations, so variable
- annotations can be turned off with a "python:annotations:novar" feature flag.
- Example turning on function annotations but not variable annotations globally:
+ template
+ void emplace(Args &&... args) noexcept(
+ std::is_nothrow_constructible::value);
- %feature("python:annotations", "c");
- %feature("python:annotations:novar");
+2022-12-27: wsfulton
+ Fix instantiation of variadic class templates containing parameter pack arguments that
+ are function pointers.
- or via the command line:
+ template struct VariadicParms {
+ void ParmsFuncPtrVal(int (*)(V...)) {}
+ };
- -features python:annotations=c,python:annotations:novar
+ %template(VariadicParms0) VariadicParms<>;
+ %template(VariadicParms1) VariadicParms;
- *** POTENTIAL INCOMPATIBILITY ***
+2022-12-23: wsfulton
+ #1863 Fix syntax error parsing variadic templates containing parameter pack arguments that
+ are function pointers.
-2022-02-27: wsfulton
- [Python] #735 #1561 Function annotations containing C/C++ types are no longer
- generated when using the -py3 option. Function annotations support has been
- moved to a feature to provide finer grained control. It can be turned on
- globally by adding:
+2022-12-22: wsfulton
+ Complete support for C++11 variadic class templates. Support was previously limited
+ to just one template parameter. Now zero or more template parameters are supported.
- %feature("python:annotations", "c");
+2022-12-06: wsfulton
+ #1636 Fix syntax error for misplaced Doxygen comment after struct/class member.
+ Fix syntax error using Doxygen member groups syntax, "///*}", when used after
+ final struct/class member.
- or by using the command line argument:
+2022-12-05: wsfulton
+ #2023 Fix garbled Doxygen post comments in parameter lists.
+ Fix syntax error parsing a trailing Doxygen comment in parameter lists.
- -features python:annotations=c
+2022-12-03: wsfulton
+ #1609 Fix syntax error parsing of Doxygen comments after last enum item.
- Also see entry dated 2022-03-02, regarding variable annotations.
+2022-12-03: wsfulton
+ #1715 Fix syntax error parsing of unconventionally placed Doxygen post
+ comments for enum items.
- *** POTENTIAL INCOMPATIBILITY ***
+2022-12-02: wsfulton
+ #624 #1021 Improved template template parameters support. Previously, specifying more
+ than one simple template template parameter resulted in a parse error. Now
+ multiple template template parameters are working including instantiation with
+ %template. Example:
-2022-02-26: wsfulton
- #655 #1840 Add new warning WARN_LANG_USING_NAME_DIFFERENT to warn when a
- method introduced by a using declaration in a derived class cannot
- be used due to a conflict in names.
+ template class, class> class Op, template class X, class Y>
+ class C { ... };
-2022-02-24: olly
- #1465 An invalid preprocessor expression is reported as a pair of
- warnings with the second giving a more detailed message from the
- expression evaluator. Previously SWIG prefixed the second message
- with "Error:" - that was confusing as it's actually only a warning
- by default so we've now dropped this prefix.
+2022-11-26: wsfulton
+ #1589 #1590 Slightly better decltype() support for expressions, such as:
- Before:
+ int i,j;
+ ... decltype(i+j) ...
+ ... decltype(&i) ...
- x.i:1: Warning 202: Could not evaluate expression '1.2'
- x.i:1: Warning 202: Error: 'Floating point constant in preprocessor expression'
+ These result in a warning for non-trivial expressions which SWIG cannot evaluate:
- Now:
+ Warning 344: Unable to deduce decltype for 'i+j'.
- x.i:1: Warning 202: Could not evaluate expression '1.2'
- x.i:1: Warning 202: Floating point constant in preprocessor expression
+ See 'Type Inference' in CPlusPlus.html for workarounds.
-2022-02-23: olly
- #1384 Fix a preprocessor expression evaluation bug. A
- subexpression in parentheses lost its string/int type flag and
- instead used whatever type was left in the stack entry from
- previous use. In practice we mostly got away with this because
- most preprocessor expressions are integer, but it could have
- resulted in a preprocessor expression incorrectly evaluating as
- zero. If -Wextra was in use you got a warning:
+2022-11-22: wsfulton
+ #1037 Fix seg fault handling template parameter expressions containing '<='
+ or '>='.
- Warning 202: Error: 'Can't mix strings and integers in expression'
+2022-11-18: wsfulton
+ Duplicate class template instantiations via %template now issue a warning and are ignored.
-2022-02-21: davidcl
- [Scilab] Improve 5.5.2, 6.0.0 and 6.1.0 support.
+ %template(Aint) A;
+ %template(Aint2) A; // Now ignored and issues a warning
- For Scilab 5, long names are reduced to small names preserving the
- class prefix and accessor suffix (get or set).
+ example.i:7: Warning 404: Duplicate template instantiation of 'A< int >' with name 'Aint2' ignored,
+ example.i:6: Warning 404: previous instantiation of 'A< int >' with name 'Aint'.
- For Scilab 6, long names with the class prefix and accessor suffix
- should be used on the user code.
+ A single empty template instantiation before a named instantiation is the one exception
+ for allowing duplicate template instantiations as the empty template instantation does not
+ create a wrapper for the template, it merely adds the instantiation into SWIG's internal
+ type system.
+ Duplicate empty template instantiations are quietly ignored.
- The `-targetversion` option has been removed as the generated code
- now detects the Scilab version in loader.sce or builder.sce.
+ %template() B;
+ %template(Bint) B; // OK
+
+ %template() C;
+ %template() C; // Quietly ignored now
+ %template(Cint) C; // OK
+
+ Note that default template parameters are considered when looking for duplicates such as:
+
+ template struct D {};
+ %template(Dint) D;
+ %template(Dintshort) D;
+
+ example.i:7: Warning 404: Duplicate template instantiation of 'D< int,short >' with name 'Dintshort' ignored,
+ example.i:6: Warning 404: previous instantiation of 'D< int >' with name 'Dint'.
+
+ Note that the following always was ignored, but that was because the chosen name was a
+ duplicate rather than the template being a duplicate:
+
+ %template(Eint) E;
+ %template(Eint) E; // Always has been ignored as a redefined identifier
+
+ The old warning was:
+
+ example.i:7: Warning 302: Identifier 'Eint' redefined (ignored) (Renamed from 'E< int >'),
+ example.i:6: Warning 302: previous definition of 'Eint' (Renamed from 'E< int >').
*** POTENTIAL INCOMPATIBILITY ***
-
-2022-02-20: wsfulton
- Fix %warnfilter warning suppress for warning 315 SWIGWARN_PARSE_USING_UNDEF.
-
-2022-02-17: olly
- [PHP] https://sourceforge.net/p/swig/bugs/1211/
- Fix to call cleanup code in exception situations and not to invoke
- the freearg typemap twice in certain situations.
-
-2022-02-15: olly
- #300 #368 Improve parser handling of % followed immediately by
- an identifier. If it's not a recognised directive the scanner
- now emits MODULO and then rescans what follows, and if the parser
- then gives a syntax error we report it as an unknown directive.
- This means that `a%b` is now allowed in an expression, and that
- things like `%std::vector` now give an error rather
- than being quietly ignored.
-
-2022-02-11: adr26
- [Python] #2154 Fix memory leak.
-
- SWIG python objects were being freed after the corresponding SWIG
- module information was destroyed in Python 3, causing leaks when as
- a result the object destructor could not be invoked. To prevent this
- misordering, SWIG python objects now obtain a reference to the
- Python capsule wrapping the module information, so that the module
- information is correctly destroyed after all SWIG python objects
- have been freed (and corresponding destructors invoked).
-
-2022-02-10: olly
- [Tcl] https://sourceforge.net/p/swig/bugs/1207/
- https://sourceforge.net/p/swig/bugs/1213/
-
- Fix Tcl generic input typemap for std::vector.
-
-2022-02-07: sethrj
- #2196 Add alternative syntax for specifying fragments in typemaps.
-
- New syntax:
- %typemap("in", fragment="frag1", fragment="frag2", fragment="frag3") {...}
- which is equivalent to:
- %typemap(in, fragment="frag1,frag2,frag3") {...}
-
-
-2022-02-07: olly
- #1806 Remove support for the "command" encoder, which was mostly
- intended for use in `%rename` - most uses can be achieved using
- the "regex" encoder, so we recommend using that instead.
-
- The "command" encoder suffers from a number of issues - as the
- documentation for it admitted, "[it] is extremely slow compared to
- all the other [encoders] as it involves spawning a separate process
- and using it for many declarations is not recommended" and that it
- "should generally be avoided because of performance
- considerations".
-
- But it's also not portable. The design assumes that `/bin/sh`
- supports `<<<` but that's a bash-specific feature so it doesn't
- work on platforms where `/bin/sh` is not bash - it fails on
- Debian, Ubuntu and probably some other Linux distros, plus most
- non-Linux platforms. Microsoft Windows doesn't even have a
- /bin/sh as standard.
-
- Finally, no escaping of the passed string is done, so it has
- potential security issues (though at least with %rename the input
- is limited to valid C/C++ symbol names).
-
-2022-02-06: olly
- #2193 -DFOO on the SWIG command line now sets FOO to 1 for
- consistency with C/C++ compiler preprocessors. Previously
- SWIG set FOO to an empty value.
-
- Existing invocations of SWIG with `-DFOO` where the empty value
- matters can be updated to `-DFOO=` which should work with both
- old and new releases of SWIG.
-
- *** POTENTIAL INCOMPATIBILITY ***
-
-2022-02-06: sethrj
- #2194 Classes that are non-assignable due to const data or const
- reference members are now automatically detected.
-
-2022-02-04: friedrichatgc
- [Octave] #1672 Fix for isobject for Octave 4.4 - 6.0.
-
-2022-02-03: olly
- [C#] #283 #998 Fix memory leak in directorin typemap for
- std::string.
-
-2022-02-03: olly
- [Python] #967 Make `self` parameter available to user typemaps.
-
-2022-02-03: teythoon
- [Python] #801 Fix -Wunused-parameter warnings with builtin,
-
-2022-02-03: teythoon
- #801 Fix -Wstrict-prototypes warnings in generated pointer
- functions.
-
-2022-02-03: olly
- #660 https://sourceforge.net/p/swig/bugs/1081/
- Default parameter values containing method calls are now parsed and
- handled - e.g. `x->foo(3,4)` and `y.z()`.
-
-2022-02-02: olly
- [Ruby] https://sourceforge.net/p/swig/bugs/1136/ Fix remove of prefix
- from method name to only remove it at the start.
-
-2022-02-01: olly
- #231 Handle returning an object by reference in a C++ trailing
- return type.
-
-2022-02-01: davidcl
- [Scilab] #745 use SWIG__Init() as a C module init function.
-
-2022-02-01: olly
- [OCaml] #2083 Fix to work when CAML_SAFE_STRING is on, which it is
- by default in recent Ocaml releases.
-
-2022-01-31: mreeez
- https://sourceforge.net/p/swig/bugs/1147/
- Fix copyToR() generated for a struct in a namespace.
-
-2022-01-29: fschlimb
- #655 Better handling of using declarations.
-
-2022-01-29: dontpanic92
- [Go] #676 Fix code generated for a C++ class with a non-capitalised
- name.
-
-2022-01-26: trex58
- #1919 #1921 #1923 Various fixes for AIX portability.
-
-2022-01-26: olly
- #1935 Don't crash on an unclosed HTML tag in a doxygen comment
- when -doxygen is specified.
-
-2022-01-25: olly
- Constant expressions now support member access with `.` such as
- `foo.bar`. Previous this only worked in a case like `x->foo.bar`.
-
-2022-01-25: olly
- #2091 Support most cases of `sizeof` applied to an expression
- in constant expressions. Previously there was only support for
- `sizeof()` and expressions which syntactically look like a
- type (such as `sizeof(foo)`).
-
-2022-01-25: olly
- #80 #635 https://sourceforge.net/p/swig/bugs/1139/
- Add support for parsing common cases of `<` and `>` comparisons
- in constant expressions. Adding full support for these seems hard
- to do without introducing conflicts into the parser grammar, but in
- fact all reported cases have had parentheses around the comparison
- and we can support that with a few restrictions on the left side of
- `<`.
-
-2022-01-25: wsfulton
- New warning 327 for extern templates, eg:
-
- extern template class std::vector;
- extern template void Func();
-
- results in warning
-
- example.i:3: Warning 327: Extern template ignored.
- example.i:4: Warning 327: Extern template ignored.
-
- Extern template classes previously resulted in warning 320.
-
-2022-01-24: romintomasetti
- #2131 #2157 C++11 extern function template parsing error fix.
-
-2022-01-21: wsfulton
- #2120 #2138 Replace legacy PCRE dependency with PCRE2.
- This requires changes for building SWIG from source. See updated
- html documentation in Preface.html and Windows.html. Updated
- instructions are also shown when running ./configure if PCRE2 is not
- found. Note that debian based systems can install PCRE2 using:
-
- apt install libpcre2-dev
-
- Note that https://github.com/swig/swig/wiki/Getting-Started also has
- updated information for building from source.
-
-2022-01-19: olly
- [PHP] #2027 Automatically generate PHP type declarations for PHP 8.
- The generate code still compiles for PHP 7.x, but without type
- declarations since PHP 7.x has much more limited type declaration
- support.
-
-2022-01-18: olly
- [Perl] #1629 Perl 5.8.0 is now the oldest version we aim to support.
-
-2022-01-14: wsfulton
- [Python] Fix %callback and specifying the callback function as a
- static member function using Python staticmethod syntax, such as
- Klass.memberfunction instead of Klass_memberfunction when using
- -builtin and -fastproxy.
-
-2022-01-11: wsfulton
- [Python] Accept keyword arguments accessing static member functions when
- using -builtin and kwargs feature and Python class staticmethod syntax.
- The missing keyword argument support was only when using the
- class staticmethod syntax, such as Klass.memberfunction, and not when
- using the flat static method syntax, such as Klass_memberfunction.
-
-2022-01-04: juierror
- [Go] #2045 Add support for std::array in std_array.i.
-
-2021-12-18: olly
- [PHP] Add PHP keyword 'readonly' (added in 8.1) to the list SWIG
- knows to automatically rename. This keyword is special in that PHP
- allows it to be used as a function (or method) name.
-
-2021-12-07: vstinner
- [Python] #2116 Python 3.11 support: use Py_SET_TYPE()
-
-2021-12-05: rwf1
- [Octave] #2020 #1893 Add support for Octave 6 up to and including 6.4.
- Also add support for compiling with -Bsymbolic which is used by default
- by mkoctfile.
-
-2021-12-02: jsenn
- [Python] #2102 Fixed crashes when using embedded Python interpreters.
-
-2021-11-12: wsfulton
- [Javascript] v8 and node only. Fix mismatched new char[] and free()
- when wrapping C code char arrays. Now calloc is now used instead of
- new char[] in SWIG_AsCharPtrAndSize.
-
-2021-10-03: ajrh1
- [Perl] #2074: Avoid -Wmisleading-indentation in generated code
- when using gcc11.
-
-2021-10-03: jschueller
- [CMake] #2065: Add option to enable or disable PCRE support.
-
-2021-09-16: ianlancetaylor
- [Go] Improved _cgo_panic implementation.
-
-2021-09-16: ianlancetaylor
- [Go] Don't use crosscall2 for panicking. Instead rely on documented
- and exported interfaces.
-
-2021-09-14: ianlancetaylor
- [Go] Remove -no-cgo option (long unsupported in Go)
-
-2021-05-04: olly
- [PHP] #2014 Throw PHP exceptions instead of using PHP errors
-
- PHP exceptions can be caught and handled if desired, but if they
- aren't caught then PHP exits in much the same way as it does for a
- PHP error.
-
- In particular this means parameter type errors and some other cases
- in SWIG-generated wrappers now throw a PHP exception, which matches
- how PHP's native parameter handling deals with similar situations.
-
- `SWIG_ErrorCode()`, `SWIG_ErrorMsg()`, `SWIG_FAIL()` and `goto thrown;`
- are no longer supported (these are really all internal implementation
- details and none are documented aside from brief mentions in CHANGES
- for the first three). I wasn't able to find any uses in user interface
- files at least in FOSS code via code search tools.
-
- If you are using these:
-
- Use `SWIG_PHP_Error(code,msg);` instead of `SWIG_ErrorCode(code);
- SWIG_ErrorMsg(msg);` (which will throw a PHP exception in SWIG >= 4.1
- and do the same as the individual calls in older SWIG).
-
- `SWIG_FAIL();` and `goto thrown;` can typically be replaced with
- `SWIG_fail;`. This will probably also work with older SWIG, but
- please test with your wrappers if this is important to you.
-
- *** POTENTIAL INCOMPATIBILITY ***
-
-2021-05-17: adr26
- [Python] #1985 Fix memory leaks:
-
- 1. Python object references were being incorrectly retained by
- SwigPyClientData, causing swig_varlink_dealloc() never to run / free
- memory. SwigPyClientData_New() / SwigPyClientData_Del() were updated
- to fix the object reference counting, causing swig_varlink_dealloc()
- to run and the memory swig_varlink owns to be freed.
-
- 2. SwigPyClientData itself was not freed by SwigPyClientData_Del(),
- causing another heap leak. The required free() was added to
- SwigPyClientData_Del()
-
- 3. Fix reference counting/leak of python cached type query
-
- 4. Fix reference counting/leak of SwigPyObject dict (-builtin)
-
- 5. Python object reference counting fixes for out-of-memory
- scenarios were added to: SWIG_Python_RaiseOrModifyTypeError(),
- SWIG_Python_AppendOutput(), SwigPyClientData_New(),
- SwigPyObject_get___dict__() and SwigPyObject_format()
-
- 6. Add error handling for PyModule_AddObject() to
- SWIG_Python_SetModule() (failure could be caused by OOM or a name
- clash caused by malicious code)
-
-2021-05-13: olly
- [UFFI] #2009 Remove code for Common Lisp UFFI. We dropped support
- for it in SWIG 4.0.0 and nobody has stepped forward to revive it in
- over 2 years.
-
-2021-05-13: olly
- [S-EXP] #2009 Remove code for Common Lisp S-Exp. We dropped
- support for it in SWIG 4.0.0 and nobody has stepped forward to
- revive it in over 2 years.
-
-2021-05-13: olly
- [Pike] #2009 Remove code for Pike. We dropped support for it in
- SWIG 4.0.0 and nobody has stepped forward to revive it in over 2
- years.
-
-2021-05-13: olly
- [Modula3] #2009 Remove code for Modula3. We dropped support for it
- in SWIG 4.0.0 and nobody has stepped forward to revive it in over 2
- years.
-
-2021-05-13: olly
- [CLISP] #2009 Remove code for GNU Common Lisp. We dropped support
- for it in SWIG 4.0.0 and nobody has stepped forward to revive it in
- over 2 years.
-
-2021-05-13: olly
- [Chicken] #2009 Remove code for Chicken. We dropped support for it
- in SWIG 4.0.0 and nobody has stepped forward to revive it in over 2
- years.
-
-2021-05-13: olly
- [Allegrocl] #2009 Remove code for Allegro Common Lisp. We dropped
- support for it in SWIG 4.0.0 and nobody has stepped forward to
- revive it in over 2 years.
-
-2021-05-04: olly
- [PHP] #1982 #1457 https://sourceforge.net/p/swig/bugs/1339/
- SWIG now only use PHP's C API to implement its wrappers, and no
- longer generates PHP code to define classes. The wrappers should
- be almost entirely compatible with those generated before, but
- faster and without some previously hard-to-fix bugs.
-
- The main notable difference is SWIG no longer generates a .php
- wrapper at all by default (only if %pragma(php) code=... or
- %pragma(php) include=... are specified in the interface file).
- This also means you need to load the module via extension=...
- in php.ini, rather than letting the dl() in the generated
- .php wrapper load it (but dl() has only worked for command-line
- PHP for some years now).
-
- *** POTENTIAL INCOMPATIBILITY ***
-
-2021-04-30: olly
- #1984 Remove support for $source and $target.
- These were officially deprecated in 2001, and attempts to use them have
- resulted in a warning (including a pointer to what to update them to)
- for most if not all of that time.
-
-2021-04-27: wsfulton
- #1987 [Java] Fix %interface family of macros for returning by const
- pointer reference.
-
-2021-04-19: olly
- Fix use of uninitialised variable in the generated code for an
- empty typecheck typemap, such as the dummy one we include for
- std::initializer_list.
-
-2021-04-12: olly
- #1777 [Python] Specifying -py3 now generates a check for Python
- version >= 3.0.
-
-2021-03-26: olly
- [PHP] Add PHP keywords 'fn' (added in 7.4) and 'match' (added in
- 8.0) to the list SWIG knows to automatically rename.
-
-2021-03-23: wsfulton
- #1942 [Python] Fix compilation error in wrappers when using -builtin
- and wrapping varargs in constructors.
-
-2021-03-22: goto40
- #1977 Fix handling of template template parameters.
-
-2021-03-21: olly
- #1929, #1978 [PHP] Add support for PHP 8.
-
-2021-03-19: wsfulton
- #1610 Remove -ansi from default compilation flags.
-
-2021-03-19: dot-asm
- #1934 [Java] Clean up typemaps for long long arrays.
-
-2021-03-19: olly
- #1527 [PHP] Improve PHP object creation in directorin case.
- Reportedly the code we were using in this case gave segfaults in
- PHP 7.2 and later - we've been unable to reproduce these, but the
- new approach is also simpler and should be bit faster too.
-
-2021-03-18: olly
- #1655 [PHP] Fix char* typecheck typemap to accept PHP Null like the
- corresponding in typemap does.
-
-2021-03-18: olly
- #1900, #1905 [PHP] Fix wrapping of overloaded directed methods with
- non-void return.
-
-2021-03-11: murillo128
- #1498 [Javascript] Support type conversion.
-
-2021-03-06: nshmyrev
- #872 [Javascript] Various typemap issues in arrays_javascript.i fixed.
-
-2021-03-03: vaughamhong
- #577 [Javascript] Implemented SetModule/GetModule for JSC to allow type sharing
- across modules.
-
-2021-03-01: xantares, Oliver Buchtala, geographika
- #1040 Add support for building SWIG with CMake. See documentation in Windows.html.
-
-2021-03-01: vadz
- #1952 Fix incorrect warning "Unknown Doxygen command: ."
-
-2021-02-28: p2k
- #969 [Javascript] v8/node - prevent crash calling a constructor without new keyword.
-
-2021-02-28: alecmev
- #405 #1121 [Javascript] Fix OUTPUT typemaps on methods that don't return void.
- The output value is appended to the return value.
-
-2021-02-26: murillo128, wsfulton
- #1269 [Javascript] Fix handling of large positive unsigned long and
- unsigned long long values.
-
-2021-02-24: tomleavy, yegorich, tungntpham
- #1746 [Javascript] Add support for Node v12, v14 and v16.
- SWIG support for Node is now for v6 and later only.
-
-2020-02-09: ZackerySpytz
- #1872 Fix typos in attribute2ref macros.
-
-2020-10-10: wsfulton
- [Javascript] Fix so that ccomplex.i interface to file can be used.
-
-2020-10-10: wsfulton
- #252 complex can now be used as a C identifier and doesn't give a syntax error.
-
-2020-10-10: lpsinger
- #1770 Correct C complex support.
- _Complex is now parsed as a keyword rather than complex as per the C99 standard.
- The complex macro is available in the ccomplex.i library file along with other
- complex number handling provided by the complex.h header.
-
-2020-10-07: ZackerySpytz
- [Python] #1812 Fix the error handling for the PyObject_GetBuffer() calls in
- pybuffer.i.
-
-2020-10-07: treitmayr
- #1824 Add missing space in director method declaration returning
- const pointer.
-
-2020-10-07: adelva1984
- #1859 Remove all (two) exceptions from SWIG executable.
-
-2020-09-25: wsfulton
- [C#, Java] #1874 Add ability to change the modifiers for the interface
- generated when using the %interface macros.
-
- For C# use the 'csinterfacemodifiers' typemap.
- For Java use the 'javainterfacemodifiers' typemap.
-
- For example:
-
- %typemap(csinterfacemodifiers) X "internal interface"
-
-2020-09-24: geefr
- [C#] #1868 Fix wchar_t* csvarout typemap for member variable wrappers.
-
-2020-08-28: wsfulton
- [Java] #1862 Fix crashes in swig_connect_director during director class construction
- when using the director class from multiple threads - a race condition initialising
- block scope static variables. The fix is guaranteed when using C++11, but most
- compilers also fix it when using C++03/C++98.
-
-2020-08-16: wsfulton
- [Python] Add missing initializer for member ‘_heaptypeobject::ht_module’ when using
- -builtin to complete Python 3.9 support.
-
-2020-08-16: wsfulton
- [Python] Remove PyEval_InitThreads() call for Python 3.7 and later as Python calls
- it automatically now. This removes a deprecation warning when using Python 3.9.
-
-2020-08-15: wsfulton
- [Python] All Python examples and tests are written to be Python 2 and Python 3
- compatible, removing the need for 2to3 to run the examples or test-suite.
-
-2020-08-13: wsfulton
- [C#] Add support for void *VOID_INT_PTR for member variables.
-
-2020-07-29: chrisburr
- #1843 [Python] Compilation error fix in SwigPyBuiltin_SetMetaType when using PyPy.
-
-2020-06-14: ZackerySpytz
- #1642 #1809 Fix virtual comparison operators in director classes - remove incorrect
- space in the function name, for example, operator= = is now operator==.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8a8862f63..6298b62d3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,8 +20,11 @@ endif ()
set (SWIG_ROOT ${PROJECT_SOURCE_DIR})
-set (SWIG_LIB share/swig/${SWIG_VERSION})
-
+if (WIN32)
+ set (SWIG_LIB bin/Lib)
+else ()
+ set (SWIG_LIB share/swig/${SWIG_VERSION})
+endif ()
# Project wide configuration variables
# ------------------------------------
@@ -80,10 +83,10 @@ if (WITH_PCRE)
include_directories (${PCRE2_INCLUDE_DIRS})
endif()
-if (WIN32)
- file (TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX}/${SWIG_LIB} SWIG_LIB_WIN_UNIX)
- string (REGEX REPLACE "\\\\" "\\\\\\\\" SWIG_LIB_WIN_UNIX "${SWIG_LIB_WIN_UNIX}")
-endif ()
+#if (WIN32)
+# file (TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX}/${SWIG_LIB} SWIG_LIB_WIN_UNIX)
+# string (REGEX REPLACE "\\\\" "\\\\\\\\" SWIG_LIB_WIN_UNIX "${SWIG_LIB_WIN_UNIX}")
+#endif ()
configure_file (${SWIG_ROOT}/Tools/cmake/swigconfig.h.in
${CMAKE_CURRENT_BINARY_DIR}/Source/Include/swigconfig.h)
@@ -127,6 +130,7 @@ install (FILES ${CMAKE_CURRENT_BINARY_DIR}/swigwarn.swg DESTINATION ${SWIG_LIB})
# ---------
file (GLOB DOH_SOURCES ${SWIG_SOURCE_DIR}/DOH/*.c)
file (GLOB CPARSE_SOURCES ${SWIG_SOURCE_DIR}/CParse/*.c)
+list (REMOVE_ITEM CPARSE_SOURCES ${SWIG_SOURCE_DIR}/CParse/parser.c)
list (APPEND CPARSE_SOURCES)
file (GLOB PREPROCESSOR_SOURCES ${SWIG_SOURCE_DIR}/Preprocessor/*.c)
file (GLOB CORE_SOURCES ${SWIG_SOURCE_DIR}/Swig/*.c)
diff --git a/Doc/Devel/engineering.html b/Doc/Devel/engineering.html
index c12eb1328..c2cad4804 100644
--- a/Doc/Devel/engineering.html
+++ b/Doc/Devel/engineering.html
@@ -130,7 +130,7 @@ like this:
* terms also apply to certain portions of SWIG. The full details of the SWIG
* license and copyrights can be found in the LICENSE and COPYRIGHT files
* included with the SWIG source code as distributed by the SWIG developers
- * and at http://www.swig.org/legal.html.
+ * and at https://www.swig.org/legal.html.
*
* xxx.c
*
diff --git a/Doc/Manual/CCache.html b/Doc/Manual/CCache.html
index 1a94709ae..e6935b895 100644
--- a/Doc/Manual/CCache.html
+++ b/Doc/Manual/CCache.html
@@ -463,7 +463,7 @@ ccache was adapted to create ccache-swig for use with SWIG by William Fulton.
If you wish to report a problem or make a suggestion then please email
the SWIG developers on the swig-devel mailing list, see
-http://www.swig.org/mail.html
+https://www.swig.org/mail.html
ccache is released under the GNU General Public License version 2 or
later. Please see the file COPYING for license details.
diff --git a/Doc/Manual/CPlusPlus11.html b/Doc/Manual/CPlusPlus11.html
index 861b80048..6fdc1512a 100644
--- a/Doc/Manual/CPlusPlus11.html
+++ b/Doc/Manual/CPlusPlus11.html
@@ -720,18 +720,45 @@ AltStruct var2{2, 4.3}; // calls the constructor
-SWIG supports decltype() with some limitations. Single
-variables are allowed, however, expressions are not supported yet. For
+
SWIG supports decltype() with limitations. Single
+variables are allowed, however, non-trivial expressions are not supported very well. For
example, the following code will work:
-However, using an expression inside the decltype results in syntax error:
+SWIG is able to deduce that the variable, i , is type int .
+
+
+
+Using a non-trivial expression for the decltype results in a warning:
int i; int j;
-decltype(i+j) k; // syntax error
+decltype(i+j) k; // Warning 344: Unable to deduce decltype for 'i+j'.
+
+
+
+This warning should be viewed as a prompt to add in a manual ignore of the variable/function as
+in most cases the generated code will not compile.
+For the example above, ignore the symbol that uses decltype and perhaps additionally
+suppress the warning as follows:
+
+
+
+#pragma SWIG nowarn=SWIGWARN_CPP11_DECLTYPE
+%ignore k;
+
+
+
+If an ignore is not acceptable, a workaround is to redefine the symbol with the actual type, for example:
+
+
+
+int k; // define k with the actual type
+%ignore k; // ignore the real definition of k
+int i; int j;
+decltype(i+j) k; // Warning 344: Unable to deduce decltype for 'i+j'.
SWIG does not support auto as a type specifier for variables, only
@@ -891,6 +918,19 @@ struct DerivedStruct : BaseStruct {
};
+
+Classes can also be marked as final, such as
+
+
+
+struct FinalDerivedStruct final : BaseStruct {
+ virtual void ab() const override;
+};
+
+
+
+Compatibility note: Final methods were supported much earlier than final classes. SWIG-4.1.0 was the first version to support classes marked as final.
+
@@ -1085,38 +1125,71 @@ union P {
-SWIG supports the variadic templates syntax (inside the <>
-block, variadic class inheritance and variadic constructor and
-initializers) with some limitations. The following code is correctly parsed:
+SWIG supports the variadic templates including the <>
+variadic class inheritance, variadic methods, variadic constructors and
+initializers. Example:
template <typename... BaseClasses> class ClassName : public BaseClasses... {
public:
- ClassName (BaseClasses &&... baseClasses) : BaseClasses(baseClasses)... {}
-}
+ ClassName(BaseClasses &&... baseClasses) : BaseClasses(baseClasses)... {}
+ void InstanceMethod(const BaseClasses&... baseClasses) {}
+};
-For now however, the %template directive only accepts one parameter substitution
-for the variable template parameters.
+The %template directive works as expected for variable template parameters.
-%template(MyVariant1) ClassName<> // zero argument not supported yet
-%template(MyVariant2) ClassName<int> // ok
-%template(MyVariant3) ClassName<int, int> // too many arguments not supported yet
+struct A {
+ virtual void amethod();
+ virtual ~A();
+};
+struct B {
+ virtual void bmethod();
+ virtual ~B();
+};
+%template(ClassName0) ClassName<>
+%template(ClassName1) ClassName<A>
+%template(ClassName2) ClassName<A, B>
-Support for the variadic sizeof() function is correctly parsed:
+
+Example usage from say Python:
+
+
+
+cn0 = ClassName0()
+cn0.InstanceMethod()
+
+a = A()
+cn1 = ClassName1(a)
+cn1.amethod()
+cn1.InstanceMethod(a)
+
+b = B()
+cn2 = ClassName2(a, b)
+cn2.InstanceMethod(a, b)
+cn2.amethod()
+cn2.bmethod()
+
+
+Support for the variadic sizeof() function also works:
-const int SIZE = sizeof...(ClassName<int, int>);
+const int SIZE = sizeof...(ClassName<A, B>);
In the above example SIZE is of course wrapped as a constant.
+
+Compatibility note: SWIG-4.2.0 was the first version to fully support variadic templates.
+SWIG-3.0.0 provided initial support and was limited to only one variadic parameter.
+
+
diff --git a/Doc/Manual/CSharp.html b/Doc/Manual/CSharp.html
index 405868b5c..3cfff6e68 100644
--- a/Doc/Manual/CSharp.html
+++ b/Doc/Manual/CSharp.html
@@ -566,7 +566,7 @@ After SWIG has run and both the C# and C/C++ compilers have finished building,
the examples will be run, by either running runme.exe or by running
mono runme.exe (Mono C# compiler).
Windows users can also get the examples working using a
-Cygwin or MinGW environment for automatic configuration of the example makefiles.
+Cygwin or MinGW environment for automatic configuration of the example makefiles.
Any one of the C# compilers (Mono or Microsoft) can be detected from within a Cygwin or Mingw environment if installed in your path.
diff --git a/Doc/Manual/Contents.html b/Doc/Manual/Contents.html
index d3106bf09..cecd54958 100644
--- a/Doc/Manual/Contents.html
+++ b/Doc/Manual/Contents.html
@@ -260,6 +260,7 @@
Function templates
Default template arguments
Template base classes
+Empty template instantiation
Template specialization
Member templates
Scoping and templates
@@ -1351,6 +1352,7 @@
Static Member Variables
Static Member Functions
Specifying Implemented Interfaces
+Dynamic Properties
PHP Pragmas, Startup and Shutdown code
diff --git a/Doc/Manual/D.html b/Doc/Manual/D.html
index 9e733c401..4b4e3c2c0 100644
--- a/Doc/Manual/D.html
+++ b/Doc/Manual/D.html
@@ -44,7 +44,7 @@
-From the D Programming Language web site: D is a systems programming language. Its focus is on combining the power and high performance of C and C++ with the programmer productivity of modern languages like Ruby and Python. [...] The D language is statically typed and compiles directly to machine code. As such, it is not very surprising that D is able to directly interface with C libraries . Why would a SWIG module for D be needed then in the first place?
+From the D Programming Language web site: D is a systems programming language. Its focus is on combining the power and high performance of C and C++ with the programmer productivity of modern languages like Ruby and Python. [...] The D language is statically typed and compiles directly to machine code. As such, it is not very surprising that D is able to directly interface with C libraries . Why would a SWIG module for D be needed then in the first place?
Well, besides the obvious downside that the C header files have to be manually converted to D modules for this to work, there is one major inconvenience with this approach: D code usually is on a higher abstraction level than C, and many of the features that make D interesting are simply not available when dealing with C libraries, requiring you e.g. to manually convert strings between pointers to \0 -terminated char arrays and D char arrays, making the algorithms from the D2 standard library unusable with C arrays and data structures, and so on.
@@ -421,7 +421,7 @@ struct A {
The first key difference is that C++ supports free functions as operators (along with argument-dependent lookup), while D requires operators to be member functions of the class they are operating on. SWIG can only automatically generate wrapping code for member function operators; if you want to use operators defined as free functions in D, you need to handle them manually.
-Another set of differences between C++ and D concerns individual operators. For example, there are quite a few operators which are overloadable in C++, but not in D, for example && and || , but also ! , and prefix increment/decrement operators in D1 resp. their postfix pendants in D2 .
+Another set of differences between C++ and D concerns individual operators. For example, there are quite a few operators which are overloadable in C++, but not in D, for example && and || , but also ! , and prefix increment/decrement operators in D1 resp. their postfix pendants in D2 .
There are also some cases where the operators can be translated to D, but the differences in the implementation details are big enough that a rather involved scheme would be required for automatic wrapping them, which has not been implemented yet. This affects, for example, the array subscript operator, [] , in combination with assignments - while operator [] in C++ simply returns a reference which is then written to, D resorts to a separate opIndexAssign method -, or implicit casting (which was introduced in D2 via alias this ). Despite the lack of automatic support, manually handling these cases should be perfectly possible.
diff --git a/Doc/Manual/Doxygen.html b/Doc/Manual/Doxygen.html
index 9d2cc7724..9f92db91a 100644
--- a/Doc/Manual/Doxygen.html
+++ b/Doc/Manual/Doxygen.html
@@ -67,7 +67,7 @@ supported.
The Doxygen Translation module of SWIG adds an extra layer of
functionality to SWIG, allowing automated translation of Doxygen formatted comments
+"https://www.doxygen.nl/manual/">Doxygen
formatted comments
from input files into a documentation language more suited for the
target language. Currently this module only translates into Javadoc
and Pydoc for the SWIG Java and Python modules.
@@ -83,14 +83,14 @@ Code proposal from Summer 2008.
To make use of the comment translation system, your documentation
comments must be in properly formatted Doxygen. Doxygen comments can be
+"https://www.doxygen.nl/manual/">Doxygen. Doxygen comments can be
present in your main SWIG interface file or any header file that it
imports. You are advised to be validate that your comments compile
properly with Doxygen before you try to translate them. Doxygen
itself is a more comprehensive tool and can provide you better feedback for
correcting any syntax errors that may be present. Please look at
Doxygen's Documenting the
+"https://www.doxygen.nl/manual/docblocks.html"> Documenting the
code for the full comment format specifications. However, SWIG's
Doxygen parser will still report many errors and warnings found
in comments (like unterminated strings or missing ending tags).
@@ -98,7 +98,7 @@ in comments (like unterminated strings or missing ending tags).
Currently, the whole subset of Doxygen comment styles is supported
-(See
+(See
Documenting the code ). Here they are:
@@ -298,7 +298,7 @@ make much sense for the other languages without explicit ownership management.
Doxygen syntax is rather rich and, in addition to simple commands such as
@transferfull , it is also possible to define commands with arguments.
-As explained in Doxygen documentation ,
+As explained in Doxygen documentation ,
the arguments can have a range of a single word, everything until the end of
line or everything until the end of the next paragraph. Currently, only the "end
of line" case is supported using the range="line" argument of the
@@ -1079,7 +1079,7 @@ class Shape(_object):
If any parameters of a function or a method are documented in the Doxygen comment,
their description is copied into the generated output using
-Sphinx documentation conventions. For example
+Sphinx documentation conventions. For example
/**
@@ -1167,7 +1167,7 @@ completely (doxygen:notranslate feature). Then SWIG will just copy
the comments to the proxy file and reformat them if needed, but all
the comment content will be left as is. As Doxygen doesn't support
special commands in Python comments
-(see Doxygen
+(see Doxygen
docs ), you may want to use some tool like doxypy
(doxypy )
to do the work.
diff --git a/Doc/Manual/Extending.html b/Doc/Manual/Extending.html
index cbb78bef8..b13c5167e 100644
--- a/Doc/Manual/Extending.html
+++ b/Doc/Manual/Extending.html
@@ -1244,6 +1244,14 @@ if an object was removed, 0 otherwise.
Returns the list of hash table keys.
+
+List *SortedKeys(Hash *h, int (*cmp) (const DOH *, const DOH *))
+
+
+
+Returns the list of sorted hash table keys.
+
+
@@ -3141,7 +3149,7 @@ As you can see, most usages are direct.
This file is processed by
-autoconf
+autoconf
to generate the configure script. This is where you
need to add shell script fragments and autoconf macros to detect the
presence of whatever development support your language module requires,
@@ -3489,7 +3497,7 @@ Advanced usage of the test-suite facilitates running tools on some of the five s
The make variables SWIGTOOL and RUNTOOL are used to specify a tool to respectively, invoke SWIG
and the execution of the runtime test.
You are advised to view the Examples/test-suite/common.mk file for details but for a short summary,
-the classic usage is to use Valgrind for memory checking.
+the classic usage is to use Valgrind for memory checking.
For example, checking for memory leaks when running the runtime test in the target language interpreter:
diff --git a/Doc/Manual/Go.html b/Doc/Manual/Go.html
index f4ef1fe57..5b774bc45 100644
--- a/Doc/Manual/Go.html
+++ b/Doc/Manual/Go.html
@@ -56,7 +56,7 @@
This chapter describes SWIG's support of Go. For more information on
the Go programming language
-see golang.org .
+see golang.org .
diff --git a/Doc/Manual/Guile.html b/Doc/Manual/Guile.html
index 7f607f804..eaf658373 100644
--- a/Doc/Manual/Guile.html
+++ b/Doc/Manual/Guile.html
@@ -76,7 +76,7 @@ we explicitly prefix the context, e.g., "guile-module".
Guile 1.8 and older could be interfaced using two different api's, the SCM
or the GH API. The GH interface to guile is deprecated. Read more about why in the
-Guile manual .
+Guile manual .
Support for the guile GH wrapper code generation has been dropped from SWIG. The last
version of SWIG that can still generate guile GH wrapper code is 2.0.9. Please
diff --git a/Doc/Manual/Introduction.html b/Doc/Manual/Introduction.html
index facfc7dd1..69e2563bd 100644
--- a/Doc/Manual/Introduction.html
+++ b/Doc/Manual/Introduction.html
@@ -453,14 +453,14 @@ Microsoft Visual Studio.
If you are using the GNU Autotools
-(Autoconf /
-Automake /
-Libtool )
+(Autoconf /
+Automake /
+Libtool )
to configure SWIG use in your project, the SWIG Autoconf macros can be used.
The primary macro is ax_pkg_swig , see
-http://www.gnu.org/software/autoconf-archive/ax_pkg_swig.html#ax_pkg_swig .
+http://www.gnu.org/software/autoconf-archive/ax_pkg_swig.html#ax_pkg_swig .
The ax_python_devel macro is also helpful for generating Python extensions. See the
-Autoconf Archive
+Autoconf Archive
for further information on this and other Autoconf macros.
diff --git a/Doc/Manual/Javascript.html b/Doc/Manual/Javascript.html
index ab8657510..c4545ecff 100644
--- a/Doc/Manual/Javascript.html
+++ b/Doc/Manual/Javascript.html
@@ -279,7 +279,7 @@ extern bool example_initialize(JSGlobalContextRef context, JSObjectRef* exports)
-There is general information about programming GTK at GTK documentation and in the GTK tutorial , and for Webkit there is a Webkit GTK+ API Reference .
+There is general information about programming GTK at GTK documentation and in the GTK tutorial , and for Webkit there is a Webkit GTK+ API Reference .
An integration of a native extension 'example' would look like this:
@@ -310,7 +310,7 @@ int main(int argc, char* argv[])
...
// Load a web page into the browser instance
- webkit_web_view_load_uri(webView, "http://www.webkitgtk.org/");
+ webkit_web_view_load_uri(webView, "https://www.webkitgtk.org/");
...
@@ -465,7 +465,7 @@ example.Foo = 3.1415926;
First the module example is loaded from the previously built extension. Global methods and variables are available in the scope of the module.
-Note : ECMAScript 5, the currently implemented Javascript standard, does not have modules. node.js and other implementations provide this mechanism defined by the CommonJS group. For browsers this is provided by Browserify , for instance.
+Note : ECMAScript 5, the currently implemented Javascript standard, does not have modules. node.js and other implementations provide this mechanism defined by the CommonJS group. For browsers this is provided by Browserify , for instance.
diff --git a/Doc/Manual/Lisp.html b/Doc/Manual/Lisp.html
deleted file mode 100644
index 6d8463beb..000000000
--- a/Doc/Manual/Lisp.html
+++ /dev/null
@@ -1,604 +0,0 @@
-
-
-
-SWIG and Common Lisp
-
-
-
-
-
-
-
-
-
-
-
-
-
- Common Lisp is a high-level, all-purpose, object-oriented,
- dynamic, functional programming language with long history.
- Common Lisp is used in many fields, ranging from web development to
- finance, and also common in computer science education.
- There are more than 9 different implementations of common lisp which
- are available, all have different foreign function
- interfaces. SWIG currently supports the
- Common Foreign Function Interface(CFFI).
-
-
-
-
-
-
- CFFI, the Common Foreign Function Interface, is a portable foreign
- function interface for ANSI Common Lisp systems.
- CFFI requires only a small set of
- low-level functionality from the Lisp implementation, such as
- calling a foreign function by name, allocating foreign memory,
- and dereferencing pointers.
-
-
-
- To run the cffi module of SWIG requires very little effort, you
- just need to run:
-
-
-swig -cffi -module module-name file-name
-
-
-
-
- But a better was of using all the power of SWIG is to write SWIG
- interface files. Below we will explain how to write interface
- files and the various things which you can do with them.
-
-
-
-
-
-
-
- CFFI specific options
-
-
-
--generate-typedef
-If this option is given then defctype will be used to generate
- shortcuts according to the typedefs in the input.
-
-
-
-
--[no]cwrap
-Turn on or turn off generation of an intermediate C file when
- creating a C interface. By default this is only done for C++ code.
-
-
-
-
--[no]swig-lisp
-Turns on or off generation of code for helper lisp macro, functions,
- etc. which SWIG uses while generating wrappers. These macros, functions
- may still be used by generated wrapper code.
-
-
-
-
-
-
-
-
-
-
-As we mentioned earlier the ideal way to use SWIG is to use interface
- files. To illustrate the use of it, let's assume that we have a
- file named test.h with the following C code:
-
-
-
-#define y 5
-#define x (y >> 1)
-
-typedef int days;
-
-struct bar {
- short p, q;
- char a, b;
- int *z[1000];
- struct bar * n;
-};
-
-struct bar * my_struct;
-
-struct foo {
- int a;
- struct foo * b[100];
-};
-
-int pointer_func(void (*ClosureFun)( void* _fun, void* _data, void* _evt ), int p);
-
-int func123(div_t * p, int **q[100], int r[][1000][10]);
-
-void lispsort_double (int n, double * array);
-
-enum color { RED, BLUE, GREEN};
-
-
-
-Corresponding to this we will write a simple interface file:
-
-
-
-%module test
-
-%include "test.h"
-
-
-
-
-The generated SWIG Code will be:
-
-
-
-;;;SWIG wrapper code starts here
-
-(cl:defmacro defanonenum (&body enums)
- "Converts anonymous enums to defconstants."
- `(cl:progn , @(cl:loop for value in enums
- for index = 0 then (cl:1+ index)
- when (cl:listp value) do (cl:setf index (cl:second value)
- value (cl:first value))
- collect `(cl:defconstant , value , index))))
-
-(cl:eval-when (:compile-toplevel :load-toplevel)
- (cl:unless (cl:fboundp 'swig-lispify)
- (cl:defun swig-lispify (name flag cl:&optional (package cl:*package*))
- (cl:labels ((helper (lst last rest cl:&aux (c (cl:car lst)))
- (cl:cond
- ((cl:null lst)
- rest)
- ((cl:upper-case-p c)
- (helper (cl:cdr lst) 'upper
- (cl:case last
- ((lower digit) (cl:list* c #\- rest))
- (cl:t (cl:cons c rest)))))
- ((cl:lower-case-p c)
- (helper (cl:cdr lst) 'lower (cl:cons (cl:char-upcase c) rest)))
- ((cl:digit-char-p c)
- (helper (cl:cdr lst) 'digit
- (cl:case last
- ((upper lower) (cl:list* c #\- rest))
- (cl:t (cl:cons c rest)))))
- ((cl:char-equal c #\_)
- (helper (cl:cdr lst) '_ (cl:cons #\- rest)))
- (cl:t
- (cl:error "Invalid character: ~A" c)))))
- (cl:let ((fix (cl:case flag
- ((constant enumvalue) "+")
- (variable "*")
- (cl:t ""))))
- (cl:intern
- (cl:concatenate
- 'cl:string
- fix
- (cl:nreverse (helper (cl:concatenate 'cl:list name) cl:nil cl:nil))
- fix)
- package))))))
-
-;;;SWIG wrapper code ends here
-
-
-(cl:defconstant y 5)
-
-(cl:defconstant x (cl:ash 5 -1))
-
-(cffi:defcstruct bar
- (p :short)
- (q :short)
- (a :char)
- (b :char)
- (z :pointer)
- (n :pointer))
-
-(cffi:defcvar ("my_struct" my_struct)
- :pointer)
-
-(cffi:defcstruct foo
- (a :int)
- (b :pointer))
-
-(cffi:defcfun ("pointer_func" pointer_func) :int
- (ClosureFun :pointer)
- (p :int))
-
-(cffi:defcfun ("func123" func123) :int
- (p :pointer)
- (q :pointer)
- (r :pointer))
-
-(cffi:defcfun ("lispsort_double" lispsort_double) :void
- (n :int)
- (array :pointer))
-
-(cffi:defcenum color
- :RED
- :BLUE
- :GREEN)
-
-
-
- The SWIG wrapper code refers to the special code which SWIG
- may need to use while wrapping C code. You can turn on/off the
- generation of this code by using the -[no]swig-lisp
- option. You must have noticed that SWIG goes one extra step to
- ensure that CFFI does not do automatic lispification of the C
- function names. The reason SWIG does this is because quite often
- developers want to build a nice CLOS based lispy API, and this one
- to one correspondence between C function names and lisp function
- name helps.
-
-
- Maybe you want to have your own convention for generating lisp
- function names for corresponding C function names, or you just
- want to lispify the names, also, before we forget you want to
- export the generated lisp names. To do this, we will use the
- SWIG feature directive .
-Let's edit the interface file such that the C type "div_t*" is changed
- to Lisp type ":my-pointer", we lispify all names,
- export everything, and do some more stuff.
-
-
-
-%module test
-
-%typemap(cin) div_t* ":my-pointer"
-
-%feature("intern_function", "1");
-%feature("export");
-
-%feature("inline") lispsort_double;
-%feature("intern_function", "my-lispify") lispsort_double;
-%feature("export", package="'some-other-package") lispsort_double;
-
-%rename func123 renamed_cool_func;
-
-%ignore "pointer_func";
-
-%include "test.h"
-
-
-
-
-The typemap(cin) ensures that for all arguments which are input
- to C with the type "div_t*", the ":my-pointer" type be
- used. Similarly typemap(cout) are used for all types which
- are returned from C.
-
-
-The feature intern_function ensures that all C names are
- interned using the swig-lispify function. The "1" given
- to the feature is optional. The use of feature like
- %feature("intern_function", "1"); globally enables
- interning for everything. If you want to target a single
- function, or declaration then use the targeted version of
- feature, %feature("intern_function", "my-lispify")
- lispsort_double; , here we are using an additional feature
- which allows us to use our lispify function.
-
-The export feature allows us to export the symbols. If
- the package argument is given, then the symbol will be exported to
- the specified Lisp package. The inline feature declaims the
- declared function as inline. The rename directive allows us to
- change the name(it is useful when generating C wrapper code for handling
- overloaded functions). The ignore directive ignores a certain
- declaration.
-
-There are several other things which are possible, to see some
- example of usage of SWIG look at the Lispbuilder and wxCL
- projects. The generated code with 'noswig-lisp' option is:
-
-
-
-(cl:defconstant #.(swig-lispify "y" 'constant) 5)
-
-(cl:export '#.(swig-lispify "y" 'constant))
-
-(cl:defconstant #.(swig-lispify "x" 'constant) (cl:ash 5 -1))
-
-(cl:export '#.(swig-lispify "x" 'constant))
-
-(cffi:defcstruct #.(swig-lispify "bar" 'classname)
- (#.(swig-lispify "p" 'slotname) :short)
- (#.(swig-lispify "q" 'slotname) :short)
- (#.(swig-lispify "a" 'slotname) :char)
- (#.(swig-lispify "b" 'slotname) :char)
- (#.(swig-lispify "z" 'slotname) :pointer)
- (#.(swig-lispify "n" 'slotname) :pointer))
-
-(cl:export '#.(swig-lispify "bar" 'classname))
-
-(cl:export '#.(swig-lispify "p" 'slotname))
-
-(cl:export '#.(swig-lispify "q" 'slotname))
-
-(cl:export '#.(swig-lispify "a" 'slotname))
-
-(cl:export '#.(swig-lispify "b" 'slotname))
-
-(cl:export '#.(swig-lispify "z" 'slotname))
-
-(cl:export '#.(swig-lispify "n" 'slotname))
-
-(cffi:defcvar ("my_struct" #.(swig-lispify "my_struct" 'variable))
- :pointer)
-
-(cl:export '#.(swig-lispify "my_struct" 'variable))
-
-(cffi:defcstruct #.(swig-lispify "foo" 'classname)
- (#.(swig-lispify "a" 'slotname) :int)
- (#.(swig-lispify "b" 'slotname) :pointer))
-
-(cl:export '#.(swig-lispify "foo" 'classname))
-
-(cl:export '#.(swig-lispify "a" 'slotname))
-
-(cl:export '#.(swig-lispify "b" 'slotname))
-
-(cffi:defcfun ("renamed_cool_func" #.(swig-lispify "renamed_cool_func" 'function)) :int
- (p :my-pointer)
- (q :pointer)
- (r :pointer))
-
-(cl:export '#.(swig-lispify "renamed_cool_func" 'function))
-
-(cl:declaim (cl:inline #.(my-lispify "lispsort_double" 'function)))
-
-(cffi:defcfun ("lispsort_double" #.(my-lispify "lispsort_double" 'function)) :void
- (n :int)
- (array :pointer))
-
-(cl:export '#.(my-lispify "lispsort_double" 'function) 'some-other-package)
-
-(cffi:defcenum #.(swig-lispify "color" 'enumname)
- #.(swig-lispify "RED" 'enumvalue :keyword)
- #.(swig-lispify "BLUE" 'enumvalue :keyword)
- #.(swig-lispify "GREEN" 'enumvalue :keyword))
-
-(cl:export '#.(swig-lispify "color" 'enumname))
-
-
-
-
-
-
-This feature to SWIG (for CFFI) is very new and still far from
- complete. Pitch in with your patches, bug reports and feature
- requests to improve it.
-
- Generating bindings for C++ code, requires -c++ option to be
- present and it first generates C binding which will wrap the C++
- code, and then generates the
- corresponding CFFI wrapper code. In the generated C wrapper
- code, you will often want to put your own C code, such as the
- code to include various files. This can be done by making use of
- "%{" and "%}" as shown below.
-
-
-%{
- #include "Test/test.h"
-%}
-
-
-Also, while parsing the C++ file and generating C wrapper code SWIG
- may need to be able to understand various symbols used in other
- header files. To help SWIG in doing this while ensuring that
- wrapper code is generated for the target file, use the "import"
- directive. The "include" directive specifies the target file for
- which wrapper code will be generated.
-
-
-
-%import "ancillary/header.h"
-
-%include "target/header.h"
-
-
-
-Various features which were available for C headers can also be used
- here. The target header which we are going to use here is:
-
-
-namespace OpenDemo {
- class Test
- {
- public:
- float x;
- // constructors
- Test (void) {x = 0;}
- Test (float X) {x = X;}
-
- // vector addition
- Test operator+ (const Test& v) const {return Test (x+v.x);}
-
- // length squared
- float lengthSquared (void) const {return this->dot (*this);}
-
- static float distance (const Test& a, const Test& b){return(a-b).length();}
-
- inline Test parallelComponent (const Test& unitBasis) const {
- return unitBasis * projection;
- }
-
- Test setYtoZero (void) const {return Test (this->x);}
-
- static const Test zero;
- };
-
- inline Test operator* (float s, const Test& v) {return v*s;}
-
- inline std::ostream& operator<< (std::ostream& o, const Test& v)
- {
- return o << "(" << v.x << ")";
- }
-
- inline Test RandomUnitVectorOnXZPlane (void)
- {
- return RandomVectorInUnitRadiusSphere().setYtoZero().normalize();
- }
-}
-
-The interface used is:
-
-%module test
-%include "test.cpp"
-
-
-
-SWIG generates 3 files, the first one is a C wrap which we don't show,
- the second is the plain CFFI wrapper which is as shown below:
-
-
-(cffi:defcfun ("_wrap_Test_x_set" Test_x_set) :void
- (self :pointer)
- (x :float))
-
-(cffi:defcfun ("_wrap_Test_x_get" Test_x_get) :float
- (self :pointer))
-
-(cffi:defcfun ("_wrap_new_Test__SWIG_0" new_Test) :pointer)
-
-(cffi:defcfun ("_wrap_new_Test__SWIG_1" new_Test) :pointer
- (X :float))
-
-(cffi:defcfun ("_wrap_Test___add__" Test___add__) :pointer
- (self :pointer)
- (v :pointer))
-
-(cffi:defcfun ("_wrap_Test_lengthSquared" Test_lengthSquared) :float
- (self :pointer))
-
-(cffi:defcfun ("_wrap_Test_distance" Test_distance) :float
- (a :pointer)
- (b :pointer))
-
-(cffi:defcfun ("_wrap_Test_parallelComponent" Test_parallelComponent) :pointer
- (self :pointer)
- (unitBasis :pointer))
-
-(cffi:defcfun ("_wrap_Test_setYtoZero" Test_setYtoZero) :pointer
- (self :pointer))
-
-(cffi:defcvar ("Test_zero" Test_zero)
- :pointer)
-
-(cffi:defcfun ("_wrap_delete_Test" delete_Test) :void
- (self :pointer))
-
-(cffi:defcfun ("_wrap___mul__" __mul__) :pointer
- (s :float)
- (v :pointer))
-
-(cffi:defcfun ("_wrap___lshift__" __lshift__) :pointer
- (o :pointer)
- (v :pointer))
-
-(cffi:defcfun ("_wrap_RandomUnitVectorOnXZPlane" RandomUnitVectorOnXZPlane) :pointer)
-
-
-
-The output is pretty good but it fails in disambiguating overloaded
- functions such as the constructor, in this case. One way of
- resolving this problem is to make the interface use the rename
- directiv, but hopefully there are better solutions.
- In addition SWIG also generates, a CLOS file
-
-
-
-
-(clos:defclass test()
- ((ff :reader ff-pointer)))
-
-(clos:defmethod (cl:setf x) (arg0 (obj test))
- (Test_x_set (ff-pointer obj) arg0))
-
-(clos:defmethod x ((obj test))
- (Test_x_get (ff-pointer obj)))
-
-(cl:shadow "+")
-(clos:defmethod + ((obj test) (self test) (v test))
- (Test___add__ (ff-pointer obj) (ff-pointer self) (ff-pointer v)))
-
-(clos:defmethod length-squared ((obj test) (self test))
- (Test_lengthSquared (ff-pointer obj) (ff-pointer self)))
-
-(clos:defmethod parallel-component ((obj test) (self test) (unitBasis test))
- (Test_parallelComponent (ff-pointer obj) (ff-pointer self) (ff-pointer unitBasis)))
-
-(clos:defmethod set-yto-zero ((obj test) (self test))
- (Test_setYtoZero (ff-pointer obj) (ff-pointer self)))
-
-
-I agree that the CFFI C++ module needs lot more work. But I hope it
- provides a starting point, on which you can base your work of
- importing C++ libraries to Lisp.
-
-
-If you have any questions, suggestions, patches, etc., related to CFFI
- module feel free to contact us on the SWIG mailing list, and
- also please add a "[CFFI]" tag in the subject line.
-
-
-
-
-
-It is often necessary to include user-defined code
-into the automatically generated interface files. For example, when building
-a C++ interface, example_wrap.cxx will likely not compile unless
-you add a #include "header.h" directive. This can be done
-using the SWIG %insert(section) %{ ...code... %} directive:
-
-
-
-
-%module example
-
-%{
-#include "header.h"
-%}
-
-%include "header.h"
-
-int fact(int n);
-
-
-
-
-Additional sections have been added for inserting into the
-generated lisp interface file:
-
-
- lisphead - inserts before type declarations
- swiglisp - inserts after type declarations according to
- where it appears in the .i file
-
-
-Note that the block %{ ... %} is effectively a shortcut for
-%insert("header") %{ ... %} .
-
-
-
-
-
diff --git a/Doc/Manual/Lua.html b/Doc/Manual/Lua.html
index 682126dc9..8ea385b49 100644
--- a/Doc/Manual/Lua.html
+++ b/Doc/Manual/Lua.html
@@ -77,7 +77,7 @@
-Lua is an extension programming language designed to support general procedural programming with data description facilities. It also offers good support for object-oriented programming, functional programming, and data-driven programming. Lua is intended to be used as a powerful, light-weight configuration language for any program that needs one. Lua is implemented as a library, written in clean C (that is, in the common subset of ISO C and C++). It's also a really tiny language, less than 6000 lines of code, which compiles to <100 kilobytes of binary code. It can be found at http://www.lua.org
+Lua is an extension programming language designed to support general procedural programming with data description facilities. It also offers good support for object-oriented programming, functional programming, and data-driven programming. Lua is intended to be used as a powerful, light-weight configuration language for any program that needs one. Lua is implemented as a library, written in clean C (that is, in the common subset of ISO C and C++). It's also a really tiny language, less than 6000 lines of code, which compiles to <100 kilobytes of binary code. It can be found at https://www.lua.org
eLua stands for Embedded Lua (can be thought of as a flavor of Lua) and offers the full implementation of the Lua programming language to the embedded world, extending it with specific features for efficient and portable software embedded development. eLua runs on smaller devices like microcontrollers and provides the full features of the regular Lua desktop version. More information on eLua can be found here: http://www.eluaproject.net
@@ -566,7 +566,7 @@ If the -no-old-metatable-bindings option is used, then these old-style
It is worth mentioning, that example.Test.TEST1 and example.Test_TEST1 are different entities and changing one does not change the other.
-Given the fact that these are constantes and they are not supposed to be changed, it is up to you to avoid such issues.
+Given the fact that these are constants and they are not supposed to be changed, it is up to you to avoid such issues.
diff --git a/Doc/Manual/Makefile b/Doc/Manual/Makefile
index 9505adb91..0f9fe0e96 100644
--- a/Doc/Manual/Makefile
+++ b/Doc/Manual/Makefile
@@ -1,7 +1,7 @@
# Makefile for generating the SWIG documentation
#
# Note that the htmldoc package needs to be installed. wkhtmltopdf patched with qt is also required
-# and can be installed from http://wkhtmltopdf.org/downloads.html.
+# and the prebuilt binaries can be installed from https://wkhtmltopdf.org/downloads.html.
#
# The .html files are first processed and updated with chapter numbering and anchor names
# are added to the HTML headings using the python scripts. The htmldoc program is then
@@ -43,8 +43,8 @@ check:
# 3) elements do not always select a fixed-width font - try installing the
# Courier font to fix - these have been added to style.css.
generate: SWIGDocumentation.html
- wkhtmltopdf --version | grep "with patched qt" || (echo "wkhtmltopdf is not the patched qt version and so cannot be used - download it from http://wkhtmltopdf.org/downloads.html" && false)
- wkhtmltopdf --margin-top 20mm --margin-bottom 20mm --margin-left 10mm --margin-right 10mm --header-font-size 6 --footer-font-size 6 --header-spacing 6 --footer-spacing 6 --header-center '[doctitle]' --footer-left '[subsection]' --footer-right '[page]' SWIGDocumentation.html SWIGDocumentation.pdf
+ wkhtmltopdf --version | grep "with patched qt" || (echo "wkhtmltopdf is not the patched qt version and so cannot be used - download it from https://wkhtmltopdf.org/downloads.html" && false)
+ wkhtmltopdf --margin-top 20mm --margin-bottom 20mm --margin-left 10mm --margin-right 10mm --header-font-size 6 --footer-font-size 6 --header-spacing 6 --footer-spacing 6 --header-center '[doctitle]' --footer-left '[subsection]' --footer-right '[page]' --allow . SWIGDocumentation.html SWIGDocumentation.pdf
SWIGDocumentation.html: swightml.book
htmldoc --batch swightml.book || true
diff --git a/Doc/Manual/Ocaml.html b/Doc/Manual/Ocaml.html
index 9b59eec61..ffb9d2cde 100644
--- a/Doc/Manual/Ocaml.html
+++ b/Doc/Manual/Ocaml.html
@@ -85,7 +85,7 @@ variants, functions, classes, etc.
If you're not familiar with the Objective Caml language, you can visit
-The Ocaml Website .
+The Ocaml Website .
diff --git a/Doc/Manual/Octave.html b/Doc/Manual/Octave.html
index de39a1d96..ca38b4165 100644
--- a/Doc/Manual/Octave.html
+++ b/Doc/Manual/Octave.html
@@ -52,7 +52,7 @@
Octave is a high-level language intended for numerical programming that is mostly compatible with MATLAB.
-More information can be found at Octave web site .
+More information can be found at Octave web site .
@@ -625,6 +625,16 @@ On the C++ side, the default mappings are as follows:
Octave can also utilise friend (i.e. non-member) operators with a simple %rename: see the example in the Examples/octave/operator directory.
+
+Octave has several operators for which no corresponding C++ operators exist. For example, the Octave code
+
+
+
+calls the Octave operator horzcat of the class of a . Hence, if a is of type swig_ref you can write an overload for this operator for your wrapped C++ class by placing a file @swig_ref/horzcat.m in the Octave load path (like for every Octave class, see Creating a Class ). This Octave function file is then called whenever the above Octave code is executed for a variable of type swig_ref .
+
+
diff --git a/Doc/Manual/Perl5.html b/Doc/Manual/Perl5.html
index c130cdef4..d8f24b094 100644
--- a/Doc/Manual/Perl5.html
+++ b/Doc/Manual/Perl5.html
@@ -604,7 +604,7 @@ source has a list of macros that are known to conflict with either standard head
other headers. But if you get macro type conflicts from other macros not included
in Lib/perl5/noembed.h while compiling the wrapper, you will
have to find the macro that conflicts and add an #undef into the .i file. Please report
-any conflicting macros you find to swig-user mailing list .
+any conflicting macros you find to swig-user mailing list .
diff --git a/Doc/Manual/Php.html b/Doc/Manual/Php.html
index 72c914656..fad7f6a2f 100644
--- a/Doc/Manual/Php.html
+++ b/Doc/Manual/Php.html
@@ -30,6 +30,7 @@
Static Member Variables
Static Member Functions
Specifying Implemented Interfaces
+Dynamic Properties
PHP Pragmas, Startup and Shutdown code
@@ -634,18 +635,12 @@ variable, or assigning NULL to a variable.
-SWIG defaults to wrapping C++ structs and classes with PHP classes.
+SWIG wraps C++ structs and classes with PHP classes.
Since SWIG 4.1.0, this is done entirely via PHP's C API - earlier SWIG
versions generated a PHP wrapper script which defined proxy classes
which called a set of flat functions which actually wrapped the C++ class.
-
-If you don't want the class wrappers, you can pass the command-line option
-"-noproxy" in which case you'll get C++ classes wrapped as flat functions
-as described below.
-
-
This interface file
@@ -698,33 +693,16 @@ Member variables and methods are accessed using the -> operator.
-The -noproxy option flattens the object structure and
-generates collections of named functions. The above example results
-in the following PHP functions:
+SWIG/PHP used to support a -noproxy option to flatten the class
+structure and generate collections of named flat functions. This is no
+longer supported as of SWIG 4.1.0.
-
-new_Vector();
-Vector_x_set($obj, $d);
-Vector_x_get($obj);
-Vector_y_set($obj, $d);
-Vector_y_get($obj);
-Vector_z_set($obj, $d);
-Vector_z_get($obj);
-Vector_magnitude($obj);
-new_Complex();
-Complex_re_set($obj, $d);
-Complex_re_get($obj);
-Complex_im_set($obj, $d);
-Complex_im_get($obj);
-
-
-The constructor is called when new Object() (or
-new_Object() if using -noproxy ) is used to create an
+The constructor is called when new Object() is used to create an
instance of the object. If multiple constructors are defined for an
object, function overloading will be used to determine which
constructor to execute.
@@ -843,6 +821,53 @@ so:
If there are multiple interfaces, just list them separated by commas.
+
+
+
+
+
+Historically PHP has supported dynamic class properties and SWIG
+has implemented them too (because we implement the magic __get() ,
+__set() and __isset() methods we need to include explicit
+handling).
+
+
+
+PHP 8.2 deprecates
+dynamic class properties - initially they'll warn, and apparently they'll
+not work by default in PHP 9.0.
+
+
+
+In PHP code dynamic properties can be enabled for a class by
+marking that class with the attribute #[AllowDynamicProperties] .
+
+
+
+To follow this PHP change, as of SWIG 4.1.0 you now need enable dynamic
+properties for any classes you want to support them. To enable for class
+Foo :
+
+
+
+%feature("php:allowdynamicproperties", 1) Foo;
+
+
+
+or to enable them for all wrapped classes:
+
+
+
+%feature("php:allowdynamicproperties", 1);
+
+
+
+Note that unknown features are ignored, so you can add use these
+unconditionally in your interface file and it'll work with older SWIG too.
+
+
+
diff --git a/Doc/Manual/Preface.html b/Doc/Manual/Preface.html
index 41f21d48d..50a06d688 100644
--- a/Doc/Manual/Preface.html
+++ b/Doc/Manual/Preface.html
@@ -80,7 +80,7 @@ Some target languages were disabled as part of a clean up and others were given
The LICENSE file shipped with SWIG in the top level directory contains the SWIG license.
For further insight into the license including the license of SWIG's output code, please visit
-the SWIG legal page - http://www.swig.org/legal.html .
+the SWIG legal page - https://www.swig.org/legal.html .
@@ -98,7 +98,7 @@ The official location of SWIG related material is
@@ -111,7 +111,7 @@ You can also subscribe to the swig-user mailing list by visiting the page
@@ -125,7 +125,7 @@ about this can be obtained at:
@@ -231,7 +231,7 @@ detailed release notes for previous releases and summary release notes from SWIG
SWIG is an unfunded project that would not be possible without the
contributions of many people working in their spare time.
If you have benefitted from using SWIG, please consider
-Donating to SWIG to keep development going.
+Donating to SWIG to keep development going.
There have been a large varied number of people
who have made contributions at all levels over time. Contributors
are mentioned either in the COPYRIGHT file or CHANGES files shipped with SWIG or in submitted bugs.
@@ -244,8 +244,8 @@ are mentioned either in the COPYRIGHT file or CHANGES files shipped with SWIG or
Although every attempt has been made to make SWIG bug-free, we are also trying
to make feature improvements that may introduce bugs.
To report a bug, either send mail to the SWIG developer
-list at the swig-devel mailing list or report a bug
-at the SWIG bug tracker . In your report, be as specific as
+list at the swig-devel mailing list or report a bug
+at the SWIG bug tracker . In your report, be as specific as
possible, including (if applicable), error messages, tracebacks (if a
core dump occurred), corresponding portions of the SWIG interface file
used, and any important pieces of the SWIG generated wrapper code. We
@@ -273,15 +273,15 @@ the main SWIG distribution. There is no need to download anything else.
These installation instructions are for using the distributed tarball,
for example, swig-3.0.8.tar.gz .
If you wish to build and install from source on Github, extra steps are required.
-Please see the Bleeding Edge page on the SWIG website.
+Please see the Bleeding Edge page on the SWIG website.
-You must use GNU make to build and install SWIG.
+You must use GNU make to build and install SWIG.
-PCRE2
+PCRE2
needs to be installed on your system to build SWIG, in particular
pcre2-config must be available. If you have PCRE2 headers and libraries but not
pcre2-config itself or, alternatively, wish to override the compiler or linker
@@ -357,7 +357,7 @@ Note:
If you checked the code out via Git, you will have to run ./autogen.sh
before ./configure . In addition, a full build of SWIG requires
a number of packages to be installed. Full instructions at
-SWIG bleeding edge .
+SWIG bleeding edge .
diff --git a/Doc/Manual/Preprocessor.html b/Doc/Manual/Preprocessor.html
index 0d5cc6300..659cb6fa2 100644
--- a/Doc/Manual/Preprocessor.html
+++ b/Doc/Manual/Preprocessor.html
@@ -147,6 +147,14 @@ SWIGTCL Defined when using Tcl
SWIGXML Defined when using XML
+
+SWIG also defines SWIG_VERSION and a target language macro in
+the generated wrapper file (since SWIG 4.1.0 - in older versions these
+were defined for some target languages but this wasn't consistent). Best
+practice is to use SWIG-time conditional checks because that results in smaller
+generated wrapper sources.
+
+
In addition, SWIG defines the following set of standard C/C++ macros:
diff --git a/Doc/Manual/Python.html b/Doc/Manual/Python.html
index 0496299eb..a8c7d4c86 100644
--- a/Doc/Manual/Python.html
+++ b/Doc/Manual/Python.html
@@ -3128,9 +3128,7 @@ likely cause your program to segfault.
To help ensure that no references to the Python object remain after
calling __disown__() , this method returns a weak reference to
-the Python object. Weak references are only available in Python versions
-2.1 and higher, so for older versions you must explicitly delete all
-references. Here is an example:
+the Python object. Here is an example:
@@ -3504,7 +3502,7 @@ The insert code can be seen at the start of the generated
.py file:
-# This file was automatically generated by SWIG (http://www.swig.org).
+# This file was automatically generated by SWIG (https://www.swig.org).
# Version 4.0.0
#
# Do not make changes to this file unless you know what you are doing--modify
@@ -5377,10 +5375,9 @@ int SWIG_ConvertPtr(PyObject *obj, void **ptr, swig_type_info *ty, int flags)obj to a C pointer. The result of the conversion is placed
into the pointer located at ptr . ty is a SWIG type descriptor structure.
flags is used to handle error checking and other aspects of conversion. It is the
-bitwise-or of several flag values including SWIG_POINTER_EXCEPTION and
-SWIG_POINTER_DISOWN . The first flag makes the function raise an exception on type
-error. The second flag additionally
-steals ownership of an object. Returns 0 on success and -1 on error.
+bitwise-or of several flag values including SWIG_POINTER_DISOWN (which steals
+ownership of the object) and SWIG_POINTER_NO_NULL (which makes the conversion fail
+if the C pointer would be NULL ). Returns 0 on success and -1 on error.
diff --git a/Doc/Manual/R.html b/Doc/Manual/R.html
index 9b05922fd..0e9e55b8e 100644
--- a/Doc/Manual/R.html
+++ b/Doc/Manual/R.html
@@ -30,7 +30,7 @@
R is a GPL'ed open source statistical and plotting environment.
Information about R can be found at www.r-project.org .
+href="https://www.r-project.org/">www.r-project.org.
@@ -39,7 +39,7 @@ compile and run an R interface to QuantLib running on Mandriva Linux
with gcc. They are also used to create the SimpleITK R package, which
runs on Linux and MacOS. SWIG is used to create all wrapper
interfaces
-to SimpleITK . The R
+to SimpleITK . The R
bindings also work on Microsoft Windows using Visual C++.
@@ -321,7 +321,7 @@ and forth between integers.
The details of enumeration names and contents are stored in hidden R
-environments, which are named according the the enumeration name - for
+environments, which are named according to the enumeration name - for
example, an enumeration colour:
diff --git a/Doc/Manual/SWIG.html b/Doc/Manual/SWIG.html
index b7021c468..3fb41e522 100644
--- a/Doc/Manual/SWIG.html
+++ b/Doc/Manual/SWIG.html
@@ -134,11 +134,11 @@ Supported Target Language Options
-ruby - Generate Ruby wrappers
-scilab - Generate Scilab wrappers
-tcl8 - Generate Tcl 8 wrappers
+ -xml - Generate XML wrappers
Experimental Target Language Options
-mzscheme - Generate MzScheme/Racket wrappers
-ocaml - Generate OCaml wrappers
- -xml - Generate XML wrappers
General Options
-addextern - Add extra extern declarations
@@ -219,7 +219,7 @@ General Options
-Wall - Remove all warning suppression, also implies -Wextra
-Wallkw - Enable keyword warnings for all the supported languages
-Werror - Treat warnings as errors
- -Wextra - Adds the following additional warnings: 202,309,403,405,512,321,322
+ -Wextra - Adds the following additional warnings: 309,403,405,512,321,322
-w<list> - Suppress/add warning messages, eg -w401,+321 - see Warnings.html
-xmlout <file> - Write XML version of the parse tree to <file> after normal processing
@@ -2046,7 +2046,7 @@ and a more descriptive one, but the two functions are otherwise equivalent:
String after (Perl-like) regex substitution operation. This function
allows applying arbitrary regular expressions to the identifier names. The
pattern part is a regular expression in Perl syntax (as supported
- by the Perl Compatible Regular Expressions )
+ by the Perl Compatible Regular Expressions )
(PCRE2 library) and the subst string
can contain back-references of the form \N where N is a digit
from 0 to 9, or one of the following escape sequences: \l , \L ,
@@ -3664,8 +3664,8 @@ In the process of building an interface, SWIG may encounter syntax errors or
other problems. The best way to deal with this is to simply copy the offending
code into a separate interface file and edit it. However, the SWIG developers
have worked very hard to improve the SWIG parser--you should report parsing errors
-to the swig-devel mailing list or to the
-SWIG bug tracker .
+to the swig-devel mailing list or to the
+SWIG bug tracker .
diff --git a/Doc/Manual/SWIGPlus.html b/Doc/Manual/SWIGPlus.html
index 820c5088b..3c5e0620b 100644
--- a/Doc/Manual/SWIGPlus.html
+++ b/Doc/Manual/SWIGPlus.html
@@ -57,6 +57,7 @@
Function templates
Default template arguments
Template base classes
+Empty template instantiation
Template specialization
Member templates
Scoping and templates
@@ -254,7 +255,7 @@ details. The SWIG Wiki also has further details.
Compatibility Note: Early versions of SWIG generated just a flattened low-level C style API to C++ classes by default.
-The -noproxy commandline option is recognised by many target languages and will generate just this
+The -noproxy commandline option is recognised by some target languages and will generate just this
interface as in earlier versions.
@@ -2147,7 +2148,7 @@ This error means that the target language module supports overloading,
but for some reason there is no type-checking rule that can be used to
generate a working dispatch function. The resulting behavior is then
undefined. You should report this as a bug to the
-SWIG bug tracking database
+SWIG bug tracking database
if this is due to one of the typemaps supplied with SWIG.
@@ -2324,7 +2325,7 @@ members (of all classes):
Note: the *:: syntax is non-standard C++, but the '*' is meant to be a
wildcard that matches any class name (we couldn't think of a better
alternative so if you have a better idea, send email to
-the swig-devel mailing list .
+the swig-devel mailing list .
@@ -3261,10 +3262,28 @@ void foo(List<Integer> *x);
In this case, List<Integer> is exactly the same type as
List<int> . Any use of List<Integer> is mapped back to the
instantiation of List<int> created earlier. Therefore, it is
-not necessary to instantiate a new class for the type Integer (doing so is
-redundant and will simply result in code bloat).
+not correct to instantiate a new class for the type Integer .
+An attempt to do so such as:
+
+
+%template(intList) List<int>;
+%template(IntegerList) List<Integer>; // Ignored
+
+
+
+
+will result in the duplicate instantiation being ignored with a warning:
+
+
+
+
+example.i:48: Warning 404: Duplicate template instantiation of 'List< Integer >' with name 'IntegerList' ignored,
+example.i:47: Warning 404: previous instantiation of 'List< int >' with name 'intList'.
+
+
+
The template provided to %template for instantiation must be the actual template and not a typedef to a template.
@@ -3333,36 +3352,49 @@ original template definition. Template default arguments are supported. For ex
-template vector<typename T, int max=100> class vector {
+template <typename T, int max=100> class vector {
...
};
-%template(intvec) vector<int>; // OK
+%template(intvec) vector<int>; // OK
%template(vec1000) vector<int, 1000>; // OK
The %template directive should not be used to wrap the same
-template instantiation more than once in the same scope. This will
-generate an error. For example:
+template instantiation more than once. This also applies to default parameters
+where a template parameter specified in the instantiation is the same as the default parameter.
+For example:
-%template(intList) List<int>;
-%template(Listint) List<int>; // Error. Template already wrapped.
+%template(vec) vector<double>; // OK
+%template(vec100) vector<double, 100>; // Ignored
-This error is caused because the template expansion results in two
-identical classes with the same name. This generates a symbol table
-conflict. Besides, it probably more efficient to only wrap a specific
-instantiation only once in order to reduce the potential for code
-bloat.
+will warn:
+
+
+example.i:59: Warning 404: Duplicate template instantiation of 'vector< double,100 >' with name 'vec100' ignored,
+example.i:58: Warning 404: previous instantiation of 'vector< double >' with name 'vec'.
+
+
+
+
+If this was not ignored, the template expansion would result in two identical classes.
+An identical instantiation is only wrapped once in order to reduce code bloat.
+
+
+
+Compatibility Note : Versions prior to SWIG-4.2.0 would sometimes not detect and prevent duplicate
+instantiations, such as when the wrapped name was different.
+
@@ -3429,20 +3461,6 @@ code (and base classes need to be wrapped before derived classes).
Don't worry--if you get the order wrong, SWIG should generate a warning message.
-
-Occasionally, you may need to tell SWIG about base classes that are defined by templates,
-but which aren't supposed to be wrapped. Since SWIG is not able to automatically
-instantiate templates for this purpose, you must do it manually. To do this, simply
-use the empty template instantiation, that is, %template with no name. For example:
-
-
-
-
-// Instantiate traits<double, double>, but don't wrap it.
-%template() traits<double, double>;
-
-
-
If you have to instantiate a lot of different classes for many different types,
you might consider writing a SWIG macro. For example:
@@ -3468,7 +3486,66 @@ TEMPLATE_WRAP(PairStringInt, std::pair<string, int>)
Note the use of a vararg macro for the type T. If this wasn't used, the comma in the templated type in the last example would not be possible.
-
+
+
+
+
+Occasionally, you may need to tell SWIG about classes that are defined by templates,
+but which aren't supposed to be wrapped. Since SWIG is not able to automatically
+instantiate templates for this purpose, you must do it manually. To do this, simply
+use %template() , that is the empty template instantiation that omits providing a name. For example:
+
+
+
+
+template<typename T> struct Traits {
+ typedef T type;
+};
+%}
+
+%template() Traits<int>; // instantiate Traits<int>, but don't wrap it
+
+void traitor(Traits<int>::type val);
+
+
+
+
+Without a template instantiation, SWIG does not know that the first parameter to the traitor
+function is type int and passing an integer to this function from any target language won't work.
+The empty template instantiation adds the appropriate type information into SWIG's type system, without
+forcing one to wrap the Traits class.
+
+
+
+Duplicate template instantiation are not allowed, as described in the
+Default template arguments section above.
+There is one exception where a named template instantiation can be followed by an empty template instantiation.
+Duplicate empty template instantiations are silently ignored, unlike duplicate named template instantiations.
+
+
+
+Unlike template class instantiations, template function instantiations must have a name.
+Consider the following:
+
+
+
+
+template<class T> T tfunc(T x) { };
+%template() tfunc<double>;
+
+
+
+
+The empty template instantiation will be ignored with:
+
+
+
+
+example.i:9: Warning 519: %template() contains no name. Template method ignored: tfunc< double >(double)
+
+
+
+
@@ -3558,7 +3635,7 @@ SWIG implements template argument deduction so that the following partial specia
-
+
@@ -3770,7 +3847,7 @@ constructor, that will dispatch the proper call depending on the argument
type.
-
+
@@ -3871,7 +3948,7 @@ template class C<int>;
-
+
diff --git a/Doc/Manual/Scilab.html b/Doc/Manual/Scilab.html
index a8d34c592..95eea340f 100644
--- a/Doc/Manual/Scilab.html
+++ b/Doc/Manual/Scilab.html
@@ -80,7 +80,7 @@
-Scilab is a scientific software package for numerical computations providing a powerful open computing environment for engineering and scientific applications that is mostly compatible with MATLAB. More information can be found at www.scilab.org .
+Scilab is a scientific software package for numerical computations providing a powerful open computing environment for engineering and scientific applications that is mostly compatible with MATLAB. More information can be found at www.scilab.org .
@@ -2142,7 +2142,7 @@ clear get_file_path;
Example use cases can be found in the Examples/scilab directory.
The test suite in the Examples/test-suite/scilab can be another source of useful use cases.
-The Scilab API is used in the generated code and is a useful reference when examining the output.
-This guide describes the Scilab external modules structure and files, in particular the files that are generated by SWIG for Scilab.
+The Scilab API is used in the generated code and is a useful reference when examining the output.
+This guide describes the Scilab external modules structure and files, in particular the files that are generated by SWIG for Scilab.
diff --git a/Doc/Manual/Sections.html b/Doc/Manual/Sections.html
index 13a9a2181..4b8577adf 100644
--- a/Doc/Manual/Sections.html
+++ b/Doc/Manual/Sections.html
@@ -1,14 +1,14 @@
-SWIG-4.0 Documentation
+SWIG-4.2 Documentation
-
+
-Last update : SWIG-4.1.0 (in progress)
+Last update : SWIG-4.2.0 (in progress)
diff --git a/Doc/Manual/Varargs.html b/Doc/Manual/Varargs.html
index 80e391e49..b7dd4bc67 100644
--- a/Doc/Manual/Varargs.html
+++ b/Doc/Manual/Varargs.html
@@ -613,7 +613,7 @@ you need to bring out some bigger guns.
One way to do this is to use a special purpose library such as libffi
(http://www.sourceware.org/libffi/ ).
+href="https://www.sourceware.org/libffi/">https://www.sourceware.org/libffi/).
libffi is a library that allows you to dynamically construct
call-stacks and invoke procedures in a relatively platform independent
manner. Details about the library can be found in the libffi
diff --git a/Doc/Manual/Warnings.html b/Doc/Manual/Warnings.html
index bb20db38b..1ed629cc6 100644
--- a/Doc/Manual/Warnings.html
+++ b/Doc/Manual/Warnings.html
@@ -164,6 +164,15 @@ to provide additional diagnostics. These warnings can be turned on using the
+
+Preprocessor warning 202 ("Could not evaluate expression expr .") was
+formally off by default and enabled by -Wextra , but since SWIG 4.1.0
+this warning is on by default because suppressing it tends to hide genuine
+problems. If you really don't want to see it, you can suppress it with
+-w202 or using %warnfilter as described below. Both will work
+with older versions of SWIG too.
+
+
To selectively turn on extra warning messages, you can use the directives and options in the
previous section--simply add a "+" to all warning numbers. For example:
@@ -211,7 +220,7 @@ You can of course also enable all warnings and suppress a select few, for exampl
-The warnings on the right take precedence over the warnings on the left, so in the above example -Wextra adds numerous warnings including 452, but then -w309,452 overrides this and so 452 is suppressesed.
+The warnings on the right take precedence over the warnings on the left, so in the above example -Wextra adds numerous warnings including 452, but then -w309,452 overrides this and so 452 is suppressed.
@@ -429,6 +438,8 @@ example.i(4) : Syntax error in input(1).
325. Nested kind not currently supported (name ignored).
326. Deprecated %extend name used - the kind name 'name ' should be used instead of the typedef name 'name '.
327. Extern template ignored.
+ 340. Lambda expressions and closures are not fully supported yet.
+ 344. Unable to deduce decltype for 'expr '.
350. operator new ignored.
351. operator delete ignored.
352. operator+ ignored.
@@ -484,6 +495,7 @@ example.i(4) : Syntax error in input(1).
401. Nothing known about class 'name'. Ignored.
402. Base class 'name' is incomplete.
403. Class 'name' might be abstract.
+ 404. Duplicate template instantiation of 'type ' with name 'name ' ignored, previous instantiation of 'type ' with name 'name '.
450. Reserved
451. Setting const char * variable may leak memory.
452. Reserved
diff --git a/Doc/Manual/Windows.html b/Doc/Manual/Windows.html
index 7a39e88f3..3bbfc9028 100644
--- a/Doc/Manual/Windows.html
+++ b/Doc/Manual/Windows.html
@@ -60,7 +60,7 @@ Usage within the Unix like environments MinGW and Cygwin is also detailed.
SWIG does not come with the usual Windows type installation program, however it is quite easy to get started. The main steps are:
- Download the swigwin zip package from the SWIG website and unzip into a directory. This is all that needs downloading for the Windows platform.
+ Download the swigwin zip package from the SWIG website and unzip into a directory. This is all that needs downloading for the Windows platform.
Set environment variables as described in the SWIG Windows Examples section in order to run examples using Visual C++.
@@ -220,7 +220,7 @@ Normally this is not needed, so most people will want to ignore this section.
There are various ways to build the SWIG executable including CMake which is able to generate project files for building with Visual Studio.
-SWIG can also be compiled and run using MSYS2 , Cygwin or MinGW , all of which provide a Unix like front end to Windows and comes free with the gcc C/C++ compiler.
+SWIG can also be compiled and run using MSYS2 , Cygwin or MinGW , all of which provide a Unix like front end to Windows and comes free with the gcc C/C++ compiler.
@@ -230,7 +230,7 @@ SWIG can also be compiled and run using MSYS2
SWIG can be built using CMake and Visual Studio rather than autotools. As with the other approaches to
building SWIG the dependencies need to be installed. The steps below are one of a number of ways of installing the dependencies without requiring Cygwin or MinGW.
-For fully working build steps always check the Continuous Integration (CI) setups currently detailed in the Appveyor YAML file .
+For fully working build steps always check the Continuous Integration (CI) setups currently detailed in the GitHub Actions YAML file .
@@ -240,6 +240,7 @@ For fully working build steps always check the Continuous Integration (CI) setup
Install CMake-win64 Nuget package using the following command: C:\Tools\nuget install CMake-win64 -Version 3.15.5 -OutputDirectory C:\Tools\CMake
+ Using PowerShell the equivalent syntax is: & "C:\Tools\nuget" install CMake-win64 -Version 3.15.5 -OutputDirectory C:\Tools\CMake
Alternatively you can download CMake from https://cmake.org/download/ .
@@ -248,44 +249,48 @@ For fully working build steps always check the Continuous Integration (CI) setup
and save to a folder e.g. C:\Tools\Bison
- Unfortunately, PCRE2 is not yet available on Nuget. Instead we will use CMake to build and install PCRE2 to C:\Tools\pcre2 using the following commands:
-
-cd C:\
-SET PATH=C:\Tools\CMake\CMake-win64.3.15.5\bin;%PATH%
-git clone https://github.com/PhilipHazel/pcre2.git
-cd pcre2
-cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX=C:/Tools/pcre2 -S . -B build
-cmake --build build --config Release --target install
-
- Alternatively, set WITH_PCRE=OFF to disable PCRE2 support if you are sure you do not require it.
+ Install the PCRE2 Nuget package using the following command: C:\Tools\nuget install PCRE2 -Version 10.39 -OutputDirectory C:\Tools\pcre2
+ Note this is a x64 build, if this is not suitable PCRE2 can be built from source using https://github.com/PhilipHazel/pcre2/ .
+ Alternatively, set WITH_PCRE=OFF to disable PCRE2 support if you are sure you do not require it.
We will also need the SWIG source code. Either download a zipped archive from GitHub, or if git is installed clone the latest codebase
- using git clone https://github.com/swig/swig.git
+ using: git clone https://github.com/swig/swig.git
In this example we are assuming the source code is available at C:\swig
- Now we have all the required dependencies we can build SWIG using the commands below. We are assuming Visual Studio 2019 is installed. For other versions of Visual Studio change "Visual Studio 16 2019 -A x64" to the relevant
+ Now we have all the required dependencies we can build SWIG using PowerShell and the commands below. We are assuming Visual Studio 2019 is installed. For other versions of Visual Studio change "Visual Studio 16 2019 -A x64" to the relevant
Visual Studio Generator and
architecture. We add the required build tools to the system PATH, and then
build a Release version of SWIG. If all runs successfully a new swig.exe should be generated in the C:/swig/install2/bin folder.
-
-cd C:\swig
-SET PATH=C:\Tools\CMake\CMake-win64.3.15.5\bin;C:\Tools\bison\Bison.3.7.4\bin;%PATH%
-SET PCRE_ROOT=C:/Tools/pcre2
-SET PCRE_PLATFORM=x64
-cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX="%CD:\=/%/install2" -DCMAKE_C_FLAGS="/DPCRE2_STATIC" ^
--DCMAKE_CXX_FLAGS="/DPCRE2_STATIC" -DPCRE2_INCLUDE_DIR=%PCRE_ROOT%/include -DPCRE2_LIBRARY=%PCRE_ROOT%/lib/pcre2-8-static.lib -S . -B build
-cmake --build build --config Release --target install
-
-REM to test the exe
-cd install2/bin
-swig.exe -help
-
+
+cd C:\swig
+
+$env:PATH="C:\Tools\CMake\CMake-win64.3.15.5\bin;C:\Tools\bison\Bison.3.7.4\bin;" + $env:PATH
+$PCRE_ROOT="C:\Tools\pcre2\PCRE2.10.39.0"
+$PCRE_PLATFORM="x64"
+
+cmake -G "Visual Studio 16 2019" -A "x64" `
+-DCMAKE_INSTALL_PREFIX="C:/swig/install2" `
+-DCMAKE_C_FLAGS="/DPCRE2_STATIC" `
+-DCMAKE_CXX_FLAGS="/DPCRE2_STATIC" `
+-DPCRE2_INCLUDE_DIR="$PCRE_ROOT/include" `
+-DPCRE2_LIBRARY="$PCRE_ROOT/lib/pcre2-8-static.lib" `
+-S . -B build
+
+cmake --build build --config Release
+cmake --install build --config Release
+
+# to test the exe built correctly
+cd install2/bin
+./swig.exe -version
+./swig.exe -help
+
+
In addition to Release builds you can create a Debug build using:
@@ -359,13 +364,13 @@ The short abbreviated instructions follow...
- Install MinGW and MSYS from the MinGW site. This provides a Unix environment on Windows.
+ Install MinGW and MSYS from the MinGW site. This provides a Unix environment on Windows.
Follow the usual Unix instructions in the README file in the SWIG root directory to build swig.exe from the MinGW command prompt.
The step by step instructions to download and install MinGW and MSYS, then download and build the latest version of SWIG from Github follow...
-Note that the instructions for obtaining SWIG from Github are also online at SWIG Bleeding Edge .
+Note that the instructions for obtaining SWIG from Github are also online at SWIG Bleeding Edge .
@@ -375,8 +380,7 @@ Execute the steps in the order shown and don't use spaces in path names. In fact
- Download the following packages from the MinGW download page
- or MinGW SourceForge download page .
+ Download the following packages from the MinGW download page .
Note that at the time of writing, the majority of these are in the Current
release list and some are in the Snapshot or Previous release list.
@@ -448,7 +452,7 @@ the autotools will fail miserably on those.
The PCRE2 third party library needs to be built next.
Download the latest PCRE2 source tarball, such as pcre2-10.39.tar.bz2 , from
-www.pcre.org and place in the /usr/src/swig directory.
+www.pcre.org and place in the /usr/src/swig directory.
Build PCRE2 as a static library using the Tools/pcre-build.sh script as follows:
diff --git a/Doc/Manual/index.html b/Doc/Manual/index.html
index e720e70d0..2c44e6759 100644
--- a/Doc/Manual/index.html
+++ b/Doc/Manual/index.html
@@ -1,11 +1,11 @@
-SWIG-4.0 Documentation
+SWIG-4.1 Documentation
-
+
The SWIG documentation is available in one of the following formats.
diff --git a/Examples/Makefile.in b/Examples/Makefile.in
index 06c028e51..7b40ba653 100644
--- a/Examples/Makefile.in
+++ b/Examples/Makefile.in
@@ -148,347 +148,373 @@ swiginvoke:
$(SWIG) $(SWIGOPT)
##################################################################
-##### Tcl/Tk ######
+##### ANDROID ######
##################################################################
-# Set these to your local copy of Tcl/Tk.
+ANDROID = @ANDROID@
+ANDROID_NDK_BUILD = @NDKBUILD@
+ANDROID_ADB = @ADB@
+ANT = @ANT@
+TARGETID = 1
-TCLSH = tclsh
-TCL_INCLUDE = @TCLINCLUDE@
-TCL_LIB = @TCLLIB@
-TCL_OPTS = @LIBS@
-TK_OPTS = -ltk -ltcl @LIBS@
+# ----------------------------------------------------------------
+# Build an Android dynamically loadable module (C)
+# ----------------------------------------------------------------
-# Extra Tcl specific dynamic linking options
-TCL_DLNK = @TCLDYNAMICLINKING@
-TCL_SO = @TCL_SO@
-TCLLDSHARED = @TCLLDSHARED@
-TCLCXXSHARED = @TCLCXXSHARED@
-TCL_SCRIPT = $(SRCDIR)$(RUNME).tcl
-TCL_LINK = @TCLLINK@
+android: $(SRCDIR_SRCS)
+ $(ANDROID) $(SILENT_OPTION) update project --target $(TARGETID) --name $(PROJECTNAME) --path .
+ $(SWIG) -java $(SWIGOPT) -o $(INTERFACEDIR)$(TARGET)_wrap.c $(INTERFACEPATH)
+ +$(ANDROID_NDK_BUILD) $(SILENT_PIPE)
+ $(ANT) $(ANT_QUIET) debug
-# -----------------------------------------------------------
-# Build a new version of the tclsh shell
-# -----------------------------------------------------------
+# ----------------------------------------------------------------
+# Build an Android dynamically loadable module (C++)
+# ----------------------------------------------------------------
-tclsh: $(SRCDIR_SRCS)
- $(SWIG) -tcl8 $(SWIGOPT) $(TCL_SWIGOPTS) -ltclsh.i -o $(ISRCS) $(INTERFACEPATH)
- $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES) $(TCL_INCLUDE) \
- $(TCL_LIB) $(TCL_OPTS) $(LIBS) $(SYSLIBS) -o $(TARGET)
+android_cpp: $(SRCDIR_SRCS)
+ $(ANDROID) $(SILENT_OPTION) update project --target $(TARGETID) --name $(PROJECTNAME) --path .
+ $(SWIG) -java -c++ $(SWIGOPT) -o $(INTERFACEDIR)$(TARGET)_wrap.cpp $(INTERFACEPATH)
+ +$(ANDROID_NDK_BUILD) $(SILENT_PIPE)
+ $(ANT) $(ANT_QUIET) debug
-tclsh_cpp: $(SRCDIR_SRCS)
- $(SWIG) -tcl8 -c++ $(SWIGOPT) $(TCL_SWIGOPTS) -ltclsh.i -o $(ICXXSRCS) $(INTERFACEPATH)
- $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(TCL_INCLUDE) \
- $(TCL_LIB) $(TCL_OPTS) $(LIBS) $(SYSLIBS) -o $(TARGET)
+# ----------------------------------------------------------------
+# Android install
+# ----------------------------------------------------------------
-# -----------------------------------------------------------
-# Build a Tcl dynamic loadable module (you might need to tweak this)
-# -----------------------------------------------------------
-
-tcl: $(SRCDIR_SRCS)
- $(SWIG) -tcl8 $(SWIGOPT) $(TCL_SWIGOPTS) -o $(ISRCS) $(INTERFACEPATH)
- $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES) $(TCL_INCLUDE)
- $(TCLLDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(TCL_DLNK) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(TCL_SO) $(TCL_LINK)
-
-# -----------------------------------------------------------
-# Build a Tcl dynamic loadable module for C++
-# -----------------------------------------------------------
-
-tcl_cpp: $(SRCDIR_SRCS)
- $(SWIG) -tcl8 -c++ $(SWIGOPT) $(TCL_SWIGOPTS) -o $(ICXXSRCS) $(INTERFACEPATH)
- $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(TCL_INCLUDE)
- $(TCLCXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(TCL_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(TCL_SO) $(TCL_LINK)
-
-# -----------------------------------------------------------------
-# Run Tcl example
-# -----------------------------------------------------------------
-
-tcl_run:
- $(RUNTOOL) $(TCLSH) $(TCL_SCRIPT) $(RUNPIPE)
+android_install:
+ -$(ANDROID_ADB) uninstall $(PACKAGENAME)
+ $(ANDROID_ADB) install $(INSTALLOPTIONS) bin/$(PROJECTNAME)-debug.apk
# -----------------------------------------------------------------
# Version display
# -----------------------------------------------------------------
-tcl_version:
- echo 'puts $$tcl_version;exit 0' | $(TCLSH)
+android_version:
+ $(ANDROID_ADB) version
# -----------------------------------------------------------------
-# Cleaning the Tcl examples
+# Cleaning the Android examples
# -----------------------------------------------------------------
-tcl_clean:
- rm -f *_wrap* *~ .~* mytclsh@EXEEXT@
+android_clean:
+ test -n "$(SRCDIR)" && cd $(SRCDIR) ; $(ANT) -q -logfile /dev/null clean
+ rm -f $(INTERFACEDIR)$(TARGET)_wrap.*
+ rm -f `find $(PACKAGEDIR) -name \*.java | grep -v $(PROJECTNAME).java`
+ rm -rf obj
+
+##################################################################
+##### CSHARP ######
+##################################################################
+
+# Extra CSharp specific dynamic linking options
+CSHARP_DLNK = @CSHARPDYNAMICLINKING@
+CSHARP_LIBPREFIX = @CSHARPLIBRARYPREFIX@
+CSHARPCOMPILER = @CSHARPCOMPILER@
+CSHARPCILINTERPRETER = @CSHARPCILINTERPRETER@
+CSHARPCILINTERPRETER_FLAGS = @CSHARPCILINTERPRETER_FLAGS@
+CSHARPCFLAGS = @CSHARPCFLAGS@
+CSHARPFLAGS =
+CSHARPOPTIONS =
+CSHARPSO = @CSHARPSO@
+CSHARP_RUNME = ./$(RUNME).exe
+
+# ----------------------------------------------------------------
+# Build a CSharp dynamically loadable module (C)
+# ----------------------------------------------------------------
+
+csharp: $(SRCDIR_SRCS)
+ $(SWIG) -csharp $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
+ $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(CSHARPCFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES)
+ $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(CSHARP_DLNK) $(LIBS) -o $(CSHARP_LIBPREFIX)$(TARGET)$(CSHARPSO)
+
+# ----------------------------------------------------------------
+# Build a CSharp dynamically loadable module (C++)
+# ----------------------------------------------------------------
+
+csharp_cpp: $(SRCDIR_SRCS)
+ $(SWIG) -csharp -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
+ $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(CSHARPCFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES)
+ $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(CSHARP_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(CSHARP_LIBPREFIX)$(TARGET)$(CSHARPSO)
+
+# ----------------------------------------------------------------
+# Compile CSharp files
+# ----------------------------------------------------------------
+
+ifneq (,$(SRCDIR))
+SRCDIR_CSHARPSRCS = $(addprefix $(SRCDIR),$(CSHARPSRCS))
+else
+SRCDIR_CSHARPSRCS =
+endif
+
+csharp_compile: $(SRCDIR_SRCS)
+ $(COMPILETOOL) $(CSHARPCOMPILER) $(CSHARPFLAGS) $(CSHARPOPTIONS) $(CSHARPSRCS) $(SRCDIR_CSHARPSRCS)
+
+# -----------------------------------------------------------------
+# Run CSharp example
+# -----------------------------------------------------------------
+
+csharp_run:
+ env LD_LIBRARY_PATH=$$PWD $(RUNTOOL) $(CSHARPCILINTERPRETER) $(CSHARPCILINTERPRETER_FLAGS) $(CSHARP_RUNME) $(RUNPIPE)
+
+# -----------------------------------------------------------------
+# Version display
+# -----------------------------------------------------------------
+
+# Version check below also works with MS csc.exe which does not understand --version
+csharp_version:
+ $(CSHARPCOMPILER) --version | head -n 1
+ if test -n "$(CSHARPCILINTERPRETER)" ; then "$(CSHARPCILINTERPRETER)" --version ; fi
+
+# -----------------------------------------------------------------
+# Cleaning the CSharp examples
+# -----------------------------------------------------------------
+
+csharp_clean:
+ rm -f *_wrap* *~ .~* $(RUNME) $(RUNME).exe *.exe.mdb gc.log `find . -name \*.cs | grep -v $(RUNME).cs`
rm -f core @EXTRA_CLEAN@
- rm -f *.@OBJEXT@ *$(TCL_SO)
+ rm -f *.@OBJEXT@ *@CSHARPSO@
##################################################################
-##### PERL 5 ######
+##### D ######
##################################################################
-# You need to set this variable to the Perl5 directory containing the
-# files "perl.h", "EXTERN.h" and "XSUB.h". With Perl5.003, it's
-# usually something like /usr/local/lib/perl5/arch-osname/5.003/CORE.
+DLIBPREFIX = @DLIBPREFIX@
-PERL5_INCLUDE= @PERL5EXT@
+ifeq (,$(D_VERSION))
+ D_VERSION = @DDEFAULTVERSION@
+endif
-# Extra Perl specific dynamic linking options
-PERL5_DLNK = @PERL5DYNAMICLINKING@
-PERL5_CCFLAGS = @PERL5CCFLAGS@
-PERL5_CCDLFLAGS = @PERL5CCDLFLAGS@
-PERL5_CCCDLFLAGS = @PERL5CCCDLFLAGS@
-PERL5_LDFLAGS = @PERL5LDFLAGS@
-PERL = @PERL@
-PERL5_LIB = -L$(PERL5_INCLUDE) -l@PERL5LIB@ @LIBS@ $(SYSLIBS)
-PERL5_SCRIPT = $(SRCDIR)$(RUNME).pl
+ifeq (2,$(D_VERSION))
+ SWIGD = $(SWIG) -d -d2
+ DCOMPILER = @D2COMPILER@
+else
+ SWIGD = $(SWIG) -d
+ DCOMPILER = @D1COMPILER@
+endif
+
+D_RUNME = ./$(RUNME)
# ----------------------------------------------------------------
-# Build a Perl5 dynamically loadable module (C)
+# Build a dynamically loadable D wrapper for a C module
# ----------------------------------------------------------------
-perl5: $(SRCDIR_SRCS)
- $(SWIG) -perl5 $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
- $(CC) -c -Dbool=char $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES) $(PERL5_CCFLAGS) $(PERL5_CCCDLFLAGS) -I$(PERL5_INCLUDE)
- $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(PERL5_CCDLFLAGS) $(OBJS) $(IOBJS) $(PERL5_LDFLAGS) $(PERL5_DLNK) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO)
+d: $(SRCDIR_SRCS)
+ $(SWIGD) $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
+ $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(DCFLAGS) $(EXTRA_CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES)
+ $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(DCFLAGS) $(EXTRA_LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(DLIBPREFIX)$(TARGET)$(SO)
# ----------------------------------------------------------------
-# Build a Perl5 dynamically loadable module (C++)
+# Build a dynamically loadable D wrapper for a C++ module
# ----------------------------------------------------------------
-perl5_cpp: $(SRCDIR_SRCS)
- $(SWIG) -perl5 -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
- $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(PERL5_CCFLAGS) $(PERL5_CCCDLFLAGS) -I$(PERL5_INCLUDE)
- $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(PERL5_CCDLFLAGS) $(OBJS) $(IOBJS) $(PERL5_LDFLAGS) $(PERL5_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO)
+d_cpp: $(SRCDIR_SRCS)
+ $(SWIGD) -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
+ $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(DCFLAGS) $(EXTRA_CFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES)
+ $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(DCFLAGS) $(EXTRA_LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(DLIBPREFIX)$(TARGET)$(SO)
# ----------------------------------------------------------------
-# Build a module from existing XS C source code. (ie. from xsubpp).
-# ----------------------------------------------------------------
-perl5_xs: $(SRCDIR_SRCS)
- $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(INCLUDES) -I$(PERL5_INCLUDE)
- $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $(TARGET)$(SO)
-
-# ----------------------------------------------------------------
-# Build a statically linked Perl5 executable
+# Compile D files
# ----------------------------------------------------------------
-perl5_static: $(SRCDIR_SRCS)
- $(SWIG) -perl5 -static -lperlmain.i $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
- $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -Dbool=char $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES) -I$(PERL5_INCLUDE) $(PERL5_LIB) $(LIBS) -o $(TARGET)
-
-perl5_static_cpp: $(SRCDIR_SRCS)
- $(SWIG) -perl5 -c++ -static -lperlmain.i $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
- $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES) -I$(PERL5_INCLUDE) $(PERL5_LIB) $(LIBS) -o $(TARGET)
+# Clear the DFLAGS environment variable for the compiler call itself
+# to work around a discrepancy in argument handling between DMD and LDC.
+d_compile: $(SRCDIR_SRCS)
+ DFLAGS="" $(COMPILETOOL) $(DCOMPILER) $(DFLAGS) $(DSRCS)
# -----------------------------------------------------------------
-# Running a Perl5 example
+# Run D example
# -----------------------------------------------------------------
-perl5_run:
- $(RUNTOOL) $(PERL) -I. $(PERL5_SCRIPT) $(RUNPIPE)
+d_run:
+ env LD_LIBRARY_PATH=$$PWD $(RUNTOOL) $(D_RUNME) $(RUNPIPE)
# -----------------------------------------------------------------
# Version display
# -----------------------------------------------------------------
-perl5_version:
- $(PERL) -v | grep "This is"
+d_version:
+ ($(DCOMPILER) --version 2> /dev/null || $(DCOMPILER)) | head -n 3
# -----------------------------------------------------------------
-# Cleaning the Perl5 examples
+# Clean the D examples
# -----------------------------------------------------------------
-perl5_clean:
- rm -f *_wrap* *~ .~* myperl@EXEEXT@ *.pm
+d_clean:
+ rm -f *_wrap* *~ .~* $(RUNME) $(RUNME).exe `find . -name \*.d | grep -v $(RUNME).d`
rm -f core @EXTRA_CLEAN@
rm -f *.@OBJEXT@ *@SO@
##################################################################
-##### PYTHON ######
+##### Go ######
##################################################################
-PYTHON_FLAGS =
+# TODO: The Go make targets need simplifying to use configure time
+# configuration or to use Make's ifeq rather than using lots of
+# runtime shell code. The output will then be a lot less verbose.
-# Make sure these locate your Python installation
-ifneq (,$(PY2))
- PYTHON_INCLUDE= $(DEFS) @PYINCLUDE@
- PYTHON_LIB = @PYLIB@
- PYTHON = @PYTHON@ $(PYTHON_FLAGS)
-else
- PYTHON_INCLUDE= $(DEFS) @PY3INCLUDE@
- PYTHON_LIB = @PY3LIB@
- PYTHON = @PYTHON3@ $(PYTHON_FLAGS)
-endif
+GO = @GO@
+GOGCC = @GOGCC@
+GCCGO = @GCCGO@
+GOOPT = @GOOPT@
+GCCGOOPT = @GCCGOOPT@
+GOVERSIONOPTION = @GOVERSIONOPTION@
-# Extra Python specific linking options
-ifneq (,$(PY2))
- PYTHON_DLNK = @PYTHONDYNAMICLINKING@
- PYTHON_LINK = @PYLINK@
-else
- PYTHON_DLNK = @PYTHON3DYNAMICLINKING@
- PYTHON_LINK = @PY3LINK@
-endif
-PYTHON_SO = @PYTHON_SO@
+GOSWIGARG = `if $(GOGCC) ; then echo -gccgo; fi`
-PYCODESTYLE = @PYCODESTYLE@
-PYCODESTYLE_FLAGS = --ignore=E252,E30,E402,E501,E731,W291,W391
+GOSRCS = $(INTERFACE:.i=.go)
+GOCSRCS = $(INTERFACE:.i=_gc.c)
+
+GOPACKAGE = $(notdir $(INTERFACE:.i=.a))
+
+GOPATHPARENTDIR = gopath/$(GOMOD)/src
+GOPATHDIR = $(GOPATHPARENTDIR)/$(INTERFACE:.i=)
# ----------------------------------------------------------------
-# Build a C dynamically loadable module
+# Build a Go module (C)
# ----------------------------------------------------------------
-python: $(SRCDIR_SRCS)
- $(SWIG) -python $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
- $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(ISRCS) $(SRCDIR_SRCS) $(INCLUDES) $(PYTHON_INCLUDE)
- $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(PYTHON_DLNK) $(LIBS) -o $(LIBPREFIX)_$(TARGET)$(PYTHON_SO)
+$(GOPATHPARENTDIR)/go.mod:
+ @mkdir gopath 2>/dev/null || true
+ @mkdir gopath/$(GOMOD) 2>/dev/null || true
+ @mkdir gopath/$(GOMOD)/src 2>/dev/null || true
+ @mkdir $(GOPATHDIR) 2>/dev/null || true
+ echo "module swigtests" > $(GOPATHDIR)/go.mod
+ echo "" >> $(GOPATHDIR)/go.mod
+ echo "go 1.12" >> $(GOPATHDIR)/go.mod
+ mv -f $(GOPATHDIR)/go.mod $(GOPATHPARENTDIR)/go.mod
-# -----------------------------------------------------------------
-# Build a C++ dynamically loadable module
-# -----------------------------------------------------------------
-
-python_cpp: $(SRCDIR_SRCS)
- $(SWIG) -python -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
- $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) $(PYTHON_INCLUDE)
- $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(PYTHON_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)_$(TARGET)$(PYTHON_SO)
-
-# -----------------------------------------------------------------
-# Build statically linked Python interpreter
-#
-# These should only be used in conjunction with the %include embed.i
-# library file
-# -----------------------------------------------------------------
-
-#TKINTER = -L/usr/X11R6.3/lib -L/usr/local/compat/lib -ltk4.0 -ltcl7.4 -lX11
-TKINTER =
-PYTHON_LIBOPTS = $(PYTHON_LINK) @LIBS@ $(TKINTER) $(SYSLIBS)
-
-python_static: $(SRCDIR_SRCS)
- $(SWIG) -python -lembed.i $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
- $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) @LINKFORSHARED@ $(ISRCS) $(SRCDIR_SRCS) $(INCLUDES) \
- $(PYTHON_INCLUDE) $(LIBS) -L$(PYTHON_LIB) $(PYTHON_LIBOPTS) -o $(TARGET)
-
-python_static_cpp: $(SRCDIR_SRCS)
- $(SWIG) -python -c++ -lembed.i $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
- $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) \
- $(PYTHON_INCLUDE) $(LIBS) -L$(PYTHON_LIB) $(PYTHON_LIBOPTS) -o $(TARGET)
-
-# -----------------------------------------------------------------
-# Running a Python example
-# -----------------------------------------------------------------
-
-PYSCRIPT = $(RUNME).py
-
-python_run: $(PYSCRIPT)
-ifneq (,$(PYCODESTYLE))
- $(COMPILETOOL) $(PYCODESTYLE) $(PYCODESTYLE_FLAGS) $(PYSCRIPT)
-endif
- env PYTHONPATH=$$PWD $(RUNTOOL) $(PYTHON) $(PYSCRIPT) $(RUNPIPE)
-
-ifneq (,$(SRCDIR))
-$(RUNME).py: $(SRCDIR)$(RUNME).py
- cp $< $@
-endif
-
-# -----------------------------------------------------------------
-# Version display
-# -----------------------------------------------------------------
-
-python_version:
- $(PYTHON) -V
-
-# -----------------------------------------------------------------
-# Cleaning the python examples
-# -----------------------------------------------------------------
-
-python_clean:
- rm -rf __pycache__
- rm -f *_wrap* *~ .~* mypython@EXEEXT@ *.pyc
- rm -f core @EXTRA_CLEAN@
- rm -f *.@OBJEXT@ *@SO@ *$(PYTHON_SO)
- rm -f $(TARGET).py
- case "x$(SRCDIR)" in x|x./);; *) rm -f $(RUNME).py;; esac
-
-
-##################################################################
-##### OCTAVE ######
-##################################################################
-
-# Make sure these locate your Octave installation
-OCTAVE = @OCTAVE@
-OCTAVE_CXX = $(DEFS) @OCTAVE_CPPFLAGS@ @OCTAVE_CXXFLAGS@
-
-# Extra Octave specific dynamic linking options
-OCTAVE_DLNK = @OCTAVE_LDFLAGS@
-OCTAVE_SO = @OCTAVE_SO@
-
-OCTAVE_SCRIPT = $(SRCDIR)$(RUNME).m
-
-# ----------------------------------------------------------------
-# Pre-compile Octave headers, if supported
-# ----------------------------------------------------------------
-
-ifeq (yes,$(PCHSUPPORT))
-
-octave_precompile_headers:
- echo "precompiling $(OCTHEADERS)"
- cp -f $(OCTHEADERSSRC) $(OCTHEADERS)
- if $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) $(OCTAVE_CXX) $(OCTHEADERS); then \
- : ; \
- else \
- rm -f $(OCTHEADERSGCH); \
- exit 1; \
+go: $(SRCDIR_SRCS) $(GOPATHPARENTDIR)/go.mod
+ $(SWIG) -go -import-prefix swigtests $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
+ @mkdir gopath 2>/dev/null || true
+ @mkdir gopath/$(GOMOD) 2>/dev/null || true
+ @mkdir gopath/$(GOMOD)/src 2>/dev/null || true
+ @mkdir $(GOPATHDIR) 2>/dev/null || true
+ rm -rf $(GOPATHDIR)/*
+ cp $(ISRCS) $(GOPATHDIR)/
+ if test -f $(IWRAP:.i=.h); then \
+ cp $(IWRAP:.i=.h) $(GOPATHDIR)/; \
+ fi
+ if test -n "$(SRCDIR_SRCS)"; then \
+ cp $(SRCDIR_SRCS) $(GOPATHDIR)/; \
+ fi
+ cp $(GOSRCS) $(GOPATHDIR)/
+ @if test -f $(SRCDIR)$(RUNME).go; then \
+ mkdir gopath/$(GOMOD)/src/runme 2>/dev/null || true; \
+ rm -f gopath/$(GOMOD)/src/runme/*; \
+ fi
+ if test -f $(SRCDIR)$(RUNME).go; then \
+ cp $(SRCDIR)$(RUNME).go gopath/$(GOMOD)/src/runme/; \
+ fi
+ GOPATH=`pwd`/gopath/$(GOMOD); \
+ export GOPATH; \
+ CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) -I `cd $(SRCDIR) && pwd` -I `pwd`"; \
+ export CGO_CPPFLAGS; \
+ CGO_CFLAGS="$(CFLAGS)"; \
+ export CGO_CFLAGS; \
+ CGO_LDFLAGS="$(LDFLAGS) -lm"; \
+ export CGO_LDFLAGS; \
+ (cd $(GOPATHDIR)/ && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o $(GOPACKAGE)); \
+ stat=$$?; \
+ if test $$stat != 0; then \
+ exit $$stat; \
+ fi; \
+ if $(GOGCC); then \
+ cp $(GOPATHDIR)/$(GOPACKAGE) $(GOPATHDIR)/$(GOPACKAGE:.a=.gox); \
+ fi; \
+ if test -f $(SRCDIR)$(RUNME).go; then \
+ mkdir gopath/$(GOMOD)/src/swigtests 2>/dev/null || true; \
+ mkdir gopath/$(GOMOD)/src/swigtests/$(INTERFACE:.i=) 2>/dev/null || true; \
+ cp $(GOPATHDIR)/* gopath/$(GOMOD)/src/swigtests/$(INTERFACE:.i=)/; \
+ (cd gopath/$(GOMOD)/src/runme && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o runme $(RUNME).go); \
+ stat=$$?; \
+ if test $$stat != 0; then \
+ exit $$stat; \
+ fi; \
+ cp gopath/$(GOMOD)/src/runme/runme $(RUNME); \
fi
-else
-
-octave_precompile_headers:
- echo "precompiling Octave headers not supported"; exit 1
-
-endif
-
# ----------------------------------------------------------------
-# Build a C dynamically loadable module
-# Note: Octave requires C++ compiler when compiling C wrappers
+# Build a Go module (C++)
# ----------------------------------------------------------------
-octave: $(SRCDIR_SRCS)
- $(SWIG) -octave $(SWIGOCTHDROPT) $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
- $(CXX) -g -c $(IOCTHEADERS) $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ICXXSRCS) $(INCLUDES) $(OCTAVE_CXX)
- $(CC) -g -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CSRCS) $(INCLUDES)
- $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(OCTAVE_DLNK) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(OCTAVE_SO)
+go_cpp: $(SRCDIR_SRCS) $(GOPATHPARENTDIR)/go.mod
+ $(SWIG) -go -c++ -import-prefix swigtests $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
+ @mkdir gopath 2>/dev/null || true
+ @mkdir gopath/$(GOMOD) 2>/dev/null || true
+ @mkdir gopath/$(GOMOD)/src 2>/dev/null || true
+ @mkdir $(GOPATHDIR) 2>/dev/null || true
+ rm -rf $(GOPATHDIR)/*
+ cp $(ICXXSRCS) $(GOPATHDIR)/
+ if test -f $(IWRAP:.i=.h); then \
+ cp $(IWRAP:.i=.h) $(GOPATHDIR)/; \
+ fi
+ if test -n "$(SRCDIR_CXXSRCS)"; then \
+ cp $(SRCDIR_CXXSRCS) $(GOPATHDIR)/; \
+ fi
+ if test -n "$(SRCDIR_SRCS)"; then \
+ cp $(SRCDIR_SRCS) $(GOPATHDIR)/; \
+ fi
+ cp $(GOSRCS) $(GOPATHDIR)/
+ @if test -f $(SRCDIR)$(RUNME).go; then \
+ mkdir gopath/$(GOMOD)/src/runme 2>/dev/null || true; \
+ rm -f gopath/$(GOMOD)/src/runme/*; \
+ fi
+ if test -f $(SRCDIR)$(RUNME).go; then \
+ cp $(SRCDIR)$(RUNME).go gopath/$(GOMOD)/src/runme/; \
+ fi
+ GOPATH=`pwd`/gopath/$(GOMOD); \
+ export GOPATH; \
+ CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) -I `cd $(SRCDIR) && pwd` -I `pwd`"; \
+ export CGO_CPPFLAGS; \
+ CGO_CFLAGS="$(CFLAGS)"; \
+ export CGO_CFLAGS; \
+ CGO_CXXFLAGS="$(CXXFLAGS)"; \
+ export CGO_CXXFLAGS; \
+ CGO_LDFLAGS="$(LDFLAGS) -lm"; \
+ export CGO_LDFLAGS; \
+ (cd $(GOPATHDIR) && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o $(GOPACKAGE)); \
+ stat=$$?; \
+ if test $$stat != 0; then \
+ exit $$stat; \
+ fi; \
+ if $(GOGCC); then \
+ cp $(GOPATHDIR)/$(GOPACKAGE) $(GOPATHDIR)/$(GOPACKAGE:.a=.gox); \
+ fi; \
+ if test -f $(SRCDIR)$(RUNME).go; then \
+ mkdir gopath/$(GOMOD)/src/swigtests 2>/dev/null || true; \
+ mkdir gopath/$(GOMOD)/src/swigtests/$(INTERFACE:.i=) 2>/dev/null || true; \
+ cp $(GOPATHDIR)/* gopath/$(GOMOD)/src/swigtests/$(INTERFACE:.i=)/; \
+ (cd gopath/$(GOMOD)/src/runme && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o runme $(RUNME).go); \
+ stat=$$?; \
+ if test $$stat != 0; then \
+ exit $$stat; \
+ fi; \
+ cp gopath/$(GOMOD)/src/runme/runme $(RUNME); \
+ fi
# -----------------------------------------------------------------
-# Build a C++ dynamically loadable module
+# Running Go example
# -----------------------------------------------------------------
-octave_cpp: $(SRCDIR_SRCS)
- $(SWIG) -c++ -octave $(SWIGOCTHDROPT) $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
- $(CXX) -g -c $(IOCTHEADERS) $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) $(OCTAVE_CXX)
- $(CXXSHARED) -g $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(OCTAVE_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(OCTAVE_SO)
-
-# -----------------------------------------------------------------
-# Running an Octave example
-# -----------------------------------------------------------------
-
-octave_run:
- env OCTAVE_PATH= OCTAVE_HISTFILE=/dev/null $(RUNTOOL) $(OCTAVE) $(OCTAVE_SCRIPT) $(RUNPIPE)
+go_run:
+ env $(RUNTOOL) ./$(RUNME) $(RUNPIPE)
# -----------------------------------------------------------------
# Version display
# -----------------------------------------------------------------
-octave_version:
- $(OCTAVE) --version | head -n 1
+go_version:
+ $(GO) $(GOVERSIONOPTION)
# -----------------------------------------------------------------
-# Cleaning the Octave examples
+# Cleaning the Go examples
# -----------------------------------------------------------------
-octave_clean:
- rm -rf __pycache__
- rm -f *_wrap* *~ .~* myoctave@EXEEXT@ *.pyc
+go_clean:
+ rm -f *_wrap* *_gc* *.gox .~* $(RUNME) $(GOSRCS)
+ rm -rf gopath
rm -f core @EXTRA_CLEAN@
- rm -f *.@OBJEXT@ *@SO@ *$(OCTAVE_SO)
- rm -f $(OCTHEADERS) $(OCTHEADERSGCH)
+ rm -f *.@OBJEXT@ *.[568] *.a *@SO@
##################################################################
##### GUILE ######
@@ -759,59 +785,86 @@ javascript_clean:
cd $(ROOT_DIR)/Tools/javascript && $(MAKE) -s clean
##################################################################
-##### ANDROID ######
+##### LUA ######
##################################################################
-ANDROID = @ANDROID@
-ANDROID_NDK_BUILD = @NDKBUILD@
-ANDROID_ADB = @ADB@
-ANT = @ANT@
-TARGETID = 1
+# lua flags
+LUA_INCLUDE= @LUAFLAGS@
+LUA_LIB = @LUALINK@
+
+# Extra specific dynamic linking options
+LUA_DLNK = @LUADYNAMICLINKING@
+LUA_SO = @LUA_SO@
+
+LUA = @LUABIN@
+LUA_SCRIPT = $(SRCDIR)$(RUNME).lua
+
+# Extra code for lua static link
+LUA_INTERP = ../lua.c
# ----------------------------------------------------------------
-# Build an Android dynamically loadable module (C)
+# Build a C dynamically loadable module
# ----------------------------------------------------------------
-android: $(SRCDIR_SRCS)
- $(ANDROID) $(SILENT_OPTION) update project --target $(TARGETID) --name $(PROJECTNAME) --path .
- $(SWIG) -java $(SWIGOPT) -o $(INTERFACEDIR)$(TARGET)_wrap.c $(INTERFACEPATH)
- +$(ANDROID_NDK_BUILD) $(SILENT_PIPE)
- $(ANT) $(ANT_QUIET) debug
+lua: $(SRCDIR_SRCS)
+ $(SWIG) -lua $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
+ $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(ISRCS) $(SRCDIR_SRCS) $(INCLUDES) $(LUA_INCLUDE)
+ $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(LUA_LIB) -o $(LIBPREFIX)$(TARGET)$(LUA_SO)
-# ----------------------------------------------------------------
-# Build an Android dynamically loadable module (C++)
-# ----------------------------------------------------------------
+# -----------------------------------------------------------------
+# Build a C++ dynamically loadable module
+# -----------------------------------------------------------------
-android_cpp: $(SRCDIR_SRCS)
- $(ANDROID) $(SILENT_OPTION) update project --target $(TARGETID) --name $(PROJECTNAME) --path .
- $(SWIG) -java -c++ $(SWIGOPT) -o $(INTERFACEDIR)$(TARGET)_wrap.cpp $(INTERFACEPATH)
- +$(ANDROID_NDK_BUILD) $(SILENT_PIPE)
- $(ANT) $(ANT_QUIET) debug
+lua_cpp: $(SRCDIR_SRCS) $(GENCXXSRCS)
+ $(SWIG) -c++ -lua $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
+ $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(GENCXXSRCS) $(INCLUDES) $(LUA_INCLUDE)
+ $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(LUA_LIB) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(LUA_SO)
-# ----------------------------------------------------------------
-# Android install
-# ----------------------------------------------------------------
+lua_externalhdr:
+ $(SWIG) -lua -external-runtime $(TARGET)
-android_install:
- -$(ANDROID_ADB) uninstall $(PACKAGENAME)
- $(ANDROID_ADB) install $(INSTALLOPTIONS) bin/$(PROJECTNAME)-debug.apk
+lua_swig_cpp:
+ $(SWIG) -c++ -lua $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
+
+# -----------------------------------------------------------------
+# Build statically linked Lua interpreter
+# -----------------------------------------------------------------
+
+lua_static: $(SRCDIR_SRCS)
+ $(SWIG) -lua -module example $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
+ $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(ISRCS) $(SRCDIR_SRCS) $(SRCDIR)$(LUA_INTERP) $(INCLUDES) \
+ $(LUA_INCLUDE) $(LIBS) $(LUA_LIB) -o $(TARGET)
+
+lua_static_cpp: $(SRCDIR_SRCS) $(GENCXXSRCS)
+ $(SWIG) -c++ -lua -module example $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(GENCXXSRCS) $(SRCDIR)$(LUA_INTERP) $(INCLUDES) \
+ $(LUA_INCLUDE) $(LIBS) $(LUA_LIB) -o $(TARGET)
+
+# -----------------------------------------------------------------
+# Run Lua example
+# -----------------------------------------------------------------
+
+lua_run:
+ $(RUNTOOL) $(LUA) $(LUA_SCRIPT) $(RUNPIPE)
+
+lua_embed_run:
+ $(RUNTOOL) ./$(TARGET) $(LUA_SCRIPT) $(RUNPIPE)
# -----------------------------------------------------------------
# Version display
# -----------------------------------------------------------------
-android_version:
- $(ANDROID_ADB) version
+lua_version:
+ $(LUA) -v | head -n 1
# -----------------------------------------------------------------
-# Cleaning the Android examples
+# Cleaning the lua examples
# -----------------------------------------------------------------
-android_clean:
- test -n "$(SRCDIR)" && cd $(SRCDIR) ; $(ANT) -q -logfile /dev/null clean
- rm -f $(INTERFACEDIR)$(TARGET)_wrap.*
- rm -f `find $(PACKAGEDIR) -name \*.java | grep -v $(PROJECTNAME).java`
- rm -rf obj
+lua_clean:
+ rm -f *_wrap* *~ .~* mylua@EXEEXT@
+ rm -f core @EXTRA_CLEAN@
+ rm -f *.@OBJEXT@ *$(LUA_SO)
##################################################################
##### MZSCHEME ######
@@ -862,7 +915,7 @@ mzscheme_clean:
rm -f *.@OBJEXT@ *$(MZSCHEME_SO)
##################################################################
-##### Ocaml #####
+##### OCAML ######
##################################################################
OCC=$(COMPILETOOL) @OCAMLC@
@@ -965,6 +1018,387 @@ ocaml_clean:
rm -f *.@OBJEXT@ *@SO@
rm -rf ./localtmp
+##################################################################
+##### OCTAVE ######
+##################################################################
+
+# Make sure these locate your Octave installation
+OCTAVE = @OCTAVE@
+OCTAVE_CXX = $(DEFS) @OCTAVE_CPPFLAGS@ @OCTAVE_CXXFLAGS@
+
+# Extra Octave specific dynamic linking options
+OCTAVE_DLNK = @OCTAVE_LDFLAGS@
+OCTAVE_SO = @OCTAVE_SO@
+
+OCTAVE_SCRIPT = $(SRCDIR)$(RUNME).m
+
+# ----------------------------------------------------------------
+# Pre-compile Octave headers, if supported
+# ----------------------------------------------------------------
+
+ifeq (yes,$(PCHSUPPORT))
+
+octave_precompile_headers:
+ echo "precompiling $(OCTHEADERS)"
+ cp -f $(OCTHEADERSSRC) $(OCTHEADERS)
+ if $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) $(OCTAVE_CXX) $(OCTHEADERS); then \
+ : ; \
+ else \
+ rm -f $(OCTHEADERSGCH); \
+ exit 1; \
+ fi
+
+else
+
+octave_precompile_headers:
+ echo "precompiling Octave headers not supported"; exit 1
+
+endif
+
+# ----------------------------------------------------------------
+# Build a C dynamically loadable module
+# Note: Octave requires C++ compiler when compiling C wrappers
+# ----------------------------------------------------------------
+
+octave: $(SRCDIR_SRCS)
+ $(SWIG) -octave $(SWIGOCTHDROPT) $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
+ $(CXX) -g -c $(IOCTHEADERS) $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ICXXSRCS) $(INCLUDES) $(OCTAVE_CXX)
+ $(CC) -g -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CSRCS) $(INCLUDES)
+ $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(OCTAVE_DLNK) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(OCTAVE_SO)
+
+# -----------------------------------------------------------------
+# Build a C++ dynamically loadable module
+# -----------------------------------------------------------------
+
+octave_cpp: $(SRCDIR_SRCS)
+ $(SWIG) -c++ -octave $(SWIGOCTHDROPT) $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
+ $(CXX) -g -c $(IOCTHEADERS) $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) $(OCTAVE_CXX)
+ $(CXXSHARED) -g $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(OCTAVE_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(OCTAVE_SO)
+
+# -----------------------------------------------------------------
+# Running an Octave example
+# -----------------------------------------------------------------
+
+octave_run:
+ env OCTAVE_PATH= OCTAVE_HISTFILE=/dev/null $(RUNTOOL) $(OCTAVE) $(OCTAVE_SCRIPT) $(RUNPIPE)
+
+# -----------------------------------------------------------------
+# Version display
+# -----------------------------------------------------------------
+
+octave_version:
+ $(OCTAVE) --version | head -n 1
+
+# -----------------------------------------------------------------
+# Cleaning the Octave examples
+# -----------------------------------------------------------------
+
+octave_clean:
+ rm -rf __pycache__
+ rm -f *_wrap* *~ .~* myoctave@EXEEXT@ *.pyc
+ rm -f core @EXTRA_CLEAN@
+ rm -f *.@OBJEXT@ *@SO@ *$(OCTAVE_SO)
+ rm -f $(OCTHEADERS) $(OCTHEADERSGCH)
+
+##################################################################
+##### PERL 5 ######
+##################################################################
+
+# You need to set this variable to the Perl5 directory containing the
+# files "perl.h", "EXTERN.h" and "XSUB.h". With Perl5.003, it's
+# usually something like /usr/local/lib/perl5/arch-osname/5.003/CORE.
+
+PERL5_INCLUDE= @PERL5EXT@
+
+# Extra Perl specific dynamic linking options
+PERL5_DLNK = @PERL5DYNAMICLINKING@
+PERL5_CCFLAGS = @PERL5CCFLAGS@
+PERL5_CCDLFLAGS = @PERL5CCDLFLAGS@
+PERL5_CCCDLFLAGS = @PERL5CCCDLFLAGS@
+PERL5_LDFLAGS = @PERL5LDFLAGS@
+PERL = @PERL@
+PERL5_LIB = -L$(PERL5_INCLUDE) -l@PERL5LIB@ @LIBS@ $(SYSLIBS)
+PERL5_SCRIPT = $(SRCDIR)$(RUNME).pl
+
+# ----------------------------------------------------------------
+# Build a Perl5 dynamically loadable module (C)
+# ----------------------------------------------------------------
+
+perl5: $(SRCDIR_SRCS)
+ $(SWIG) -perl5 $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
+ $(CC) -c -Dbool=char $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES) $(PERL5_CCFLAGS) $(PERL5_CCCDLFLAGS) -I$(PERL5_INCLUDE)
+ $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(PERL5_CCDLFLAGS) $(OBJS) $(IOBJS) $(PERL5_LDFLAGS) $(PERL5_DLNK) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO)
+
+# ----------------------------------------------------------------
+# Build a Perl5 dynamically loadable module (C++)
+# ----------------------------------------------------------------
+
+perl5_cpp: $(SRCDIR_SRCS)
+ $(SWIG) -perl5 -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
+ $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(PERL5_CCFLAGS) $(PERL5_CCCDLFLAGS) -I$(PERL5_INCLUDE)
+ $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(PERL5_CCDLFLAGS) $(OBJS) $(IOBJS) $(PERL5_LDFLAGS) $(PERL5_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO)
+
+# ----------------------------------------------------------------
+# Build a module from existing XS C source code. (ie. from xsubpp).
+# ----------------------------------------------------------------
+perl5_xs: $(SRCDIR_SRCS)
+ $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(INCLUDES) -I$(PERL5_INCLUDE)
+ $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $(TARGET)$(SO)
+
+# ----------------------------------------------------------------
+# Build a statically linked Perl5 executable
+# ----------------------------------------------------------------
+
+perl5_static: $(SRCDIR_SRCS)
+ $(SWIG) -perl5 -static -lperlmain.i $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
+ $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -Dbool=char $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES) -I$(PERL5_INCLUDE) $(PERL5_LIB) $(LIBS) -o $(TARGET)
+
+perl5_static_cpp: $(SRCDIR_SRCS)
+ $(SWIG) -perl5 -c++ -static -lperlmain.i $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES) -I$(PERL5_INCLUDE) $(PERL5_LIB) $(LIBS) -o $(TARGET)
+
+# -----------------------------------------------------------------
+# Running a Perl5 example
+# -----------------------------------------------------------------
+
+perl5_run:
+ $(RUNTOOL) $(PERL) -I. $(PERL5_SCRIPT) $(RUNPIPE)
+
+# -----------------------------------------------------------------
+# Version display
+# -----------------------------------------------------------------
+
+perl5_version:
+ $(PERL) -v | grep "This is"
+
+# -----------------------------------------------------------------
+# Cleaning the Perl5 examples
+# -----------------------------------------------------------------
+
+perl5_clean:
+ rm -f *_wrap* *~ .~* myperl@EXEEXT@ *.pm
+ rm -f core @EXTRA_CLEAN@
+ rm -f *.@OBJEXT@ *@SO@
+
+##################################################################
+##### PHP ######
+##################################################################
+
+PHP = @PHP@
+PHP_INCLUDE = @PHPINC@
+PHP_SO = @PHP_SO@
+PHP_SCRIPT = $(SRCDIR)$(RUNME).php
+PHP_EXTENSION = example$(PHP_SO)
+
+# -------------------------------------------------------------------
+# Build a PHP dynamically loadable module (C)
+# -------------------------------------------------------------------
+
+php: $(SRCDIR_SRCS)
+ $(SWIG) -php $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
+ $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES) $(PHP_INCLUDE)
+ $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(PHP_SO)
+
+# --------------------------------------------------------------------
+# Build a PHP dynamically loadable module (C++)
+# --------------------------------------------------------------------
+
+php_cpp: $(SRCDIR_SRCS)
+ $(SWIG) -php -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
+ $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(PHP_INCLUDE)
+ $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(PHP_SO)
+
+# -----------------------------------------------------------------
+# Running a PHP example
+# -----------------------------------------------------------------
+
+php_run:
+ $(RUNTOOL) $(PHP) -n -d extension_dir=. -d extension=$(PHP_EXTENSION) -d display_errors=stderr -r 'set_error_handler(function($$n,$$s,$$f,$$l){if($$f!==Null){print$$f;if($$l!==Null)print":$$l";print": ";}print"$$s\n";exit(1);});if(strlen($$argv[1]))include($$argv[1]);' '$(PHP_SCRIPT)' $(RUNPIPE)
+
+php_run_multi:
+ $(RUNTOOL) $(PHP) -n -d extension_dir=. `while read e ; do echo ' -d extension=$(TARGETPREFIX)'"$$e"'@PHP_SO@' ; done < $(PHP_EXTENSION_LIST)` -d display_errors=stderr -r 'set_error_handler(function($$n,$$s,$$f,$$l){if($$f!==Null){print$$f;if($$l!==Null)print":$$l";print": ";}print"$$s\n";exit(1);});if(strlen($$argv[1]))include($$argv[1]);' '$(PHP_SCRIPT)' $(RUNPIPE)
+
+# -----------------------------------------------------------------
+# Version display
+# -----------------------------------------------------------------
+
+php_version:
+ $(PHP) -v | head -n 1
+
+# -----------------------------------------------------------------
+# Cleaning the PHP examples
+# -----------------------------------------------------------------
+
+php_clean:
+ rm -f *_wrap* *~ .~* example.php php_example.h
+ rm -f core @EXTRA_CLEAN@
+ rm -f *.@OBJEXT@ *$(PHP_SO)
+
+##################################################################
+##### PYTHON ######
+##################################################################
+
+PYTHON_FLAGS =
+
+# Make sure these locate your Python installation
+ifneq (,$(PY2))
+ PYTHON_INCLUDE= $(DEFS) @PYINCLUDE@
+ PYTHON_LIB = @PYLIB@
+ PYTHON = @PYTHON@ $(PYTHON_FLAGS)
+else
+ PYTHON_INCLUDE= $(DEFS) @PY3INCLUDE@
+ PYTHON_LIB = @PY3LIB@
+ PYTHON = @PYTHON3@ $(PYTHON_FLAGS)
+endif
+
+# Extra Python specific linking options
+ifneq (,$(PY2))
+ PYTHON_DLNK = @PYTHONDYNAMICLINKING@
+ PYTHON_LINK = @PYLINK@
+else
+ PYTHON_DLNK = @PYTHON3DYNAMICLINKING@
+ PYTHON_LINK = @PY3LINK@
+endif
+PYTHON_SO = @PYTHON_SO@
+
+PYCODESTYLE = @PYCODESTYLE@
+PYCODESTYLE_FLAGS = --ignore=E252,E30,E402,E501,E731,W291,W391
+
+# ----------------------------------------------------------------
+# Build a C dynamically loadable module
+# ----------------------------------------------------------------
+
+python: $(SRCDIR_SRCS)
+ $(SWIG) -python $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
+ $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(ISRCS) $(SRCDIR_SRCS) $(INCLUDES) $(PYTHON_INCLUDE)
+ $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(PYTHON_DLNK) $(LIBS) -o $(LIBPREFIX)_$(TARGET)$(PYTHON_SO)
+
+# -----------------------------------------------------------------
+# Build a C++ dynamically loadable module
+# -----------------------------------------------------------------
+
+python_cpp: $(SRCDIR_SRCS)
+ $(SWIG) -python -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
+ $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) $(PYTHON_INCLUDE)
+ $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(PYTHON_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)_$(TARGET)$(PYTHON_SO)
+
+# -----------------------------------------------------------------
+# Build statically linked Python interpreter
+#
+# These should only be used in conjunction with the %include embed.i
+# library file
+# -----------------------------------------------------------------
+
+#TKINTER = -L/usr/X11R6.3/lib -L/usr/local/compat/lib -ltk4.0 -ltcl7.4 -lX11
+TKINTER =
+PYTHON_LIBOPTS = $(PYTHON_LINK) @LIBS@ $(TKINTER) $(SYSLIBS)
+
+python_static: $(SRCDIR_SRCS)
+ $(SWIG) -python -lembed.i $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
+ $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) @LINKFORSHARED@ $(ISRCS) $(SRCDIR_SRCS) $(INCLUDES) \
+ $(PYTHON_INCLUDE) $(LIBS) -L$(PYTHON_LIB) $(PYTHON_LIBOPTS) -o $(TARGET)
+
+python_static_cpp: $(SRCDIR_SRCS)
+ $(SWIG) -python -c++ -lembed.i $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) \
+ $(PYTHON_INCLUDE) $(LIBS) -L$(PYTHON_LIB) $(PYTHON_LIBOPTS) -o $(TARGET)
+
+# -----------------------------------------------------------------
+# Running a Python example
+# -----------------------------------------------------------------
+
+PYSCRIPT = $(RUNME).py
+
+python_run: $(PYSCRIPT)
+ifneq (,$(PYCODESTYLE))
+ $(COMPILETOOL) $(PYCODESTYLE) $(PYCODESTYLE_FLAGS) $(PYSCRIPT)
+endif
+ env PYTHONPATH=$$PWD $(RUNTOOL) $(PYTHON) $(PYSCRIPT) $(RUNPIPE)
+
+ifneq (,$(SRCDIR))
+$(RUNME).py: $(SRCDIR)$(RUNME).py
+ cp $< $@
+endif
+
+# -----------------------------------------------------------------
+# Version display
+# -----------------------------------------------------------------
+
+python_version:
+ $(PYTHON) -V
+
+# -----------------------------------------------------------------
+# Cleaning the python examples
+# -----------------------------------------------------------------
+
+python_clean:
+ rm -rf __pycache__
+ rm -f *_wrap* *~ .~* mypython@EXEEXT@ *.pyc
+ rm -f core @EXTRA_CLEAN@
+ rm -f *.@OBJEXT@ *@SO@ *$(PYTHON_SO)
+ rm -f $(TARGET).py
+ case "x$(SRCDIR)" in x|x./);; *) rm -f $(RUNME).py;; esac
+
+##################################################################
+##### R ######
+##################################################################
+
+R = R
+RCXXSRCS = $(INTERFACE:.i=_wrap.cpp) #Need to use _wrap.cpp for R build system as it does not understand _wrap.cxx
+RRSRC = $(INTERFACE:.i=.R)
+R_CFLAGS=-fPIC
+R_OPT = --slave --quiet --no-save --no-restore
+R_SCRIPT=$(SRCDIR)$(RUNME).R
+
+# need to compile .cxx files outside of R build system to make sure that
+# we get -fPIC
+# CMD SHLIB stdout is piped to /dev/null to prevent echo of compiler command
+
+# ----------------------------------------------------------------
+# Build a R dynamically loadable module (C)
+# ----------------------------------------------------------------
+
+r: $(SRCDIR_SRCS)
+ $(SWIG) -r $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
+ifneq ($(SRCDIR_SRCS),)
+ $(CC) -g -c $(CPPFLAGS) $(CFLAGS) $(R_CFLAGS) $(SRCDIR_SRCS) $(INCLUDES)
+endif
+ +( PKG_CPPFLAGS="$(CPPFLAGS) $(INCLUDES)" PKG_CFLAGS="$(CFLAGS)" $(COMPILETOOL) $(R) CMD SHLIB -o $(LIBPREFIX)$(TARGET)$(SO) $(ISRCS) $(OBJS) > /dev/null )
+
+# ----------------------------------------------------------------
+# Build a R dynamically loadable module (C++)
+# ----------------------------------------------------------------
+r_cpp: $(SRCDIR_CXXSRCS)
+ $(SWIG) -c++ -r $(SWIGOPT) -o $(RCXXSRCS) $(INTERFACEPATH)
+ifneq ($(SRCDIR_CXXSRCS),)
+ $(CXX) -g -c $(CPPFLAGS) $(CXXFLAGS) $(R_CFLAGS) $(SRCDIR_CXXSRCS) $(INCLUDES)
+endif
+ +( PKG_CPPFLAGS="$(CPPFLAGS) $(INCLUDES)" PKG_CXXFLAGS="$(CXXFLAGS)" $(COMPILETOOL) $(R) CMD SHLIB -o $(LIBPREFIX)$(TARGET)$(SO) $(RCXXSRCS) $(OBJS) > /dev/null )
+
+# -----------------------------------------------------------------
+# Run R example
+# -----------------------------------------------------------------
+
+r_run:
+ $(RUNTOOL) $(R) $(R_OPT) -f $(R_SCRIPT) $(RUNPIPE)
+
+# -----------------------------------------------------------------
+# Version display
+# -----------------------------------------------------------------
+
+r_version:
+ $(R) --version | head -n 1
+
+# -----------------------------------------------------------------
+# Cleaning the R examples
+# -----------------------------------------------------------------
+
+r_clean:
+ rm -f *_wrap* *~ .~*
+ rm -f core @EXTRA_CLEAN@
+ rm -f *.@OBJEXT@ *@SO@ NAMESPACE
+ rm -f $(RRSRC) $(RUNME).Rout .RData
+
##################################################################
##### RUBY ######
##################################################################
@@ -1410,7 +1844,7 @@ c_clean:
rm -f $(RUNME)_c $(RUNME)_cxx
##################################################################
-##### SCILAB ######
+##### SCILAB ######
##################################################################
SCILAB = @SCILAB@
@@ -1462,243 +1896,76 @@ scilab_clean:
rm -f *.sce
##################################################################
-##### Go ######
+##### TCL ######
##################################################################
-# TODO: The Go make targets need simplifying to use configure time
-# configuration or to use Make's ifeq rather than using lots of
-# runtime shell code. The output will then be a lot less verbose.
+# Set these to your local copy of Tcl
-GO = @GO@
-GOGCC = @GOGCC@
-GCCGO = @GCCGO@
-GOOPT = @GOOPT@
-GCCGOOPT = @GCCGOOPT@
-GOVERSIONOPTION = @GOVERSIONOPTION@
+TCLSH = tclsh
+TCL_INCLUDE = @TCLINCLUDE@
+TCL_LIB = @TCLLIB@
+TCL_OPTS = @LIBS@
+TK_OPTS = -ltk -ltcl @LIBS@
-GOSWIGARG = `if $(GOGCC) ; then echo -gccgo; fi`
+# Extra Tcl specific dynamic linking options
+TCL_DLNK = @TCLDYNAMICLINKING@
+TCL_SO = @TCL_SO@
+TCLLDSHARED = @TCLLDSHARED@
+TCLCXXSHARED = @TCLCXXSHARED@
+TCL_SCRIPT = $(SRCDIR)$(RUNME).tcl
+TCL_LINK = @TCLLINK@
-GOSRCS = $(INTERFACE:.i=.go)
-GOCSRCS = $(INTERFACE:.i=_gc.c)
+# -----------------------------------------------------------
+# Build a new version of the tclsh shell
+# -----------------------------------------------------------
-GOPACKAGE = $(notdir $(INTERFACE:.i=.a))
+tclsh: $(SRCDIR_SRCS)
+ $(SWIG) -tcl8 $(SWIGOPT) $(TCL_SWIGOPTS) -ltclsh.i -o $(ISRCS) $(INTERFACEPATH)
+ $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES) $(TCL_INCLUDE) \
+ $(TCL_LIB) $(TCL_OPTS) $(LIBS) $(SYSLIBS) -o $(TARGET)
-GOPATHPARENTDIR = gopath/$(GOMOD)/src
-GOPATHDIR = $(GOPATHPARENTDIR)/$(INTERFACE:.i=)
+tclsh_cpp: $(SRCDIR_SRCS)
+ $(SWIG) -tcl8 -c++ $(SWIGOPT) $(TCL_SWIGOPTS) -ltclsh.i -o $(ICXXSRCS) $(INTERFACEPATH)
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(TCL_INCLUDE) \
+ $(TCL_LIB) $(TCL_OPTS) $(LIBS) $(SYSLIBS) -o $(TARGET)
-# ----------------------------------------------------------------
-# Build a Go module (C)
-# ----------------------------------------------------------------
+# -----------------------------------------------------------
+# Build a Tcl dynamic loadable module (you might need to tweak this)
+# -----------------------------------------------------------
-$(GOPATHPARENTDIR)/go.mod:
- @mkdir gopath 2>/dev/null || true
- @mkdir gopath/$(GOMOD) 2>/dev/null || true
- @mkdir gopath/$(GOMOD)/src 2>/dev/null || true
- @mkdir $(GOPATHDIR) 2>/dev/null || true
- echo "module swigtests" > $(GOPATHDIR)/go.mod
- echo "" >> $(GOPATHDIR)/go.mod
- echo "go 1.12" >> $(GOPATHDIR)/go.mod
- mv -f $(GOPATHDIR)/go.mod $(GOPATHPARENTDIR)/go.mod
+tcl: $(SRCDIR_SRCS)
+ $(SWIG) -tcl8 $(SWIGOPT) $(TCL_SWIGOPTS) -o $(ISRCS) $(INTERFACEPATH)
+ $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES) $(TCL_INCLUDE)
+ $(TCLLDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(TCL_DLNK) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(TCL_SO) $(TCL_LINK)
-go: $(SRCDIR_SRCS) $(GOPATHPARENTDIR)/go.mod
- $(SWIG) -go -import-prefix swigtests $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
- @mkdir gopath 2>/dev/null || true
- @mkdir gopath/$(GOMOD) 2>/dev/null || true
- @mkdir gopath/$(GOMOD)/src 2>/dev/null || true
- @mkdir $(GOPATHDIR) 2>/dev/null || true
- rm -rf $(GOPATHDIR)/*
- cp $(ISRCS) $(GOPATHDIR)/
- if test -f $(IWRAP:.i=.h); then \
- cp $(IWRAP:.i=.h) $(GOPATHDIR)/; \
- fi
- if test -n "$(SRCDIR_SRCS)"; then \
- cp $(SRCDIR_SRCS) $(GOPATHDIR)/; \
- fi
- cp $(GOSRCS) $(GOPATHDIR)/
- @if test -f $(SRCDIR)$(RUNME).go; then \
- mkdir gopath/$(GOMOD)/src/runme 2>/dev/null || true; \
- rm -f gopath/$(GOMOD)/src/runme/*; \
- fi
- if test -f $(SRCDIR)$(RUNME).go; then \
- cp $(SRCDIR)$(RUNME).go gopath/$(GOMOD)/src/runme/; \
- fi
- GOPATH=`pwd`/gopath/$(GOMOD); \
- export GOPATH; \
- CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) -I `cd $(SRCDIR) && pwd` -I `pwd`"; \
- export CGO_CPPFLAGS; \
- CGO_CFLAGS="$(CFLAGS)"; \
- export CGO_CFLAGS; \
- CGO_LDFLAGS="$(LDFLAGS) -lm"; \
- export CGO_LDFLAGS; \
- (cd $(GOPATHDIR)/ && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o $(GOPACKAGE)); \
- stat=$$?; \
- if test $$stat != 0; then \
- exit $$stat; \
- fi; \
- if $(GOGCC); then \
- cp $(GOPATHDIR)/$(GOPACKAGE) $(GOPATHDIR)/$(GOPACKAGE:.a=.gox); \
- fi; \
- if test -f $(SRCDIR)$(RUNME).go; then \
- mkdir gopath/$(GOMOD)/src/swigtests 2>/dev/null || true; \
- mkdir gopath/$(GOMOD)/src/swigtests/$(INTERFACE:.i=) 2>/dev/null || true; \
- cp $(GOPATHDIR)/* gopath/$(GOMOD)/src/swigtests/$(INTERFACE:.i=)/; \
- (cd gopath/$(GOMOD)/src/runme && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o runme $(RUNME).go); \
- stat=$$?; \
- if test $$stat != 0; then \
- exit $$stat; \
- fi; \
- cp gopath/$(GOMOD)/src/runme/runme $(RUNME); \
- fi
+# -----------------------------------------------------------
+# Build a Tcl dynamic loadable module for C++
+# -----------------------------------------------------------
-# ----------------------------------------------------------------
-# Build a Go module (C++)
-# ----------------------------------------------------------------
-
-go_cpp: $(SRCDIR_SRCS) $(GOPATHPARENTDIR)/go.mod
- $(SWIG) -go -c++ -import-prefix swigtests $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
- @mkdir gopath 2>/dev/null || true
- @mkdir gopath/$(GOMOD) 2>/dev/null || true
- @mkdir gopath/$(GOMOD)/src 2>/dev/null || true
- @mkdir $(GOPATHDIR) 2>/dev/null || true
- rm -rf $(GOPATHDIR)/*
- cp $(ICXXSRCS) $(GOPATHDIR)/
- if test -f $(IWRAP:.i=.h); then \
- cp $(IWRAP:.i=.h) $(GOPATHDIR)/; \
- fi
- if test -n "$(SRCDIR_CXXSRCS)"; then \
- cp $(SRCDIR_CXXSRCS) $(GOPATHDIR)/; \
- fi
- if test -n "$(SRCDIR_SRCS)"; then \
- cp $(SRCDIR_SRCS) $(GOPATHDIR)/; \
- fi
- cp $(GOSRCS) $(GOPATHDIR)/
- @if test -f $(SRCDIR)$(RUNME).go; then \
- mkdir gopath/$(GOMOD)/src/runme 2>/dev/null || true; \
- rm -f gopath/$(GOMOD)/src/runme/*; \
- fi
- if test -f $(SRCDIR)$(RUNME).go; then \
- cp $(SRCDIR)$(RUNME).go gopath/$(GOMOD)/src/runme/; \
- fi
- GOPATH=`pwd`/gopath/$(GOMOD); \
- export GOPATH; \
- CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) -I `cd $(SRCDIR) && pwd` -I `pwd`"; \
- export CGO_CPPFLAGS; \
- CGO_CFLAGS="$(CFLAGS)"; \
- export CGO_CFLAGS; \
- CGO_CXXFLAGS="$(CXXFLAGS)"; \
- export CGO_CXXFLAGS; \
- CGO_LDFLAGS="$(LDFLAGS) -lm"; \
- export CGO_LDFLAGS; \
- (cd $(GOPATHDIR) && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o $(GOPACKAGE)); \
- stat=$$?; \
- if test $$stat != 0; then \
- exit $$stat; \
- fi; \
- if $(GOGCC); then \
- cp $(GOPATHDIR)/$(GOPACKAGE) $(GOPATHDIR)/$(GOPACKAGE:.a=.gox); \
- fi; \
- if test -f $(SRCDIR)$(RUNME).go; then \
- mkdir gopath/$(GOMOD)/src/swigtests 2>/dev/null || true; \
- mkdir gopath/$(GOMOD)/src/swigtests/$(INTERFACE:.i=) 2>/dev/null || true; \
- cp $(GOPATHDIR)/* gopath/$(GOMOD)/src/swigtests/$(INTERFACE:.i=)/; \
- (cd gopath/$(GOMOD)/src/runme && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o runme $(RUNME).go); \
- stat=$$?; \
- if test $$stat != 0; then \
- exit $$stat; \
- fi; \
- cp gopath/$(GOMOD)/src/runme/runme $(RUNME); \
- fi
+tcl_cpp: $(SRCDIR_SRCS)
+ $(SWIG) -tcl8 -c++ $(SWIGOPT) $(TCL_SWIGOPTS) -o $(ICXXSRCS) $(INTERFACEPATH)
+ $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(TCL_INCLUDE)
+ $(TCLCXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(TCL_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(TCL_SO) $(TCL_LINK)
# -----------------------------------------------------------------
-# Running Go example
+# Run Tcl example
# -----------------------------------------------------------------
-go_run:
- env $(RUNTOOL) ./$(RUNME) $(RUNPIPE)
+tcl_run:
+ $(RUNTOOL) $(TCLSH) $(TCL_SCRIPT) $(RUNPIPE)
# -----------------------------------------------------------------
# Version display
# -----------------------------------------------------------------
-go_version:
- $(GO) $(GOVERSIONOPTION)
+tcl_version:
+ echo 'puts $$tcl_version;exit 0' | $(TCLSH)
# -----------------------------------------------------------------
-# Cleaning the Go examples
+# Cleaning the Tcl examples
# -----------------------------------------------------------------
-go_clean:
- rm -f *_wrap* *_gc* *.gox .~* $(RUNME) $(GOSRCS)
- rm -rf gopath
+tcl_clean:
+ rm -f *_wrap* *~ .~* mytclsh@EXEEXT@
rm -f core @EXTRA_CLEAN@
- rm -f *.@OBJEXT@ *.[568] *.a *@SO@
-
-##################################################################
-##### D ######
-##################################################################
-
-DLIBPREFIX = @DLIBPREFIX@
-
-ifeq (,$(D_VERSION))
- D_VERSION = @DDEFAULTVERSION@
-endif
-
-ifeq (2,$(D_VERSION))
- SWIGD = $(SWIG) -d -d2
- DCOMPILER = @D2COMPILER@
-else
- SWIGD = $(SWIG) -d
- DCOMPILER = @D1COMPILER@
-endif
-
-D_RUNME = ./$(RUNME)
-
-# ----------------------------------------------------------------
-# Build a dynamically loadable D wrapper for a C module
-# ----------------------------------------------------------------
-
-d: $(SRCDIR_SRCS)
- $(SWIGD) $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
- $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(DCFLAGS) $(EXTRA_CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES)
- $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(DCFLAGS) $(EXTRA_LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(DLIBPREFIX)$(TARGET)$(SO)
-
-# ----------------------------------------------------------------
-# Build a dynamically loadable D wrapper for a C++ module
-# ----------------------------------------------------------------
-
-d_cpp: $(SRCDIR_SRCS)
- $(SWIGD) -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
- $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(DCFLAGS) $(EXTRA_CFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES)
- $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(DCFLAGS) $(EXTRA_LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(DLIBPREFIX)$(TARGET)$(SO)
-
-# ----------------------------------------------------------------
-# Compile D files
-# ----------------------------------------------------------------
-
-# Clear the DFLAGS environment variable for the compiler call itself
-# to work around a discrepancy in argument handling between DMD and LDC.
-d_compile: $(SRCDIR_SRCS)
- DFLAGS="" $(COMPILETOOL) $(DCOMPILER) $(DFLAGS) $(DSRCS)
-
-# -----------------------------------------------------------------
-# Run D example
-# -----------------------------------------------------------------
-
-d_run:
- env LD_LIBRARY_PATH=$$PWD $(RUNTOOL) $(D_RUNME) $(RUNPIPE)
-
-# -----------------------------------------------------------------
-# Version display
-# -----------------------------------------------------------------
-
-d_version:
- ($(DCOMPILER) --version 2> /dev/null || $(DCOMPILER)) | head -n 3
-
-# -----------------------------------------------------------------
-# Clean the D examples
-# -----------------------------------------------------------------
-
-d_clean:
- rm -f *_wrap* *~ .~* $(RUNME) $(RUNME).exe `find . -name \*.d | grep -v $(RUNME).d`
- rm -f core @EXTRA_CLEAN@
- rm -f *.@OBJEXT@ *@SO@
+ rm -f *.@OBJEXT@ *$(TCL_SO)
diff --git a/Examples/go/index.html b/Examples/go/index.html
index 370424c54..b8af100ff 100644
--- a/Examples/go/index.html
+++ b/Examples/go/index.html
@@ -94,6 +94,6 @@ All of the examples were last tested with the following configuration
Your mileage may vary. If you experience a problem, please let us know by
-contacting us on the
mailing lists .
+contacting us on the
mailing lists .
diff --git a/Examples/java/index.html b/Examples/java/index.html
index 007e14dbc..bebf1b1bf 100644
--- a/Examples/java/index.html
+++ b/Examples/java/index.html
@@ -58,7 +58,7 @@ The examples have been extensively tested on the following platforms:
Your mileage may vary. If you experience a problem, please let us know by
-contacting us on the
mailing lists .
+contacting us on the
mailing lists .
diff --git a/Examples/javascript/exception/runme.js b/Examples/javascript/exception/runme.js
index 1001a7111..646a33dbe 100644
--- a/Examples/javascript/exception/runme.js
+++ b/Examples/javascript/exception/runme.js
@@ -10,7 +10,7 @@ try{
if(error == -1) {
console.log("t.unknown() didn't throw");
} else {
- console.log("successfully caught throw in Test::unknown().");
+ console.log("successfully caught throw in Test::unknown() :" + error);
}
}
@@ -22,7 +22,7 @@ catch(error){
if(error == -1) {
console.log("t.simple() did not throw");
} else {
- console.log("successfully caught throw in Test::simple().");
+ console.log("successfully caught throw in Test::simple() :" + error);
}
}
@@ -33,7 +33,7 @@ try{
if(error == -1) {
console.log("t.message() did not throw");
} else {
- console.log("successfully caught throw in Test::message().");
+ console.log("successfully caught throw in Test::message() :" + error);
}
}
@@ -45,7 +45,7 @@ catch(error){
if(error == -1) {
console.log("t.hosed() did not throw");
} else {
- console.log("successfully caught throw in Test::hosed().");
+ console.log("successfully caught throw in Test::hosed() :" + error);
}
}
@@ -58,7 +58,7 @@ for (var i=1; i<4; i++) {
if(error == -1) {
console.log("t.multi(" + i + ") did not throw");
} else {
- console.log("successfully caught throw in Test::multi().");
+ console.log("successfully caught throw in Test::multi() :" + error);
}
}
-}
+}
diff --git a/Examples/octave/operator/@swig_ref/horzcat.m b/Examples/octave/operator/@swig_ref/horzcat.m
index 00fdfd5ce..6d4a55b20 100644
--- a/Examples/octave/operator/@swig_ref/horzcat.m
+++ b/Examples/octave/operator/@swig_ref/horzcat.m
@@ -1,6 +1,9 @@
% test octaves concatenation operator
-function ret=horzcat(a, b)
- % return the concatenation of two ComplexVal values as a cell array.
+function ret=horzcat(varargin)
+ % return the concatenation of several ComplexVal values as a cell array.
% (not really useful but it tests the concatenation of swig_ref objects)
- ret={a, b};
+ ret={};
+ for i=1:length(varargin)
+ ret{i}=varargin{i};
+ end
end
diff --git a/Examples/octave/operator/runme.m b/Examples/octave/operator/runme.m
index 41c2c14a7..ff8b594da 100644
--- a/Examples/octave/operator/runme.m
+++ b/Examples/octave/operator/runme.m
@@ -47,6 +47,5 @@ if swig_octave_prereq(3,8,0)
endif
# concatenation operator, note: calls @swig_ref/horzcat.m
-# g = [a, b, c];
-# printf("g = %s\n",disp(g));
-# Above temporarily removed as broken in octave-7.2.0, see https://github.com/swig/swig/issues/2353
+g = [a, b, c];
+printf("g = %s\n",disp(g));
diff --git a/Examples/perl5/index.html b/Examples/perl5/index.html
index 23c8ff658..2daabaaf9 100644
--- a/Examples/perl5/index.html
+++ b/Examples/perl5/index.html
@@ -72,7 +72,7 @@ Please see the
Windows page in the m
Due to wide variations in the Perl C API and differences between versions such as the ActivePerl release for Windows,
the code generated by SWIG is extremely messy.
If the code doesn't compile or work with your version of Perl, please let us know by
-contacting us on the
mailing lists .
+contacting us on the
mailing lists .
Better yet, send us a patch.