Merge remote-tracking branch 'upstream/master' into OCaml-INPUT-OUTPUT-INOUT-primitives

This commit is contained in:
Zackery Spytz 2019-05-08 14:05:02 -06:00
commit 2f48bec666
363 changed files with 5825 additions and 2936 deletions

View file

@ -5,115 +5,139 @@ matrix:
os: linux
env: SWIGLANG=
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=
sudo: required
dist: trusty
dist: xenial
- os: linux
env: SWIGLANG= SWIG_CC=gcc-5 SWIG_CXX=g++-5 CPP11=1
env: SWIGLANG= GCC=4.4
sudo: required
dist: trusty
dist: xenial
- os: linux
env: SWIGLANG= SWIG_CC=gcc-6 SWIG_CXX=g++-6
env: SWIGLANG= GCC=4.6
sudo: required
dist: trusty
dist: xenial
- os: linux
env: SWIGLANG= GCC=4.7
sudo: required
dist: xenial
- os: linux
env: SWIGLANG= GCC=4.8
sudo: required
dist: xenial
- os: linux
env: SWIGLANG= GCC=4.9
sudo: required
dist: xenial
- os: linux
env: SWIGLANG= GCC=6
sudo: required
dist: xenial
- os: linux
env: SWIGLANG= GCC=7
sudo: required
dist: xenial
- os: linux
env: SWIGLANG= GCC=8
sudo: required
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=csharp
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=d
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=go
env: SWIGLANG=go VER=1.3
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=go VER=1.5
env: SWIGLANG=go VER=1.8
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=go VER=1.12
sudo: required
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=guile
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=java
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=javascript ENGINE=node
env: SWIGLANG=javascript ENGINE=node VER=0.10
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=javascript ENGINE=node VER=4 CPP11=1
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=javascript ENGINE=node VER=6 CPP11=1
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=javascript ENGINE=node VER=8 CPP11=1
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=javascript ENGINE=node VER=10 CPP11=1
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=javascript ENGINE=jsc
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=javascript ENGINE=v8
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=lua
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=lua VER=5.3
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=mzscheme
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=ocaml
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=octave SWIGJOBS=-j2 # 3.8
env: SWIGLANG=octave SWIGJOBS=-j2
sudo: required
dist: trusty
- compiler: gcc
os: linux
env: SWIGLANG=octave SWIGJOBS=-j2 VER=4.0
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=octave SWIGJOBS=-j2 VER=4.2 CPP11=1
@ -128,130 +152,130 @@ matrix:
os: linux
env: SWIGLANG=perl5
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=php VER=7.0
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=php VER=7.1
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=php VER=7.2
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=php VER=7.3
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=python # 2.7
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=python PY3=3 VER=3.2
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=python PY3=3 VER=3.3
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=python PY3=3 VER=3.4
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=python PY3=3 VER=3.5
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=python PY3=3 VER=3.6
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=python PY3=3 VER=3.7
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=python SWIG_FEATURES=-builtin
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=python SWIG_FEATURES="-builtin -O"
sudo: required
dist: trusty
dist: xenial
- os: linux
env: SWIGLANG=python SWIG_FEATURES=-builtin SWIG_CC=gcc-6 SWIG_CXX=g++-6 CPP11=1
env: SWIGLANG=python SWIG_FEATURES=-builtin GCC=6 CPP11=1
sudo: required
dist: trusty
dist: xenial
- os: linux
env: SWIGLANG=python SWIG_FEATURES=-builtin SWIG_CC=gcc-6 SWIG_CXX=g++-6 CPP11=1 PY3=3 VER=3.7
env: SWIGLANG=python SWIG_FEATURES=-builtin GCC=6 CPP11=1 PY3=3 VER=3.7
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=python SWIG_FEATURES=-builtin PY3=3 VER=3.4
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=python SWIG_FEATURES=-builtin PY3=3 VER=3.5
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=python SWIG_FEATURES=-builtin PY3=3 VER=3.7
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=python SWIG_FEATURES="-builtin -O" PY3=3 VER=3.7
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=python SWIG_FEATURES=-builtin PY3=3 VER=3.7 SWIGOPTPY3=
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=python SWIG_FEATURES=-O
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=python SWIG_FEATURES=-O PY3=3 VER=3.7
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=r
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=ruby VER=1.9.3
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=ruby VER=2.0.0
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=ruby VER=2.3.0
@ -261,84 +285,84 @@ matrix:
os: linux
env: SWIGLANG=scilab
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=tcl
sudo: required
dist: trusty
dist: xenial
- os: linux
env: SWIGLANG=csharp SWIG_CC=gcc-5 SWIG_CXX=g++-5 CPP11=1
env: SWIGLANG=csharp CPP11=1
sudo: required
dist: xenial
- os: linux
env: SWIGLANG=go VER=1.6 CPP11=1
sudo: required
dist: trusty
- os: linux
env: SWIGLANG=go SWIG_CC=gcc-5 SWIG_CXX=g++-5 CPP11=1
env: SWIGLANG=java CPP11=1
sudo: required
dist: trusty
dist: xenial
- os: linux
env: SWIGLANG=java SWIG_CC=gcc-5 SWIG_CXX=g++-5 CPP11=1
env: SWIGLANG=python CPP11=1
sudo: required
dist: trusty
- os: linux
env: SWIGLANG=python SWIG_CC=gcc-5 SWIG_CXX=g++-5 CPP11=1
sudo: required
dist: trusty
dist: xenial
- os: linux
env: SWIGLANG=r CPP11=1 # Note: making 'R CMD SHLIB' use a different compiler is non-trivial
sudo: required
dist: trusty
dist: xenial
- os: linux
env: SWIGLANG=ruby SWIG_CC=gcc-5 SWIG_CXX=g++-5 CPP11=1
env: SWIGLANG=ruby CPP11=1
sudo: required
dist: xenial
- os: linux
env: SWIGLANG=tcl CPP11=1
sudo: required
dist: xenial
- os: linux
env: SWIGLANG=csharp GCC=6 CPP14=1
sudo: required
dist: xenial
- os: linux
env: SWIGLANG=go GCC=6 CPP14=1
sudo: required
dist: trusty
- os: linux
env: SWIGLANG=tcl SWIG_CC=gcc-5 SWIG_CXX=g++-5 CPP11=1
env: SWIGLANG=java GCC=6 CPP14=1
sudo: required
dist: trusty
dist: xenial
- os: linux
env: SWIGLANG=csharp SWIG_CC=gcc-6 SWIG_CXX=g++-6 CPP14=1
env: SWIGLANG=python GCC=6 CPP14=1
sudo: required
dist: trusty
dist: xenial
- os: linux
env: SWIGLANG=go SWIG_CC=gcc-6 SWIG_CXX=g++-6 CPP14=1
env: SWIGLANG=ruby GCC=6 CPP14=1
sudo: required
dist: trusty
dist: xenial
- os: linux
env: SWIGLANG=java SWIG_CC=gcc-6 SWIG_CXX=g++-6 CPP14=1
env: SWIGLANG=tcl GCC=6 CPP14=1
sudo: required
dist: trusty
dist: xenial
- os: linux
env: SWIGLANG=python SWIG_CC=gcc-6 SWIG_CXX=g++-6 CPP14=1
env: SWIGLANG=java GCC=7 CPP14=1
sudo: required
dist: trusty
dist: xenial
- os: linux
env: SWIGLANG=ruby SWIG_CC=gcc-6 SWIG_CXX=g++-6 CPP14=1
env: SWIGLANG=python GCC=7 CPP14=1
sudo: required
dist: trusty
dist: xenial
- os: linux
env: SWIGLANG=tcl SWIG_CC=gcc-6 SWIG_CXX=g++-6 CPP14=1
env: SWIGLANG=csharp GCC=8 CPP17=1
sudo: required
dist: trusty
dist: xenial
- os: linux
env: SWIGLANG=java SWIG_CC=gcc-7 SWIG_CXX=g++-7 CPP14=1
env: SWIGLANG=java GCC=8 CPP17=1
sudo: required
dist: trusty
dist: xenial
- os: linux
env: SWIGLANG=python SWIG_CC=gcc-7 SWIG_CXX=g++-7 CPP14=1
env: SWIGLANG=python GCC=8 CPP17=1 PY3=3 VER=3.7
sudo: required
dist: trusty
- os: linux
env: SWIGLANG=csharp SWIG_CC=gcc-8 SWIG_CXX=g++-8 CPP17=1
sudo: required
dist: trusty
- os: linux
env: SWIGLANG=java SWIG_CC=gcc-8 SWIG_CXX=g++-8 CPP17=1
sudo: required
dist: trusty
- os: linux
env: SWIGLANG=python SWIG_CC=gcc-8 SWIG_CXX=g++-8 CPP17=1 PY3=3 VER=3.7
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: osx
env: SWIGLANG=
@ -377,12 +401,12 @@ matrix:
env: SWIGLANG=tcl
allow_failures:
# Deprecated functions causing build failure since upgrade from Node v10.11.0 to v10.12.0
# seg fault in director_basic testcase
- compiler: gcc
os: linux
env: SWIGLANG=javascript ENGINE=node VER=10 CPP11=1
env: SWIGLANG=php VER=7.2
sudo: required
dist: trusty
dist: xenial
# Sometimes hits the Travis 50 minute time limit
- compiler: gcc
os: linux
@ -394,33 +418,29 @@ matrix:
os: linux
env: SWIGLANG=mzscheme
sudo: required
dist: trusty
dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=ocaml
sudo: required
dist: trusty
dist: xenial
before_install:
- date -u
- uname -a
- if test "$TRAVIS_OS_NAME" = "linux"; then lscpu && cat /proc/cpuinfo | grep "model name" && cat /proc/meminfo | grep MemTotal; fi
- if test "$TRAVIS_OS_NAME" = "osx"; then sysctl -a | grep brand_string; fi
# Travis overrides CC environment with compiler predefined values
- if test -n "$SWIG_CC"; then export CC="$SWIG_CC"; fi
- if test -n "$SWIG_CXX"; then export CXX="$SWIG_CXX"; fi
# Travis overrides CC environment with compiler predefined values
- if test -n "$GCC"; then export CC="gcc-$GCC" && export CXX="g++-$GCC"; fi
install:
- if test "$TRAVIS_OS_NAME" = "linux"; then source Tools/travis-linux-install.sh; fi
- if test "$TRAVIS_OS_NAME" = "osx"; then source Tools/travis-osx-install.sh; fi
- ls -la $(which $CC) $(which $CXX) && $CC --version && $CXX --version
script:
- echo 'Configuring...' && echo -en 'travis_fold:start:script.1\\r'
- if test -n "$CPP11"; then CONFIGOPTS+=(--enable-cpp11-testing --without-maximum-compile-warnings "CXXFLAGS=-std=c++11 -Wall -Wextra" "CFLAGS=-std=c11 -Wall -Wextra") && export CSTD=c11 && export CPPSTD=c++11; fi
- if test -n "$CPP14"; then CONFIGOPTS+=(--enable-cpp11-testing --without-maximum-compile-warnings "CXXFLAGS=-std=c++14 -Wall -Wextra" "CFLAGS=-std=c11 -Wall -Wextra") && export CSTD=c11 && export CPPSTD=c++14; fi
- if test -n "$CPP17"; then CONFIGOPTS+=(--enable-cpp11-testing --without-maximum-compile-warnings "CXXFLAGS=-std=c++17 -Wall -Wextra" "CFLAGS=-std=c17 -Wall -Wextra") && export CSTD=c17 && export CPPSTD=c++17; fi
- ls -la $(which $CC)
- ls -la $(which $CXX)
- $CC --version
- $CXX --version
script:
- echo 'Configuring...' && echo -en 'travis_fold:start:script.1\\r'
- if test -n "$SWIGLANG"; then CONFIGOPTS+=(--without-alllang --with-$WITHLANG); fi
- echo "${CONFIGOPTS[@]}"
- ./autogen.sh && mkdir -p build/build && cd build/build && ../../configure "${CONFIGOPTS[@]}"

View file

@ -1,8 +1,8 @@
*** ANNOUNCE: SWIG 4.0.0 (in progress) ***
*** ANNOUNCE: SWIG 4.0.1 (in progress) ***
http://www.swig.org
We're pleased to announce SWIG-4.0.0, the latest SWIG release.
We're pleased to announce SWIG-4.0.1, the latest SWIG release.
What is SWIG?
=============
@ -10,13 +10,11 @@ What is SWIG?
SWIG is a software development tool that reads C/C++ header files and
generates the wrapper code needed to make C and C++ code accessible
from other programming languages including Perl, Python, Tcl, Ruby,
PHP, C#, Go, Java, Javascript, Lua, Scheme (Guile, MzScheme),
D, Ocaml, Octave, R, Scilab.
SWIG can also export its parse tree in
the form of XML. Major applications of SWIG
include generation of scripting language extension modules, rapid
prototyping, testing, and user interface development for large
C/C++ systems.
PHP, C#, Go, Java, Javascript, Lua, Scheme (Guile, MzScheme), D,
Ocaml, Octave, R, Scilab. SWIG can also export its parse tree in
the form of XML. Major applications of SWIG include generation of
scripting language extension modules, rapid prototyping, testing,
and user interface development for large C/C++ systems.
Release Notes
=============
@ -27,11 +25,11 @@ Availability
============
The release is available for download on Sourceforge at
http://prdownloads.sourceforge.net/swig/swig-4.0.0.tar.gz
http://prdownloads.sourceforge.net/swig/swig-4.0.1.tar.gz
A Windows version is also available at
http://prdownloads.sourceforge.net/swig/swigwin-4.0.0.zip
http://prdownloads.sourceforge.net/swig/swigwin-4.0.1.zip
Please report problems with this release to the swig-devel mailing list,
details at http://www.swig.org/mail.html.

1535
CHANGES

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -19,6 +19,7 @@ Active SWIG Developers:
Oliver Buchtala (oliver.buchtala@gmail.com) (Javascript)
Neha Narang (narangneha03@gmail.com) (Javascript)
Simon Marchetto (simon.marchetto@scilab-enterprises.com) (Scilab)
Zackery Spytz (zspytz@gmail.com) (OCaml, SWIG core)
Past SWIG developers and major contributors include:
Dave Beazley (dave-swig@dabeaz.com) (SWIG core, Python, Tcl, Perl)
@ -28,7 +29,7 @@ Past SWIG developers and major contributors include:
Mikel Bancroft (mikel@franz.com) (Allegro CL)
Surendra Singhi (efuzzyone@netscape.net) (CLISP, CFFI)
Marcelo Matus (mmatus@acms.arizona.edu) (SWIG core, Python, UTL[python,perl,tcl,ruby])
Art Yerkes (ayerkes@speakeasy.net) (Ocaml)
Art Yerkes (ayerkes@speakeasy.net) (OCaml)
Lyle Johnson (lyle@users.sourceforge.net) (Ruby)
Charlie Savage (cfis@interserv.com) (Ruby)
Thien-Thi Nguyen (ttn@glug.org) (build/test/misc)

View file

@ -48,7 +48,7 @@ This chapter contains a few Android specific notes and examples.
<p>
The examples require the <a href="http://developer.android.com/sdk/index.html">Android SDK</a> and <a href="http://developer.android.com/tools/sdk/ndk/index.html">Android NDK</a> which can be installed as per instructions in the links.
The examples require the <a href="https://developer.android.com/sdk/">Android SDK</a> and <a href="https://developer.android.com/ndk/">Android NDK</a> which can be installed as per instructions in the links.
The Eclipse version is not required for these examples as just the command line tools are used (shown for Linux as the host, but Windows will be very similar, if not identical in most places).
Add the SDK tools and NDK tools to your path and create a directory somewhere for your Android projects (adjust PATH as necessary to where you installed the tools):
</p>
@ -326,7 +326,7 @@ include $(BUILD_SHARED_LIBRARY)
</div>
<p>
See the <a href="http://developer.android.com/sdk/ndk/index.html">Android NDK documentation</a> for more on the NDK build system and getting started with the NDK.
See the <a href="https://developer.android.com/ndk/">Android NDK documentation</a> for more on the NDK build system and getting started with the NDK.
A simple invocation of ndk-build will compile the .c files and generate a shared object/system library. Output will be similar to:
</p>

View file

@ -458,7 +458,7 @@ Thanks to the following people for their contributions to ccache
<p>
ccache was written by Andrew Tridgell
<a href="http://samba.org/~tridge/">http://samba.org/~tridge/</a>.
<a href="https://www.samba.org/~tridge/">https://www.samba.org/~tridge/</a>.
ccache was adapted to create ccache-swig for use with SWIG by William Fulton.
<p>
If you wish to report a problem or make a suggestion then please email

View file

@ -64,15 +64,15 @@ The wrapper code implementation uses C# and the Platform Invoke (PInvoke) interf
The PInvoke interface has been chosen over Microsoft's Managed C++ interface as it is portable to both Microsoft Windows and non-Microsoft platforms.
PInvoke is part of the ECMA/ISO C# specification.
It is also better suited for robust production environments due to the Managed C++ flaw called the
<a href="http://msdn.microsoft.com/en-us/library/aa290048(VS.71).aspx">Mixed DLL Loading Problem</a>.
<a href="https://msdn.microsoft.com/en-us/ie/aa290048(v=vs.94)">Mixed DLL Loading Problem</a>.
SWIG C# works equally well on non-Microsoft operating systems such as Linux, Solaris and Apple Mac using
<a href="http://www.mono-project.com/Main_Page">Mono</a> and <a href="http://www.dotgnu.org/pnet.html">Portable.NET</a>.
<a href="https://www.mono-project.com/Main_Page/">Mono</a> and <a href="http://www.dotgnu.org/pnet.html">Portable.NET</a>.
</p>
<p>
To get the most out of this chapter an understanding of interop is required.
The <a href="http://msdn.microsoft.com">Microsoft Developer Network (MSDN)</a> has a good reference guide in a section titled "Interop Marshaling".
Monodoc, available from the Mono project, has a very useful section titled <a href="http://www.mono-project.com/docs/advanced/pinvoke/">Interop with native libraries</a>.
The <a href="https://msdn.microsoft.com">Microsoft Developer Network (MSDN)</a> has a good reference guide in a section titled "Interop Marshaling".
Monodoc, available from the Mono project, has a very useful section titled <a href="https://www.mono-project.com/docs/advanced/pinvoke/">Interop with native libraries</a>.
</p>
<H3><a name="CSharp_introduction_swig2_compatibility">22.1.1 SWIG 2 Compatibility</a></H3>
@ -232,8 +232,8 @@ javacode -&gt; cscode
javaimports -&gt; csimports
javabody -&gt; csbody
javafinalize -&gt; csfinalize
javadestruct -&gt; csdestruct
javadestruct_derived -&gt; csdestruct_derived
javadestruct -&gt; csdisposing and csdispose
javadestruct_derived -&gt; csdisposing_derived and csdispose_derived
javainterfacecode -&gt; csinterfacecode
</pre></div>
@ -643,7 +643,7 @@ passing a direct reference as described in the next section.
<p>
For more information on the subject, see the
<a href="http://msdn.microsoft.com/en-us/library/z6cfh6e6(VS.80).aspx">Default Marshaling for Arrays</a> article
<a href="https://docs.microsoft.com/en-us/dotnet/framework/interop/default-marshaling-for-arrays">Default Marshaling for Arrays</a> article
on MSDN.
</p>
@ -763,7 +763,7 @@ another thread may produce enough garbage to trigger garbage collection.
</p>
<p>
For more information, see the <a href="http://msdn.microsoft.com/en-us/library/f58wzh21(VS.80).aspx">fixed statement</a> in the C# language reference.
For more information, see the <a href="https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/fixed-statement">fixed statement</a> in the C# language reference.
</p>

View file

@ -647,6 +647,10 @@
<li><a href="Doxygen.html#Doxygen_python_unsupported_tags">Unsupported tags</a>
<li><a href="Doxygen.html#Doxygen_python_further_details">Further details</a>
</ul>
<li><a href="Doxygen.html#Doxygen_troubleshooting">Troubleshooting</a>
<ul>
<li><a href="Doxygen.html#troubleshooting_ifndef">Problem with conditional compilation</a>
</ul>
<li><a href="Doxygen.html#Doxygen_developer_details">Developer information</a>
<ul>
<li><a href="Doxygen.html#Doxygen_translator_design">Doxygen translator design</a>

View file

@ -56,7 +56,7 @@
<H2><a name="D_command_line_invocation">23.2 Command line invocation</a></H2>
<p>To activate the D module, pass the <tt>-d</tt> option to SWIG at the command line. The same standard command line switches as with any other language module are available, plus the following D specific ones:</p>
<p>To activate the D module, pass the <tt>-d</tt> option to SWIG at the command line. The same standard command line options as with any other language module are available, plus the following D specific ones:</p>
<dl>
<dt><tt>-d2</tt></dt>
@ -66,8 +66,8 @@
<dt><a name="D_splitproxy"></a><tt>-splitproxy</tt></dt>
<dd>
<p>By default, SWIG generates two D modules: the <em>proxy</em> module, named like the source module (either specified via the <tt>%module</tt> directive or via the <tt>module</tt> command line switch), which contains all the proxy classes, functions, enums, etc., and the <em>intermediary</em> module (named like the proxy module, but suffixed with <tt>_im</tt>), which contains all the <tt>extern(C)</tt> function declarations and other private parts only used internally by the proxy module.</p>
<p>If the split proxy mode is enabled by passing this switch at the command line, all proxy classes and enums are emitted to their own D module instead. The main proxy module only contains free functions and constants in this case.</p>
<p>By default, SWIG generates two D modules: the <em>proxy</em> module, named like the source module (either specified via the <tt>%module</tt> directive or via the <tt>module</tt> command line option), which contains all the proxy classes, functions, enums, etc., and the <em>intermediary</em> module (named like the proxy module, but suffixed with <tt>_im</tt>), which contains all the <tt>extern(C)</tt> function declarations and other private parts only used internally by the proxy module.</p>
<p>If the split proxy mode is enabled by passing this option at the command line, all proxy classes and enums are emitted to their own D module instead. The main proxy module only contains free functions and constants in this case.</p>
</dd>
<dt><tt>-package &lt;pkg&gt;</tt></dt>
@ -77,7 +77,7 @@
<dt><tt>-wrapperlibrary &lt;wl&gt;</tt></dt>
<dd>
<p>The code SWIG generates to dynamically load the C/C++ wrapper layer looks for a library called <tt>$module_wrap</tt> by default. With this switch, you can override the name of the file the wrapper code loads at runtime (the <tt>lib</tt> prefix and the suffix for shared libraries are appended automatically, depending on the OS).</p>
<p>The code SWIG generates to dynamically load the C/C++ wrapper layer looks for a library called <tt>$module_wrap</tt> by default. With this option, you can override the name of the file the wrapper code loads at runtime (the <tt>lib</tt> prefix and the suffix for shared libraries are appended automatically, depending on the OS).</p>
<p>This might especially be useful if you want to invoke SWIG several times on separate modules, but compile the resulting code into a single shared library.</p>
</dd>
</dl>
@ -107,8 +107,8 @@
csimports &lt;-&gt; dimports
csbody &lt;-&gt; dbody
csfinalize &lt;-&gt; ddestructor
csdestruct &lt;-&gt; ddispose
csdestruct_derived &lt;-&gt; ddispose_derived
csdisposing &lt;-&gt; ddispose
csdisposing_derived &lt;-&gt; ddispose_derived
</pre></div>

View file

@ -37,6 +37,10 @@
<li><a href="#Doxygen_python_unsupported_tags">Unsupported tags</a>
<li><a href="#Doxygen_python_further_details">Further details</a>
</ul>
<li><a href="#Doxygen_troubleshooting">Troubleshooting</a>
<ul>
<li><a href="#troubleshooting_ifndef">Problem with conditional compilation</a>
</ul>
<li><a href="#Doxygen_developer_details">Developer information</a>
<ul>
<li><a href="#Doxygen_translator_design">Doxygen translator design</a>
@ -63,13 +67,13 @@ supported.
<p>
The Doxygen Translation module of SWIG adds an extra layer of
functionality to SWIG, allowing automated translation of <a href=
"http://www.stack.nl/~dimitri/doxygen/">Doxygen</a> formatted comments
"http://www.doxygen.nl/manual/">Doxygen</a> 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.
Other extensions could be added at a later date.
The Doxygen Translation module originally started as
a <a href="http://code.google.com/soc/2008/">Google Summer of
a <a href="https://developers.google.com/open-source/gsoc/2008/">Google Summer of
Code</a> proposal from Summer 2008.
</p>
@ -79,14 +83,14 @@ Code</a> proposal from Summer 2008.
<p>
To make use of the comment translation system, your documentation
comments must be in properly formatted <a href=
"http://www.stack.nl/~dimitri/doxygen/">Doxygen.</a> Doxygen comments can be
"http://www.doxygen.nl/manual/">Doxygen.</a> 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 <a href=
"http://www.stack.nl/~dimitri/doxygen/docblocks.html"> Documenting the
"http://www.doxygen.nl/manual/docblocks.html"> Documenting the
code</a> 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).
@ -94,7 +98,7 @@ in comments (like unterminated strings or missing ending tags).
<p>
Currently, the whole subset of Doxygen comment styles is supported
(See <a href="http://www.stack.nl/~dimitri/doxygen/docblocks.html">
(See <a href="http://www.doxygen.nl/manual/docblocks.html">
Documenting the code</a>). Here they are:
</p>
@ -194,7 +198,7 @@ These structural commands are stripped out by SWIG and are not assigned to anyth
<p>
Doxygen comments translation is disabled by default and needs to be explicitly
enabled using the command line <tt>-doxygen</tt> switch for the languages that
enabled using the command line <tt>-doxygen</tt> option for the languages that
do support it (currently Java and Python).
</p>
@ -293,7 +297,7 @@ make much sense for the other languages without explicit ownership management.
<p>
Doxygen syntax is rather rich and, in addition to simple commands such as
<tt>@transferfull</tt>, it is also possible to define commands with arguments.
As explained in <a href="http://www.stack.nl/~dimitri/doxygen/manual/commands.html">Doxygen documentation</a>,
As explained in <a href="http://www.doxygen.nl/manual/commands.html">Doxygen documentation</a>,
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 <tt>range="line"</tt> argument of the
@ -818,7 +822,7 @@ Here is the list of all Doxygen tags and the description of how they are transla
<p>
Doxygen has a wealth of tags such as @latexonly that have no
equivalent in Javadoc (all supported tags are listed in
<a href="http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html">Javadoc documentation</a>).
<a href="https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html">Javadoc documentation</a>).
As a result several tags have no
translation or particular use, such as some linking and section tags.
These are suppressed with their content just printed out (if the tag has any
@ -1223,9 +1227,9 @@ 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 <a href="http://www.stack.nl/~dimitri/doxygen/docblocks.html#pythonblocks">Doxygen
(see <a href="http://www.doxygen.nl/manual/docblocks.html#pythonblocks">Doxygen
docs</a>), you may want to use some tool like doxypy
(<a href="http://code.foosel.org/doxypy">http://code.foosel.org/doxypy</a>)
(<a href="https://pypi.org/project/doxypy/">doxypy</a>)
to do the work.
</p>
@ -1634,14 +1638,76 @@ Here is the list of these tags:
TO BE ADDED.
</p>
<H2><a name="Doxygen_developer_details">17.5 Developer information</a></H2>
<H2><a name="Doxygen_troubleshooting">17.5 Troubleshooting</a></H2>
<p>
When running SWIG with command line option <tt>-doxygen</tt>, it may happen
that SWIG will fail to parse the code, which is valid C++ code and
is parsed without problems without the option. The problem is,
that Doxygen comments are not tokens (the C/C++ compiler actually never
sees them) and that they can appear anywhere in the code. That's why it is
practically impossible to handle all corner cases with the parser.
However, these problems can usually be avoided by minor changes in the
code or comment. Known problems and solutions are shown in this section.
</p>
<p>
Recommended approach is to first run SWIG without command line
option <tt>-doxygen</tt>. When it successfully processes the code,
include the option and fix problems with Doxygen comments.
</p>
<H3><a name="troubleshooting_ifndef">17.5.1 Problem with conditional compilation</a></H3>
<p>
Inserting a conditional compilation preprocessor directive between a
Doxygen comment and a commented item may break parsing:
</p>
<div class="code"><pre>
class A {
/**
* Some func.
*/
<font color='#ff0000'>#ifndef SWIG</font>
void myfunc()
{
}
#endif
};
</pre></div>
<p>
The solution is to move the directive above the comment:
</p>
<div class="code"><pre>
class A {
<font color='#00d000'>#ifndef SWIG</font>
/**
* Some func.
*/
void myfunc()
{
}
#endif
};
</pre></div>
<H2><a name="Doxygen_developer_details">17.6 Developer information</a></H2>
<p>
This section contains information for developers enhancing the Doxygen translator.
</p>
<H3><a name="Doxygen_translator_design">17.5.1 Doxygen translator design</a></H3>
<H3><a name="Doxygen_translator_design">17.6.1 Doxygen translator design</a></H3>
<p>
@ -1667,11 +1733,11 @@ class for translation into the target documentation language. For
example, <tt>JavaDocConverter</tt> is the Javadoc module class.
</p>
<H3><a name="Doxygen_debugging_commands">17.5.2 Debugging the Doxygen parser and translator</a></H3>
<H3><a name="Doxygen_debugging_commands">17.6.2 Debugging the Doxygen parser and translator</a></H3>
<p>
There are two handy command line switches, that enable lots of
There are two handy command line options, that enable lots of
detailed debug information printing.
</p>
@ -1680,7 +1746,7 @@ detailed debug information printing.
-debug-doxygen-translator - Display Doxygen translator module debugging information
</pre></div>
<H3><a name="Doxygen_tests">17.5.3 Tests</a></H3>
<H3><a name="Doxygen_tests">17.6.3 Tests</a></H3>
<p>
@ -1732,7 +1798,7 @@ Runtime tests in Python are just plain string comparisons of the __doc__
properties.
</p>
<H2><a name="Doxygen_language_extension">17.6 Extending to other languages</a></H2>
<H2><a name="Doxygen_language_extension">17.7 Extending to other languages</a></H2>
<p>

View file

@ -125,16 +125,15 @@ Go distribution. To generate code for gccgo, you should also use the
</p>
<p>
When using the <tt>-cgo</tt> option, SWIG will generate files that can be used
directly by <tt>go build</tt>. Starting with the Go 1.5 distribution the
<tt>-cgo</tt> option has to be given. Put your SWIG interface file in a
directory under GOPATH/src, and give it a name that does <b>not</b> end in the
.swig or .swigcxx extension. Typically the SWIG interface file extension is .i
in this case.
By default SWIG will generate files that can be used directly
by <tt>go build</tt>. This requires Go 1.2 or later. Put your SWIG
interface file in a directory under GOPATH/src, and give it a name
that does <b>not</b> end in the .swig or .swigcxx extension.
Typically the SWIG interface file extension is .i in this case.
</p>
<div class="code"><pre>
% swig -go -cgo example.i
% swig -go example.i
% go install
</pre></div>
@ -144,15 +143,16 @@ usual.
</p>
<p>
To use SWIG without the <tt>-cgo</tt> option, more steps are required. Recall
that this only works with Go versions before 1.5. When using Go version 1.2 or
later, or when using gccgo, the code generated by SWIG can be linked directly
into the Go program. A typical command sequence when using the Go compiler of
the Go distribution would look like this:
SWIG can be used without cgo, via the <tt>-no-cgo</tt> option, but
more steps are required. This only works with Go versions before 1.5.
When using Go version 1.2 or later, or when using gccgo, the code
generated by SWIG can be linked directly into the Go program. A
typical command sequence when using the Go compiler of the Go
distribution would look like this:
</p>
<div class="code"><pre>
% swig -go example.i
% swig -go -no-cgo example.i
% gcc -c code.c # The C library being wrapped.
% gcc -c example_wrap.c
% go tool 6g example.go
@ -169,7 +169,7 @@ sequence for this approach would look like this:
</p>
<div class="code"><pre>
% swig -go -use-shlib example.i
% swig -go -no-cgo -use-shlib example.i
% gcc -c -fpic example.c
% gcc -c -fpic example_wrap.c
% gcc -shared example.o example_wrap.o -o example.so
@ -200,10 +200,15 @@ swig -go -help
<tr>
<td>-cgo</td>
<td>Generate files to be used as input for the Go cgo tool. This
option is required for Go 1.5 and later, and works for Go 1.2 and
later. In the future this option will likely become the
default.</td>
<td>Generate files to be used as input for the Go cgo tool. This is
the default.</td>
</tr>
<tr>
<td>-no-cgo</td>
<td>Generate files that can be used directly, rather than via the Go
cgo tool. This option does not work with Go 1.5 or later. It is
required for versions of Go before 1.2.</td>
</tr>
<tr>
@ -261,6 +266,13 @@ swig -go -help
ignored.</td>
</tr>
<tr>
<td>-import-prefix &lt;prefix&gt;</td>
<td>A prefix to add when turning a %import prefix in the SWIG
interface file into an import statement in the Go file. For
example, with <code>-import-prefix mymodule</code>, a SWIG
interface file <code>%import mypackage</code> will become a Go
import statement <code>import "mymodule/mypackage"</code>.</td>
</table>
@ -268,11 +280,11 @@ swig -go -help
<p>There are two different approaches to generating wrapper files,
controlled by SWIG's <tt>-cgo</tt> option. The <tt>-cgo</tt> option
works with Go version 1.2 or later. It is required when using Go
version 1.5 or later.</p>
controlled by SWIG's <tt>-no-cgo</tt> option. The <tt>-no-cgo</tt>
option only works with version of Go before 1.5. It is required
when using versions of Go before 1.2.</p>
<p>With or without the <tt>-cgo</tt> option, SWIG will generate the
<p>With or without the <tt>-no-cgo</tt> option, SWIG will generate the
following files when generating wrapper code:</p>
<ul>
@ -296,8 +308,8 @@ or C++ compiler.
</li>
</ul>
<p>When neither the <tt>-cgo</tt> nor the <tt>-gccgo</tt> option is
used, SWIG will also generate an additional file:</p>
<p>When the <tt>-no-cgo</tt> option is used, and the <tt>-gccgo</tt>
option is not used, SWIG will also generate an additional file:</p>
<ul>
<li>
@ -785,7 +797,9 @@ In order to override virtual methods on a C++ class with Go methods the
<tt>NewDirectorClassName</tt> constructor functions receives a
<tt>DirectorInterface</tt> argument. The methods in the <tt>
DirectorInterface</tt> are a subset of the public and protected virtual methods
of the C++ class. If the <tt>DirectorInterface</tt> contains a method with a
of the C++ class.
Virtual methods that have a final specifier are unsurprisingly excluded.
If the <tt>DirectorInterface</tt> contains a method with a
matching signature to a virtual method of the C++ class then the virtual C++
method will be overwritten with the Go method. As Go doesn't support protected
methods all overridden protected virtual C++ methods will be public in Go.
@ -1289,7 +1303,7 @@ fraction := modulename.Modf(5.0, ptr)
</pre>
</div>
<p>Since this is ugly, you may want to wrap the swig-generated API with
some <a href="#Embedded_go_code">additional functions written in go</a> that
some <a href="#Go_adding_additional_code">additional functions written in go</a> that
hide the ugly details.</p>
<p>There are no <code>char&nbsp;*OUTPUT</code> typemaps. However you can

View file

@ -163,7 +163,7 @@ This ability to interface C/C++ to many different target languages is one of SWI
<p>
SWIG is very broadly composed of two components.
A core component creates a parse tree from the input C/C++ and SWIG directives (extensions to C/C++).
A core component creates a parse tree from the input ISO C/C++ and SWIG directives (extensions to the C/C++ standards).
The parse tree is then passed to a second component, one of the target language modules for generating code specific to a higher level language.
SWIG supports many different target languages.
These target languages are given a status of either Supported or Experimental.
@ -273,7 +273,7 @@ extern int my_mod(int n, int m);
</pre></div>
<p>
The interface file contains ANSI C function prototypes and variable
The interface file contains ISO C function prototypes and variable
declarations. The <tt>%module</tt> directive defines the name of the
module that will be created by SWIG. The <tt>%{ %}</tt> block
provides a location for inserting additional code, such as C header
@ -400,7 +400,7 @@ major features include:
<ul>
<li>Full C99 preprocessing.
<li>All ANSI C and C++ datatypes.
<li>All ISO C and C++ datatypes.
<li>Functions, variables, and constants.
<li>Classes.
<li>Single and multiple inheritance.
@ -464,7 +464,7 @@ for further information on this and other Autoconf macros.
</p>
<p>
There is growing support for SWIG in some build tools, for example <a href="http://cmake.org">CMake</a>
There is growing support for SWIG in some build tools, for example <a href="https://cmake.org">CMake</a>
is a cross-platform, open-source build manager with built in support for SWIG. CMake can detect the SWIG executable
and many of the target language libraries for linking against.
CMake knows how to build shared libraries and loadable modules on many different operating systems.
@ -531,7 +531,7 @@ to work with complicated and unusual C/C++ applications.
Ironically, the freedom that SWIG provides is countered by an
extremely conservative approach to code generation. At its core, SWIG
tries to distill even the most advanced C++ code down to a small
well-defined set of interface building techniques based on ANSI C
well-defined set of interface building techniques based on ISO C
programming. Because of this, you will find that SWIG interfaces can
be easily compiled by virtually every C/C++ compiler and that they can
be used on any platform. Again, this is an important part of staying out

View file

@ -477,7 +477,7 @@ Exception in thread "main" java.lang.UnsatisfiedLinkError: exampleJNI.gcd(II)I
<p>
where <tt>gcd</tt> is the missing JNI function that SWIG generated into the wrapper file.
Also make sure you pass all of the required libraries to the linker.
The <tt>java -verbose:jni</tt> commandline switch is also a great way to get more information on unresolved symbols.
The <tt>java -verbose:jni</tt> commandline option is also a great way to get more information on unresolved symbols.
One last piece of advice is to beware of the common faux pas of having more than one native library version in your path.
</p>
@ -645,7 +645,7 @@ java::
<p>
To build the DLL and compile the java code, run NMAKE (you may need to run <tt>vcvars32</tt> first).
This is a pretty simplistic Makefile, but hopefully its enough to get you started.
Of course you may want to make changes for it to work for C++ by adding in the -c++ command line switch for swig and replacing .c with .cxx.
Of course you may want to make changes for it to work for C++ by adding in the -c++ command line option for swig and replacing .c with .cxx.
</p>
@ -1113,11 +1113,10 @@ Typesafe enums have their advantages over using plain integers in that they can
However, there are limitations. For example, they cannot be used in switch statements and serialization is an issue.
Please look at the following references for further information:
http://java.sun.com/developer/Books/shiftintojava/page1.html#replaceenums
<a href="http://java.sun.com/developer/Books/shiftintojava/page1.html#replaceenums">Replace Enums with Classes</a> in <i>Effective Java Programming</i> on the Sun website,
<a href="http://www.javaworld.com/javaworld/jw-07-1997/jw-07-enumerated.html">Create enumerated constants in Java</a> JavaWorld article,
<a href="http://www.javaworld.com/javaworld/javatips/jw-javatip133.html">Java Tip 133: More on typesafe enums</a> and
<a href="http://www.javaworld.com/javaworld/javatips/jw-javatip122.html">Java Tip 122: Beware of Java typesafe enumerations</a> JavaWorld tips.
<a href="https://www.javaworld.com/article/2076970/create-enumerated-constants-in-java.html">Create enumerated constants in Java</a> JavaWorld article,
<a href="https://www.javaworld.com/article/2077499/java-tip-133--more-on-typesafe-enums.html">Java Tip 133: More on typesafe enums</a> and
<a href="https://www.javaworld.com/article/2077487/java-tip-122--beware-of-java-typesafe-enumerations.html">Java Tip 122: Beware of Java typesafe enumerations</a> JavaWorld tips.
</p>
<p>
@ -2763,7 +2762,7 @@ The <tt>finalize()</tt> method calls <tt>delete()</tt> which frees any malloc'd
The idea is for <tt>delete()</tt> to be called when you have finished with the C/C++ object.
Ideally you need not call <tt>delete()</tt>, but rather leave it to the garbage collector to call it from the finalizer.
When a program exits, the garbage collector does not guarantee to call all finalizers.
An insight into the reasoning behind this can be obtained from <a href="http://www.hpl.hp.com/techreports/2002/HPL-2002-335.html">Hans Boehm's Destructors, Finalizers, and Synchronization</a> paper.
An insight into the reasoning behind this can be obtained from <a href="https://www.hpl.hp.com/techreports/2002/HPL-2002-335.html">Hans Boehm's Destructors, Finalizers, and Synchronization</a> paper.
Depending on what the finalizers do and which operating system you use, this may or may not be a problem.
</p>
@ -2787,7 +2786,7 @@ Call the <tt>System.runFinalizersOnExit(true)</tt> or <tt>Runtime.getRuntime().r
This method is inherently unsafe. It may result in finalizers being called on live objects while other threads are concurrently manipulating those objects, resulting in erratic behavior or deadlock.
</i></div>
<p>In many cases you will be lucky and find that it works, but it is not to be advocated.
Have a look at <a href="http://www.oracle.com/technetwork/java/index.html">Java web site</a> and search for <tt>runFinalizersOnExit</tt>.
Have a look at <a href="https://www.oracle.com/technetwork/java/index.html">Java web site</a> and search for <tt>runFinalizersOnExit</tt>.
</p></li>
<li><p>
@ -3629,7 +3628,7 @@ The %feature directive can be applied globally, to specific classes, and to spec
// generate directors for all classes that have virtual methods
%feature("director");
// generate directors for all virtual methods in class Foo
// generate directors for the virtual methods in class Foo
%feature("director") Foo;
</pre>
</div>
@ -3647,7 +3646,7 @@ So for example,
</div>
<p>
will generate directors for all virtual methods of class Foo except bar().
will generate directors for the virtual methods of class Foo except bar().
</p>
<p>
@ -3683,7 +3682,8 @@ The director classes store a pointer to their underlying Java proxy classes.
<p>
For simplicity let's ignore the <tt>Swig::Director</tt> class and refer to the original C++ class as the director's base class.
By default, a director class extends all virtual methods in the inheritance chain of its base class (see the preceding section for how to modify this behavior).
Thus all virtual method calls, whether they originate in C++ or in Java via proxy classes, eventually end up in at the implementation in the director class.
Virtual methods that have a final specifier are unsurprisingly excluded.
Thus the virtual method calls, whether they originate in C++ or in Java via proxy classes, eventually end up in at the implementation in the director class.
The job of the director methods is to route these method calls to the appropriate place in the inheritance chain.
By "appropriate place" we mean the method that would have been called if the C++ base class and its Java derived classes were seamlessly integrated.
That seamless integration is exactly what the director classes provide, transparently skipping over all the messy JNI glue code that binds the two languages together.
@ -5644,7 +5644,7 @@ This section describes how you can modify SWIG's default wrapping behavior
for various C/C++ datatypes using the <tt>%typemap</tt> directive.
You are advised to be familiar with the material in the "<a href="Typemaps.html#Typemaps">Typemaps</a>" chapter.
While not absolutely essential knowledge, this section assumes some familiarity with the Java Native Interface (JNI).
JNI documentation can be consulted either online at <a href="http://java.sun.com">Sun's Java web site</a> or from a good JNI book.
JNI documentation can be consulted either online at <a href="https://www.oracle.com/technetwork/java/index.html">the Java web site</a> or from a good JNI book.
The following two books are recommended:</p>
<ul>
@ -6551,7 +6551,7 @@ As there can only be one "javacode" typemap per class, also consider using the
and offers nearly identical functionality.
</div>
<p><tt>%typemap(javadestruct, methodname="delete", methodmodifiers="public synchronized")</tt> <br></p>
<p><tt>%typemap(javadestruct, methodname="delete", methodmodifiers="public synchronized", parameters="")</tt> <br></p>
<div class="indent">
destructor wrapper - the <tt>delete()</tt> method (proxy classes only),
used for all proxy classes except those which have a base class
@ -6562,9 +6562,10 @@ Note that the <tt>delete()</tt> method name is configurable and is specified by
The method modifiers are also configurable via the <tt>methodmodifiers</tt> attribute.
If a <tt>%javamethodmodifiers</tt> is attached to the class' destructor,
it will be used in preference to the <tt>methodmodifiers</tt> typemap attribute for the class.
The <tt>delete</tt> method's parameters declaration can be provided in the optional <tt>parameters</tt> typemap attribute.
</div>
<p><tt>%typemap(javadestruct_derived, methodname="delete", methodmodifiers="public synchronized")</tt></p>
<p><tt>%typemap(javadestruct_derived, methodname="delete", methodmodifiers="public synchronized", parameters="")</tt></p>
<div class="indent">
destructor wrapper - the <tt>delete()</tt> method (proxy classes only),
same as "javadestruct" but only used for derived proxy classes
@ -6575,6 +6576,7 @@ Note that the <tt>delete()</tt> method name is configurable and is specified by
The method modifiers are also configurable via the <tt>methodmodifiers</tt> attribute.
If a <tt>%javamethodmodifiers</tt> is attached to the class' destructor,
it will be used in preference to the <tt>methodmodifiers</tt> typemap attribute for the class.
The <tt>delete</tt> method's parameters declaration can be provided in the optional <tt>parameters</tt> typemap attribute.
</div>
<p><tt>%typemap(javaimports)</tt></p>

View file

@ -1,7 +1,7 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="./style.css">
<link rel="stylesheet" type="text/css" href="style.css">
<title></title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
@ -56,10 +56,10 @@
<p>Javascript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. Its arguably the most popular language for web development.
Javascript has gone beyond being a browser-based scripting language and with <a href="http://nodejs.org">node.js</a>, it is also used as a backend development language.</p>
Javascript has gone beyond being a browser-based scripting language and with <a href="https://nodejs.org">node.js</a>, it is also used as a backend development language.</p>
<p>Native Javascript extensions can be used for applications that embed a web-browser view or that embed a Javascript engine (such as <em>node.js</em>). Extending a general purpose web-browser is not possible as this would be a severe security issue.</p>
<p>SWIG Javascript currently supports <strong>JavascriptCore</strong>, the Javascript engine used by <code>Safari/Webkit</code>, and <a href="https://developers.google.com/v8"><strong>v8</strong></a>, which is used by <code>Chromium</code> and <code>node.js</code>.</p>
<p><a href="http://www.webkit.org/">WebKit</a> is a modern browser implementation available as open-source which can be embedded into an application.
<p>SWIG Javascript currently supports <strong>JavascriptCore</strong>, the Javascript engine used by <code>Safari/Webkit</code>, and <a href="https://v8.dev/"><strong>v8</strong></a>, which is used by <code>Chromium</code> and <code>node.js</code>.</p>
<p><a href="https://webkit.org/">WebKit</a> is a modern browser implementation available as open-source which can be embedded into an application.
With <a href="https://github.com/rogerwang/node-webkit">node-webkit</a> there is a platform which uses Google's <code>Chromium</code> as Web-Browser widget and <code>node.js</code> for javascript extensions.
</p>
@ -289,7 +289,7 @@ extern bool example_initialize(JSGlobalContextRef context, JSObjectRef* exports)
<H4><a name="Javascript_gtk">27.3.2.2 GTK</a></H4>
<p>There is general information about programming GTK at <a href="https://developer.gnome.org/gtk2/">GTK documentation</a> and in the <a href="https://developer.gnome.org/gtk-tutorial">GTK tutorial</a>, and for Webkit there is a <a href="http://webkitgtk.org/reference/webkitgtk/stable/index.html">Webkit GTK+ API Reference</a>.</p>
<p>There is general information about programming GTK at <a href="https://developer.gnome.org/gtk2/">GTK documentation</a> and in the <a href="https://developer.gnome.org/gtk-tutorial/">GTK tutorial</a>, and for Webkit there is a <a href="http://webkitgtk.org/reference/webkitgtk/stable/index.html">Webkit GTK+ API Reference</a>.</p>
<p>An integration of a native extension 'example' would look like this:</p>
<div class="code">
<pre>
@ -604,7 +604,7 @@ at ReadStream.EventEmitter.emit (events.js:98:17)
at emitKey (readline.js:1095:12)</pre>
</div>
<p>
<b>Note</b>: In ECMAScript 5 there is no concept for classes. Instead each function can be used as a constructor function which is executed by the 'new' operator. Furthermore, during construction the key property <code>prototype</code> of the constructor function is used to attach a prototype instance to the created object. A prototype is essentially an object itself that is the first-class delegate of a class used whenever the access to a property of an object fails. The very same prototype instance is shared among all instances of one type. Prototypal inheritance is explained in more detail on in <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Inheritance_and_the_prototype_chain">Inheritance and the prototype chain</a>, for instance.
<b>Note</b>: In ECMAScript 5 there is no concept for classes. Instead each function can be used as a constructor function which is executed by the 'new' operator. Furthermore, during construction the key property <code>prototype</code> of the constructor function is used to attach a prototype instance to the created object. A prototype is essentially an object itself that is the first-class delegate of a class used whenever the access to a property of an object fails. The very same prototype instance is shared among all instances of one type. Prototypal inheritance is explained in more detail on in <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Inheritance_and_the_prototype_chain">Inheritance and the prototype chain</a>, for instance.
</p>
<H2><a name="Javascript_implementation">27.5 Implementation</a></H2>

View file

@ -1365,7 +1365,7 @@ to accomplish this in SWIG. This library provides support for a few common tech
</li>
<li>If used in C++, this library uses <tt>new</tt> and <tt>delete []</tt> for memory
allocation. If using ANSI C, the library uses <tt>malloc()</tt> and <tt>free()</tt>.
allocation. If using C, the library uses <tt>malloc()</tt> and <tt>free()</tt>.
</li>
<li>Rather than manipulating <tt>char *</tt> directly, you might consider using a special string

View file

@ -77,7 +77,7 @@
<p>
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 ANSI C and C++). It's also a <em>really</em> tiny language, less than 6000 lines of code, which compiles to &lt;100 kilobytes of binary code. It can be found at <a href="http://www.lua.org">http://www.lua.org</a>
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 <em>really</em> tiny language, less than 6000 lines of code, which compiles to &lt;100 kilobytes of binary code. It can be found at <a href="http://www.lua.org">http://www.lua.org</a>
</p>
<p>
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: <a href="http://www.eluaproject.net">http://www.eluaproject.net</a>

View file

@ -89,3 +89,9 @@ linkchecker2:
cp *.png linkchecker-tmp
(cd linkchecker-tmp && linkchecker --config=../linkchecker.config -F text --no-warnings SWIGDocumentation.html)
# Simple check for relative links (there shouldn't be any), they don't translate properly creating the .pdf doc
# with wkhtmltopdf. For example, href="SWIG.html" needs to be href="SWIG.html#SWIG"
linkchecker3:
@echo "The following list should just contain SWIGDocumentation.html and SWIGDocumentation.pdf,"
@echo "as all links should have an anchor (with a #) or be a full url beginning http."
grep 'href="' *.html | sed -e 's/.*href="\(.*\)">.*$$/\1/' | grep -v "#" | grep -v "^http" | grep -v "^style.css"

View file

@ -170,7 +170,7 @@ Some points of interest:
<p>
See the <a href="http://docs.racket-lang.org/inside/index.html">C API</a> for more description of using the mechanism for adding extensions. The main documentation is <a href="http://docs.racket-lang.org/">here</a>.
See the <a href="https://docs.racket-lang.org/inside/index.html">C API</a> for more description of using the mechanism for adding extensions. The main documentation is <a href="https://docs.racket-lang.org/">here</a>.
</p>
<p>

View file

@ -3070,7 +3070,7 @@ globally, to specific classes, and to specific methods, like this:
// generate directors for all classes that have virtual methods
%feature("director");
// generate directors for all virtual methods in class Foo
// generate directors for the virtual methods in class Foo
%feature("director") Foo;
</pre>
</div>
@ -3088,7 +3088,7 @@ directors for specific classes or methods. So for example,
</div>
<p>
will generate directors for all virtual methods of class Foo except
will generate directors for the virtual methods of class Foo except
bar().
</p>
@ -3153,7 +3153,8 @@ For simplicity let's ignore the <tt>Swig::Director</tt> class and refer to the
original C++ class as the director's base class. By default, a director
class extends all virtual methods in the inheritance chain of its base
class (see the preceding section for how to modify this behavior).
Thus all virtual method calls, whether they originate in C++ or in
Virtual methods that have a final specifier are unsurprisingly excluded.
Thus the virtual method calls, whether they originate in C++ or in
Perl via proxy classes, eventually end up in at the implementation in
the director class. The job of the director methods is to route these
method calls to the appropriate place in the inheritance chain. By

View file

@ -153,7 +153,7 @@ If the module is in PHP's default extension directory, you can omit the path.
<p>
For some SAPIs (for example, the CLI SAPI) you can instead use the
<a href="http://php.net/manual/en/function.dl.php">dl() function</a> to load
<a href="https://www.php.net/manual/en/function.dl.php">dl() function</a> to load
an extension at run time, by adding a line like this to the start of each
PHP script which uses your extension:
</p>
@ -937,7 +937,7 @@ globally, to specific classes, and to specific methods, like this:
// generate directors for all classes that have virtual methods
%feature("director");
// generate directors for all virtual methods in class Foo
// generate directors for the virtual methods in class Foo
%feature("director") Foo;
</pre>
</div>
@ -955,7 +955,7 @@ directors for specific classes or methods. So for example,
</div>
<p>
will generate directors for all virtual methods of class Foo except
will generate directors for the virtual methods of class Foo except
bar().
</p>
@ -1020,7 +1020,8 @@ For simplicity let's ignore the <tt>Swig::Director</tt> class and refer to the
original C++ class as the director's base class. By default, a director
class extends all virtual methods in the inheritance chain of its base
class (see the preceding section for how to modify this behavior).
Thus all virtual method calls, whether they originate in C++ or in
Virtual methods that have a final specifier are unsurprisingly excluded.
Thus the virtual method calls, whether they originate in C++ or in
PHP via proxy classes, eventually end up in at the implementation in the
director class. The job of the director methods is to route these method
calls to the appropriate place in the inheritance chain. By "appropriate

View file

@ -138,7 +138,7 @@ In addition, SWIG defines the following set of standard C/C++ macros:
<pre>
__LINE__ Current line number
__FILE__ Current file name
__STDC__ Defined to indicate ANSI C
__STDC__ Defined to indicate ISO C
__cplusplus Defined when -c++ option used
</pre>
</div>
@ -180,9 +180,9 @@ More complex macros can be defined in the standard way. For example:
<pre>
#define EXTERN extern
#ifdef __STDC__
#define _ANSI(args) (args)
#define ISOC_(args) (args)
#else
#define _ANSI(args) ()
#define ISOC_(args) ()
#endif
</pre>
</div>
@ -458,7 +458,7 @@ would generate
<p>
Like many compilers, SWIG supports a <tt>-E</tt> command line option to display the output from the preprocessor.
When the <tt>-E</tt> switch is used, SWIG will not generate any wrappers.
When the <tt>-E</tt> option is used, SWIG will not generate any wrappers.
Instead the results after the preprocessor has run are displayed.
This might be useful as an aid to debugging and viewing the results of macro expansions.
</p>

View file

@ -301,7 +301,7 @@ how you might go about compiling and using the generated files.
<p>
The preferred approach to building an extension module for Python is to compile it with
distutils, which comes with all recent versions of Python
(<a href="https://docs.python.org/library/distutils.html">Distutils Docs</a>).
(<a href="https://docs.python.org/3/library/distutils.html">Distutils Docs</a>).
</p>
<p>
@ -2355,7 +2355,7 @@ wrapped class is turned into a new Python built-in type which inherits from
from the wrapped methods. For more information about Python built-in extensions,
please refer to the Python documentation:</p>
<p><a href="http://docs.python.org/extending/newtypes.html">http://docs.python.org/extending/newtypes.html</a></p>
<p><a href="https://docs.python.org/3/extending/newtypes.html">https://docs.python.org/3/extending/newtypes.html</a></p>
<H4><a name="Python_builtin_limitations">32.4.2.1 Limitations</a></H4>
@ -2574,7 +2574,7 @@ automatically converted to Python slot operators, refer to the file
<p>
Read about all of the available Python slots here:
<a href="http://docs.python.org/c-api/typeobj.html">http://docs.python.org/c-api/typeobj.html</a></p>
<a href="https://docs.python.org/3/c-api/typeobj.html">https://docs.python.org/3/c-api/typeobj.html</a></p>
<p>
There are two ways to define a Python slot function: dispatch to a
@ -2934,7 +2934,7 @@ globally, to specific classes, and to specific methods, like this:
// generate directors for all classes that have virtual methods
%feature("director");
// generate directors for all virtual methods in class Foo
// generate directors for the virtual methods in class Foo
%feature("director") Foo;
</pre>
</div>
@ -2952,7 +2952,7 @@ directors for specific classes or methods. So for example,
</div>
<p>
will generate directors for all virtual methods of class Foo except
will generate directors for the virtual methods of class Foo except
bar().
</p>
@ -3018,7 +3018,8 @@ For simplicity let's ignore the <tt>Swig::Director</tt> class and refer to the
original C++ class as the director's base class. By default, a director
class extends all virtual methods in the inheritance chain of its base
class (see the preceding section for how to modify this behavior).
Thus all virtual method calls, whether they originate in C++ or in
Virtual methods that have a final specifier are unsurprisingly excluded.
Thus the virtual method calls, whether they originate in C++ or in
Python via proxy classes, eventually end up in at the implementation in
the director class. The job of the director methods is to route these
method calls to the appropriate place in the inheritance chain. By

View file

@ -189,9 +189,49 @@ of the proxy class baggage you see in other languages.
<p>
enumerations are characters which are then converted back and forth to
ints before calling the C routines. All of the enumeration code is
done in R.
R doesn't have a native enumeration type. Enumerations are represented
as character strings in R, with calls to R functions that convert back
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
example, an enumeration colour:
<div class="code"><pre>
enum colour { red=-1, blue, green = 10 };
</pre></div>
will be initialized by the following call in R:
<div class="code"><pre>
defineEnumeration("_colour",
.values=c("red" = .Call('R_swig_colour_red_get',FALSE, PACKAGE='enum_thorough'),
"blue" = .Call('R_swig_colour_blue_get',FALSE, PACKAGE='enum_thorough'),
"green" = .Call('R_swig_colour_green_get',FALSE, PACKAGE='enum_thorough')))
</pre></div>
<p>
which will create an environment named <tt>.__E___colour</tt>. The enumeration
values are initialised via calls to C/C++ code, allowing complex
values for enumerations to be used. Calls to the C/C++ code require
the compiled library to be loaded, so a <tt>delayedAssign</tt> is employed
within <tt>defineEnumeration</tt> in order to allow the code to be easily used in R
packages.
The user typically does not need to access the enumeration lookup
functions or know the name of the enumeration type used by
R. Attributes containing the type information are attached by swig to
functions requiring enumeration arguments or returning enumeration
values, and those attributes are used to identify and access the
appropriate environments and thus translate between characters
and integers.
The relevant functions, for debugging purposes, are <tt>enumToInteger</tt> and
<tt>enumFromInteger</tt>.
Anonymous enumerations are ignored by the binding generation process,
leaving no way of accessing the value of anonymous enumerations from R
code.
</p>
</body>

View file

@ -88,7 +88,7 @@
<p>
This chapter describes the basic operation of SWIG, the structure of its
input files, and how it handles standard ANSI C declarations. C++ support is
input files, and how it handles standard ISO C declarations. C++ support is
described in the next chapter. However, C++ programmers should still read this
chapter to understand the basics.
Specific details about each target language are described in later
@ -252,7 +252,7 @@ recursively.
<p>
As input, SWIG expects a file containing ANSI C/C++ declarations and
As input, SWIG expects a file containing ISO C/C++ declarations and
special SWIG directives. More often than not, this is a special SWIG
interface file which is usually denoted with a special <tt>.i</tt> or
<tt>.swg</tt> suffix. In certain cases, SWIG can be used directly on
@ -270,7 +270,7 @@ The most common format of a SWIG interface is as follows:
%{
#include "myheader.h"
%}
// Now list ANSI C/C++ declarations
// Now list ISO C/C++ declarations
int foo;
int bar(int x);
...
@ -1826,7 +1826,7 @@ When wrapping C code, simple use of identifiers/symbols with <tt>%rename</tt> us
When wrapping C++ code, simple use of simple identifiers/symbols with <tt>%rename</tt> might be too
limiting when using C++ features such as function overloading, default arguments, namespaces, template specialization etc.
If you are using the <tt>%rename</tt> directive and C++, make sure you read the
<a href="SWIGPlus.html">SWIG and C++</a> chapter and in particular the section on
<a href="SWIGPlus.html#SWIGPlus">SWIG and C++</a> chapter and in particular the section on
<a href="SWIGPlus.html#SWIGPlus_ambiguity_resolution_renaming">Renaming and ambiguity resolution</a>
for method overloading and default arguments.
</p>
@ -2242,7 +2242,7 @@ used in Tcl as follows :</p>
</pre></div>
<p>
Although the ANSI C standard does not allow default arguments, default
Although the ISO C standard does not allow default arguments, default
arguments specified in a SWIG interface work with both C and C++.
</p>
@ -2415,7 +2415,7 @@ see <a href="SWIGPlus.html#SWIGPlus_target_language_callbacks">Callbacks to the
<p>
This section describes the behavior of SWIG when processing ANSI C structures and union declarations. Extensions to
This section describes the behavior of SWIG when processing ISO C structures and union declarations. Extensions to
handle C++ are described in the next section.
</p>
@ -3469,7 +3469,7 @@ interface to your program.
SWIG's <tt>%include</tt> directive to process an entire C
source/header file.
<li>Make sure everything in the interface file uses ANSI C/C++ syntax.
<li>Make sure everything in the interface file uses ISO C/C++ syntax.
<li>Make sure all necessary `<tt>typedef</tt>' declarations and
type-information is available in the interface file.

View file

@ -88,12 +88,12 @@
This chapter describes SWIG's support for wrapping C++.
It is mostly concerned about C++ as defined by the C++ 98 and 03 standards.
For additions to the original C++ standard, please read the
<a href="CPlusPlus11.html">SWIG and C++11</a>,
<a href="CPlusPlus14.html">SWIG and C++14</a> and
<a href="CPlusPlus17.html">SWIG and C++17</a> chapters.
<a href="CPlusPlus11.html#CPlusPlus11">SWIG and C++11</a>,
<a href="CPlusPlus14.html#CPlusPlus14">SWIG and C++14</a> and
<a href="CPlusPlus17.html#CPlusPlus17">SWIG and C++17</a> chapters.
As a prerequisite,
you should first read the chapter <a href="SWIG.html#SWIG">SWIG Basics</a> to see
how SWIG wraps ANSI C. Support for C++ builds upon ANSI C
how SWIG wraps ISO C. Support for C++ builds upon ISO C
wrapping and that material will be useful in understanding this chapter.
</p>
@ -144,7 +144,7 @@ yourself in the foot. You will just have to be careful.
<p>
To wrap C++, SWIG uses a layered approach to code generation.
At the lowest level, SWIG generates a collection of procedural ANSI-C style
At the lowest level, SWIG generates a collection of procedural ISO C style
wrappers. These wrappers take care of basic type conversion,
type checking, error handling, and other low-level details of the C++ binding.
These wrappers are also sufficient to bind C++ into any target language

View file

@ -973,7 +973,7 @@ ans =
</pre></div>
<p>
Note: the pointer to the struct works as described in <a href="Scilab_wrapping_pointers">Pointers</a>. For example, the type of the struct pointer can be get with <tt>typeof</tt>, as following:
Note: the pointer to the struct works as described in <a href="#Scilab_wrapping_pointers">Pointers</a>. For example, the type of the struct pointer can be get with <tt>typeof</tt>, as following:
</p>
<div class="targetlang"><pre>
@ -1037,7 +1037,7 @@ ans =
</pre></div>
<p>
Note: like structs, class pointers are mapped as described in <a href="Scilab_wrapping_pointers">Pointers</a>. Let's give an example which shows that each class pointer type is a new type in Scilab that can be used for example (through <a href="https://help.scilab.org/docs/5.5.2/en_US/overloading.html">overloading</a>) to implement a custom print for the <tt>Point</tt> class:
Note: like structs, class pointers are mapped as described in <a href="#Scilab_wrapping_pointers">Pointers</a>. Let's give an example which shows that each class pointer type is a new type in Scilab that can be used for example (through <a href="https://help.scilab.org/docs/5.5.2/en_US/overloading.html">overloading</a>) to implement a custom print for the <tt>Point</tt> class:
</p>
<div class="targetlang"><pre>

View file

@ -8,7 +8,7 @@
<H1><a name="Sections">SWIG-4.0 Documentation</a></H1>
<p>
Last update : SWIG-4.0.0 (in progress)
Last update : SWIG-4.0.1 (in progress)
</p>
<H2><a name="Sections_Sections">Sections</a></H2>

View file

@ -672,8 +672,8 @@ void wrap_foo(char *s, int x) {
<p>
SWIG has parallels to <a href="http://en.wikipedia.org/wiki/Aspect-oriented_programming">Aspect Oriented Software Development (AOP)</a>.
The <a href="http://en.wikipedia.org/wiki/Aspect-oriented_programming#Terminology">AOP terminology</a> with respect to SWIG typemaps can be viewed as follows:
SWIG has parallels to <a href="https://en.wikipedia.org/wiki/Aspect-oriented_programming">Aspect Oriented Software Development (AOP)</a>.
The <a href="https://en.wikipedia.org/wiki/Aspect-oriented_programming#Terminology">AOP terminology</a> with respect to SWIG typemaps can be viewed as follows:
</p>
<ul>
<li> <b>Cross-cutting concerns</b>: The cross-cutting concerns are the modularization of the functionality that the typemaps implement, which is primarily marshalling of types from/to the target language and C/C++.

View file

@ -535,6 +535,7 @@ example.i(4) : Syntax error in input(1).
<li>522. Use of an illegal constructor name '<em>name</em>' in %extend is deprecated, the constructor name should be '<em>name</em>'.
<li>523. Use of an illegal destructor name '<em>name</em>' in %extend is deprecated, the destructor name should be '<em>name</em>'.
<li>524. Experimental target language. Target language <em>language</em> specified by <em>lang</em> is an experimental language. Please read about SWIG experimental languages, <em>htmllink</em>.
<li>525. Destructor <em>declaration</em> is final, <em>name</em> cannot be a director class.
</ul>
<H3><a name="Warnings_doxygen">18.9.6 Doxygen comments (560-599)</a></H3>

View file

@ -68,7 +68,7 @@ SWIG does not come with the usual Windows type installation program, however it
<p>
The swigwin distribution contains the SWIG Windows executable, swig.exe, which will run on 32 bit versions of Windows, ie Windows 95 and later.
The swigwin distribution contains the SWIG Windows 32-bit executable, swig.exe, which will run on both 32-bit and 64-bit versions of Windows.
If you want to build your own swig.exe have a look at <a href="#Windows_swig_exe">Building swig.exe on Windows</a>.
</p>
@ -211,7 +211,7 @@ If you do not have access to Visual C++ you will have to set up project files /
<p>
SWIG can also be compiled and run using <a href="http://www.cygwin.com">Cygwin</a> or <a href="http://www.mingw.org">MinGW</a> which provides a Unix like front end to Windows and comes free with gcc, an ANSI C/C++ compiler. However, this is not a recommended approach as the prebuilt executable is supplied.
SWIG can also be compiled and run using <a href="http://www.cygwin.com">Cygwin</a> or <a href="http://www.mingw.org">MinGW</a> which provides a Unix like front end to Windows and comes free with gcc, an ISO C/C++ compiler. However, this is not a recommended approach as the prebuilt executable is supplied.
</p>
<H3><a name="Windows_swig_exe">3.3.1 Building swig.exe on Windows</a></H3>
@ -249,7 +249,7 @@ Execute the steps in the order shown and don't use spaces in path names. In fact
<ol>
<li>
Download the following packages from the <a href="http://www.mingw.org/download.shtml">MinGW download page</a>
or <a href="http://sourceforge.net/projects/mingw/files/">MinGW SourceForge download page</a>.
or <a href="https://sourceforge.net/projects/mingw/files/">MinGW SourceForge download page</a>.
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.
<ul>

View file

@ -858,31 +858,33 @@ mzscheme_clean:
##################################################################
OCC=$(COMPILETOOL) @OCAMLC@
OCC_WITH_PP=env TMPDIR=./localtmp $(OCC)
# TMPDIR above is a workaround for some ocamlc versions, such as 4.05.0, which always create a temp file of the same name breaking parallel make (seemingly only when -pp is used)
OCAMLDLGEN=$(COMPILETOOL) @OCAMLDLGEN@
OCAMLFIND=$(COMPILETOOL) @OCAMLFIND@
OCAMLMKTOP=$(COMPILETOOL) @OCAMLMKTOP@
NOLINK ?= false
OCAMLPP= -pp "camlp4o ./swigp4.cmo"
OCAMLP4WHERE=`$(COMPILETOOL) @CAMLP4@ -where`
OCAMLCORE=\
(test -f swig.mli || $(SWIG) -ocaml -co swig.mli 2>/dev/null) && \
(test -f swig.ml || $(SWIG) -ocaml -co swig.ml 2>/dev/null) && \
(test -f swigp4.ml || $(SWIG) -ocaml -co swigp4.ml 2>/dev/null) && \
(test -f swig.cmi || $(OCC) -c swig.mli) && \
(test -f swig.cmo || $(OCC) -c swig.ml) && \
(test -f swigp4.cmi || $(OCC) -I $(OCAMLP4WHERE) -pp "camlp4o pa_extend.cmo q_MLast.cmo" -c swigp4.ml)
ocaml_core:
mkdir -p ./localtmp
$(SWIG) -ocaml -co swig.mli 2>/dev/null
$(SWIG) -ocaml -co swig.ml 2>/dev/null
$(SWIG) -ocaml -co swigp4.ml 2>/dev/null
$(OCC) -c swig.mli
$(OCC) -c swig.ml
$(OCC_WITH_PP) -I $(OCAMLP4WHERE) -pp "camlp4o pa_extend.cmo q_MLast.cmo" -c swigp4.ml
ocaml_static: $(SRCDIR_SRCS)
$(OCAMLCORE)
$(SWIG) -ocaml $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
$(OCC) -g -c -ccopt -g -ccopt "$(INCLUDES)" $(ISRCS) $(SRCDIR_SRCS)
$(OCC) -g -c $(INTERFACE:%.i=%.mli)
$(OCC) -w -U -g -c $(INTERFACE:%.i=%.ml)
test -z "$(PROGFILE)" || $(OCC) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE)
test -z "$(PROGFILE)" || $(OCC_WITH_PP) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE)
$(NOLINK) || $(OCC) -g -ccopt -g -cclib -g -custom -o $(RUNME) swig.cmo $(INTERFACE:%.i=%.cmo) $(PROGFILE:%.ml=%.cmo) $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) -cclib "$(LIBS)"
ocaml_dynamic: $(SRCDIR_SRCS)
$(OCAMLCORE)
$(SWIG) -ocaml $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
$(OCC) -g -c -ccopt -g -ccopt "$(INCLUDES)" $(ISRCS) $(SRCDIR_SRCS)
$(CXXSHARED) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(CCSHARED) -o $(INTERFACE:%.i=%@SO@) $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) $(LIBS)
@ -890,40 +892,36 @@ ocaml_dynamic: $(SRCDIR_SRCS)
mv $(INTERFACE:%.i=%_dynamic.ml) $(INTERFACE:%.i=%.ml)
rm $(INTERFACE:%.i=%.mli)
$(OCAMLFIND) $(OCC) -g -c -package dl $(INTERFACE:%.i=%.ml)
test -z "$(PROGFILE)" || $(OCC) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE)
test -z "$(PROGFILE)" || $(OCC_WITH_PP) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE)
$(NOLINK) || $(OCAMLFIND) $(OCC) -g -ccopt -g -cclib -g -custom -o $(RUNME) swig.cmo -package dl -linkpkg $(INTERFACE:%.i=%.cmo) $(PROGFILE:%.ml=%.cmo)
ocaml_static_toplevel: $(SRCDIR_SRCS)
$(OCAMLCORE)
$(SWIG) -ocaml $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
$(OCC) -g -c -ccopt -g -ccopt "$(INCLUDES)" $(ISRCS) $(SRCDIR_SRCS)
$(OCC) -g -c $(INTERFACE:%.i=%.mli)
$(OCC) -w -U -g -c $(INTERFACE:%.i=%.ml)
test -z "$(PROGFILE)" || $(OCC) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE)
test -z "$(PROGFILE)" || $(OCC_WITH_PP) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE)
$(NOLINK) || $(OCAMLMKTOP) swig.cmo -I $(OCAMLP4WHERE) dynlink.cma camlp4o.cma swigp4.cmo -cclib "$(LIBS)" -g -ccopt -g -cclib -g -custom -o $(RUNME)_top $(INTERFACE:%.i=%.cmo) $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS)
ocaml_static_cpp: $(SRCDIR_SRCS)
$(OCAMLCORE)
$(SWIG) -ocaml -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
cp $(ICXXSRCS) $(ICXXSRCS:%.cxx=%.c)
$(OCC) -cc '$(CXX) $(CPPFLAGS)' -g -c -ccopt -g -ccopt "-xc++ $(INCLUDES)" $(ICXXSRCS:%.cxx=%.c) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS)
$(OCC) -g -c $(INTERFACE:%.i=%.mli)
$(OCC) -w -U -g -c $(INTERFACE:%.i=%.ml)
test -z "$(PROGFILE)" || $(OCC) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE)
test -z "$(PROGFILE)" || $(OCC_WITH_PP) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE)
$(NOLINK) || $(OCC) -g -ccopt -g -cclib -g -custom -o $(RUNME) swig.cmo $(INTERFACE:%.i=%.cmo) $(PROGFILE:%.ml=%.cmo) $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) -cclib "$(LIBS)" -cc '$(CXX)'
ocaml_static_cpp_toplevel: $(SRCDIR_SRCS)
$(OCAMLCORE)
$(SWIG) -ocaml -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
cp $(ICXXSRCS) $(ICXXSRCS:%.cxx=%.c)
$(OCC) -cc '$(CXX) $(CPPFLAGS)' -g -c -ccopt -g -ccopt "-xc++ $(INCLUDES)" $(ICXXSRCS:%.cxx=%.c) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS)
$(OCC) -g -c $(INTERFACE:%.i=%.mli)
$(OCC) -w -U -g -c $(INTERFACE:%.i=%.ml)
test -z "$(PROGFILE)" || $(OCC) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE)
test -z "$(PROGFILE)" || $(OCC_WITH_PP) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE)
$(NOLINK) || $(OCAMLMKTOP) -cc '$(CXX) $(CPPFLAGS)' swig.cmo -I $(OCAMLP4WHERE) dynlink.cma camlp4o.cma swigp4.cmo -cclib "$(LIBS)" -g -ccopt -g -cclib -g -custom -o $(RUNME)_top $(INTERFACE:%.i=%.cmo) $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS)
ocaml_dynamic_cpp: $(SRCDIR_SRCS)
$(OCAMLCORE)
$(SWIG) -ocaml -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
cp $(ICXXSRCS) $(ICXXSRCS:%.cxx=%.c)
$(OCC) -cc '$(CXX) $(CPPFLAGS)' -g -c -ccopt -g -ccopt "-xc++ $(INCLUDES)" $(ICXXSRCS:%.cxx=%.c) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) -ccopt -fPIC
@ -932,7 +930,7 @@ ocaml_dynamic_cpp: $(SRCDIR_SRCS)
mv $(INTERFACE:%.i=%_dynamic.ml) $(INTERFACE:%.i=%.ml)
rm $(INTERFACE:%.i=%.mli)
$(OCAMLFIND) $(OCC) -g -c -package dl $(INTERFACE:%.i=%.ml)
test -z "$(PROGFILE)" || $(OCC) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE)
test -z "$(PROGFILE)" || $(OCC_WITH_PP) -o $(PROGFILE:%.ml=%) $(OCAMLPP) -c $(SRCDIR)$(PROGFILE)
$(NOLINK) || $(OCAMLFIND) swig.cmo $(OCC) -cclib -export-dynamic -g -ccopt -g -cclib -g -custom -o $(RUNME) -package dl -linkpkg $(INTERFACE:%.i=%.cmo) $(PROGFILE:%.ml=%.cmo) -cc '$(CXX)'
# -----------------------------------------------------------------
@ -957,6 +955,7 @@ ocaml_clean:
rm -f *_wrap* *~ .~* *.cmo *.cmi *.mli $(TARGET).ml $(RUNME) $(RUNME)_top swig.ml swigp4.ml
rm -f core @EXTRA_CLEAN@
rm -f *.@OBJEXT@ *@SO@
rm -rf ./localtmp
##################################################################
##### RUBY ######
@ -1095,7 +1094,7 @@ CSHARPCFLAGS = @CSHARPCFLAGS@
CSHARPFLAGS =
CSHARPOPTIONS =
CSHARPSO = @CSHARPSO@
CSHARP_RUNME = $(CSHARPCILINTERPRETER) $(CSHARPCILINTERPRETER_FLAGS) ./$(RUNME).exe
CSHARP_RUNME = ./$(RUNME).exe
# ----------------------------------------------------------------
# Build a CSharp dynamically loadable module (C)
@ -1133,7 +1132,7 @@ csharp_compile: $(SRCDIR_SRCS)
# -----------------------------------------------------------------
csharp_run:
env LD_LIBRARY_PATH=$$PWD $(RUNTOOL) $(CSHARP_RUNME) $(RUNPIPE)
env LD_LIBRARY_PATH=$$PWD $(RUNTOOL) $(CSHARPCILINTERPRETER) $(CSHARPCILINTERPRETER_FLAGS) $(CSHARP_RUNME) $(RUNPIPE)
# -----------------------------------------------------------------
# Version display
@ -1458,7 +1457,8 @@ GOPACK = `if $(GO1) ; then echo go tool pack; else echo gopack; fi`
GOPACKAGE = $(notdir $(INTERFACE:.i=.a))
GOPATHDIR = gopath/src/$(INTERFACE:.i=)
GOPATHPARENTDIR = gopath/$(GOMOD)/src
GOPATHDIR = $(GOPATHPARENTDIR)/$(INTERFACE:.i=)
GOOBJEXT = `if $(GO15); then echo o; else echo $(GOC:c=); fi`
GOGCOBJS = $(GOSRCS:.go=.$(GOOBJEXT))
@ -1468,8 +1468,18 @@ GOGCCOBJS = $(GOSRCS:.go=.@OBJEXT@)
# Build a Go module (C)
# ----------------------------------------------------------------
$(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
go_nocgo: $(SRCDIR_SRCS)
$(SWIG) -go $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
$(SWIG) -go -no-cgo $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
if $(GO12) || $(GO13) || $(GO15) || $(GOGCC); then \
$(CC) -g -c $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES); \
else \
@ -1504,11 +1514,12 @@ go_nocgo: $(SRCDIR_SRCS)
fi; \
fi
go: $(SRCDIR_SRCS)
$(SWIG) -go -cgo $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
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/src 2>/dev/null || true
@mkdir gopath/src/$(INTERFACE:.i=) 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 -f $(GOPATHDIR)/*
cp $(ISRCS) $(GOPATHDIR)/
if test -f $(IWRAP:.i=.h); then \
@ -1518,7 +1529,7 @@ go: $(SRCDIR_SRCS)
cp $(SRCDIR_SRCS) $(GOPATHDIR)/; \
fi
cp $(GOSRCS) $(GOPATHDIR)/
GOPATH=`pwd`/gopath; \
GOPATH=`pwd`/gopath/$(GOMOD); \
export GOPATH; \
CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) -I `cd $(SRCDIR) && pwd` -I `pwd`"; \
export CGO_CPPFLAGS; \
@ -1527,17 +1538,16 @@ go: $(SRCDIR_SRCS)
CGO_LDFLAGS="$(LDFLAGS) -lm"; \
export CGO_LDFLAGS; \
(cd $(GOPATHDIR)/ && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o $(GOPACKAGE))
cp $(GOPATHDIR)/$(GOPACKAGE) $(dir $(INTERFACE))/$(GOPACKAGE)
if $(GOGCC); then \
cp $(dir $(INTERFACE))/$(GOPACKAGE) $(dir $(INTERFACE))/$(GOPACKAGE:.a=.gox); \
cp $(GOPATHDIR)/$(GOPACKAGE) $(GOPATHDIR)/$(GOPACKAGE:.a=.gox); \
fi
if test -f $(SRCDIR)$(RUNME).go; then \
if $(GOGCC) ; then \
$(COMPILETOOL) $(GCCGO) -c -g $(SRCDIR)$(RUNME).go; \
$(COMPILETOOL) $(GCCGO) -o $(RUNME) $(RUNME).@OBJEXT@ $(dir $(INTERFACE))/$(GOPACKAGE); \
$(COMPILETOOL) $(GCCGO) -c -g -I $(GOPATHDIR) $(SRCDIR)$(RUNME).go; \
$(COMPILETOOL) $(GCCGO) -o $(RUNME) $(RUNME).@OBJEXT@ $(GOPATHDIR)/$(GOPACKAGE); \
elif $(GO12) || $(GO13) || $(GO15); then \
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) -o $(RUNME).$(GOOBJEXT) $(SRCDIR)$(RUNME).go; \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld "$(CC)" -extldflags "$(CFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I $(GOPATHDIR) -o $(RUNME).$(GOOBJEXT) $(SRCDIR)$(RUNME).go; \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -L $(GOPATHDIR) -linkmode external -extld "$(CC)" -extldflags "$(CFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \
else \
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $(RUNME) $(RUNME).$(GOOBJEXT); \
@ -1549,7 +1559,7 @@ go: $(SRCDIR_SRCS)
# ----------------------------------------------------------------
go_cpp_nocgo: $(SRCDIR_SRCS)
$(SWIG) -go -c++ $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
$(SWIG) -go -c++ -no-cgo $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
if $(GO12) || $(GO13) || $(GO15) || $(GOGCC); then \
if test -n "$(SRCDIR_CXXSRCS)$(SRCDIR_SRCS)"; then \
$(CXX) -g -c $(CPPFLAGS) $(CXXFLAGS) $(SRCDIR_CXXSRCS) $(SRCDIR_SRCS) $(INCLUDES); \
@ -1596,11 +1606,12 @@ go_cpp_nocgo: $(SRCDIR_SRCS)
fi; \
fi
go_cpp: $(SRCDIR_SRCS)
$(SWIG) -go -c++ -cgo $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
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/src 2>/dev/null || true
@mkdir gopath/src/$(INTERFACE:.i=) 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 -f $(GOPATHDIR)/*
cp $(ICXXSRCS) $(GOPATHDIR)/
if test -f $(IWRAP:.i=.h); then \
@ -1613,7 +1624,7 @@ go_cpp: $(SRCDIR_SRCS)
cp $(SRCDIR_SRCS) $(GOPATHDIR)/; \
fi
cp $(GOSRCS) $(GOPATHDIR)/
GOPATH=`pwd`/gopath; \
GOPATH=`pwd`/gopath/$(GOMOD); \
export GOPATH; \
CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) -I `cd $(SRCDIR) && pwd` -I `pwd`"; \
export CGO_CPPFLAGS; \
@ -1624,17 +1635,16 @@ go_cpp: $(SRCDIR_SRCS)
CGO_LDFLAGS="$(LDFLAGS) -lm"; \
export CGO_LDFLAGS; \
(cd $(GOPATHDIR) && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o $(GOPACKAGE))
cp $(GOPATHDIR)/$(GOPACKAGE) $(dir $(INTERFACE))/$(GOPACKAGE)
if $(GOGCC); then \
cp $(dir $(INTERFACE))/$(GOPACKAGE) $(dir $(INTERFACE))/$(GOPACKAGE:.a=.gox); \
cp $(GOPATHDIR)/$(GOPACKAGE) $(GOPATHDIR)/$(GOPACKAGE:.a=.gox); \
fi
if test -f $(SRCDIR)$(RUNME).go; then \
if $(GOGCC) ; then \
$(COMPILETOOL) $(GCCGO) -g -c $(SRCDIR)$(RUNME).go; \
$(COMPILETOOL) $(GCCGO) -o $(RUNME) $(RUNME).@OBJEXT@ $(dir $(INTERFACE))/$(GOPACKAGE) -lstdc++; \
$(COMPILETOOL) $(GCCGO) -g -c -I $(GOPATHDIR) $(SRCDIR)$(RUNME).go; \
$(COMPILETOOL) $(GCCGO) -o $(RUNME) $(RUNME).@OBJEXT@ $(GOPATHDIR)/$(GOPACKAGE) -lstdc++; \
elif $(GO12) || $(GO13) || $(GO15); then \
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) -o $(RUNME).$(GOOBJEXT) $(SRCDIR)$(RUNME).go; \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld "$(CXX)" -extldflags "$(CXXFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I $(GOPATHDIR) -o $(RUNME).$(GOOBJEXT) $(SRCDIR)$(RUNME).go; \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -L $(GOPATHDIR) -linkmode external -extld "$(CXX)" -extldflags "$(CXXFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \
else \
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $(RUNME) $(RUNME).$(GOOBJEXT); \

View file

@ -1,8 +1,9 @@
package main
import (
. "./example"
"fmt"
. "example"
)
func main() {

View file

@ -3,8 +3,9 @@
package main
import (
. "./example"
"fmt"
. "example"
)
func main() {

View file

@ -1,8 +1,9 @@
package main
import (
"./example"
"fmt"
"example"
)
func main() {

View file

@ -1,9 +1,10 @@
package main
import (
"./example"
"fmt"
"os"
"example"
)
func Compare(name string, got string, exp string) error {

View file

@ -1,8 +1,9 @@
package main
import (
. "./example"
"fmt"
. "example"
)
func main() {

View file

@ -3,8 +3,9 @@
package main
import (
. "./example"
"fmt"
. "example"
)
func main() {

View file

@ -1,8 +1,9 @@
package main
import (
. "./example"
"fmt"
. "example"
)
func main() {

View file

@ -1,8 +1,9 @@
package main
import (
. "./example"
"fmt"
. "example"
)
func main() {

View file

@ -1,8 +1,9 @@
package main
import (
. "./example"
"fmt"
. "example"
)
func main() {

View file

@ -3,8 +3,9 @@
package main
import (
. "./example"
"fmt"
. "example"
)
func main() {

View file

@ -1,8 +1,9 @@
package main
import (
"./example"
"fmt"
"example"
)
func main() {

View file

@ -3,8 +3,9 @@
package main
import (
. "./example"
"fmt"
. "example"
)
func main() {

View file

@ -3,8 +3,9 @@
package main
import (
"./example"
"fmt"
"example"
)
func main() {

View file

@ -76,7 +76,7 @@ public class runme {
System.out.println( " Trying to set 'status'" );
try {
Method m = example.class.getDeclaredMethod("setStatus", new Class[] {Integer.class});
m.invoke(example.class, new Object[] {new Integer(0)} );
m.invoke(example.class, new Object[] {Integer.valueOf(0)} );
System.out.println( "Hey, what's going on?!?! This shouldn't work" );
}
catch (NoSuchMethodException e) {

View file

@ -13,6 +13,10 @@ check: build
build: static
static:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_core
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \

View file

@ -14,6 +14,10 @@ check: build
build: static
static:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_core
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \

View file

@ -14,6 +14,10 @@ check: build
build: static
static:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_core
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \

View file

@ -20,6 +20,10 @@ dynamic:
ocaml_dynamic
static:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_core
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \

View file

@ -20,6 +20,10 @@ dynamic:
ocaml_dynamic_cpp
static:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_core
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \

View file

@ -14,13 +14,17 @@ check: build
build: static toplevel
static:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_core
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_static_cpp
toplevel:
toplevel: static
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \

View file

@ -20,6 +20,10 @@ dynamic:
ocaml_dynamic
static:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_core
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \

View file

@ -12,6 +12,10 @@ check: build
build: static
static:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_core
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \

View file

@ -12,6 +12,10 @@ check: build
build: static
static:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_core
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \

View file

@ -12,6 +12,10 @@ check: build
build: static
static:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_core
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
@ -21,7 +25,7 @@ dynamic:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_static_cpp
ocaml_dynamic_cpp
toplevel:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \

View file

@ -13,13 +13,17 @@ check: build
build: static toplevel
static:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_core
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_static
toplevel:
toplevel: static
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \

View file

@ -12,6 +12,10 @@ check: build
build: static toplevel
static:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_core
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
@ -21,9 +25,9 @@ dynamic:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_static_cpp
ocaml_dynamic_cpp
toplevel:
toplevel: static
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \

View file

@ -21,7 +21,7 @@
zend_printf("This was %%rshutdown\n");
}
%pragma(php) include="include.php";
%pragma(php) include="./include.php";
%pragma(php) code="
# This code is inserted into example.php

View file

@ -79,5 +79,9 @@ protected:
};
int ProtectedBase::staticMemberVariable = 10;
class ProtectedDerived : public ProtectedBase {
public:
ProtectedDerived(const char *s) : ProtectedBase(s) {}
};
%}

View file

@ -407,6 +407,7 @@ CPP_TEST_CASES += \
static_array_member \
static_const_member \
static_const_member_2 \
stl_no_default_constructor \
string_constants \
struct_initialization_cpp \
struct_value \
@ -571,6 +572,7 @@ CPP11_TEST_CASES += \
cpp11_director_enums \
cpp11_directors \
cpp11_explicit_conversion_operators \
cpp11_final_directors \
cpp11_final_override \
cpp11_function_objects \
cpp11_inheriting_constructors \
@ -707,6 +709,7 @@ C_TEST_CASES += \
preproc \
preproc_constants_c \
preproc_defined \
preproc_gcc_output \
preproc_include \
preproc_line_file \
register_par \

View file

@ -19,17 +19,17 @@ template<typename T> struct Y {
typedef T2 another_type;
};
value_type create1() const { return T(); }
Y::value_type create2() const { return T(); }
Y<T>::value_type create3() const { return T(); }
YY::value_type create4() const { return T(); }
Y<T>::YY::value_type create5() const { return T(); }
typename Y::value_type create2() const { return T(); }
typename Y<T>::value_type create3() const { return T(); }
typename YY::value_type create4() const { return T(); }
typename Y<T>::YY::value_type create5() const { return T(); }
Y<T>::YYY<T>::value_type create6() const { return T(); }
typename Y<T>::template ZZZ<T>::another_type create7() const { return T(); }
// With global scope prefix
::Y<T>::value_type create13() const { return T(); }
typename ::Y<T>::value_type create13() const { return T(); }
::Y<T>::YY::value_type create15() const { return T(); }
typename ::Y<T>::YY::value_type create15() const { return T(); }
::Y<T>::YYY<T>::value_type create16() const { return T(); }
typename ::Y<T>::template ZZZ<T>::another_type create17() const { return T(); }
};

View file

@ -4,7 +4,8 @@
struct A {
int member;
};
const int align1 = alignof(A::member);
const int align1 = alignof(int);
const int align2 = alignof(int *);
%}
%{

View file

@ -0,0 +1,33 @@
%module(directors="1") cpp11_final_directors
%director Derived;
// Check SWIG will not wrap these classes as directors where the destructors are final
%director BaseFinalDestructor;
%director BaseFinalDestructor2;
%warnfilter(SWIGWARN_LANG_DIRECTOR_FINAL) BaseFinalDestructor::~BaseFinalDestructor;
%warnfilter(SWIGWARN_LANG_DIRECTOR_FINAL) BaseFinalDestructor2::~BaseFinalDestructor2;
%inline %{
struct Base {
virtual void basemeth() final {}
virtual ~Base() {}
};
struct Derived : Base {
virtual int derivedmeth() final { return 1; }
virtual int meth() { return 2; }
virtual ~Derived() {}
};
struct BaseFinalDestructor {
virtual void basefinalmeth() final {}
virtual ~BaseFinalDestructor() final {}
};
struct BaseFinalDestructor2 {
virtual void basefinalmeth() {}
virtual ~BaseFinalDestructor2() final {}
};
%}

View file

@ -43,14 +43,17 @@ auto lambda1 = [](int x, int y) -> int { return x+y; };
single statement "return expr;". */
auto lambda2 = [](int x, int y) { return x+y; };
auto lambda3 = [&](int x, int y) { return x+y; };
auto lambda4 = [=](int x, int y) { return x+y; };
int thing = 0;
#ifdef SWIG
// Not strictly correct as captured variables should have non-automatic storage duration, ie shouldn't capture globals. gcc-4.7 warns about this, but we check that SWIG can parse this anyway.
// This is not strictly legal: non-local lambda expression cannot have a capture-default
// gcc-4.7 warns about this and gcc-9 gives an error, but we check that SWIG can parse this anyway.
auto lambda3 = [&](int x, int y) { return x+y; };
auto lambda4 = [=](int x, int y) { return x+y; };
auto lambda5 = [=,&thing]() { return thing; };
#else
auto lambda5 = [=]() { return thing; };
auto lambda3 = [](int x, int y) { return x+y; };
auto lambda4 = [](int x, int y) { return x+y; };
auto lambda5 = []() { return thing; };
#endif
void fn() {
@ -115,6 +118,6 @@ int runLambdaInline() {
// TODO
int(*lambda101notauto)(int, int) = [] (int a, int b) { return a + b; };
int lambda102 = [] (int a, int b) mutable { return a + b; }(1, 2);
void lambda_init(int = ([=]{ return 0; })());
void lambda_init(int = ([]{ return 0; })());
%}

View file

@ -5,3 +5,7 @@
%template(UnorderedMapIntInt) std::unordered_map<int, int>;
%template(UnorderedMapStringInt) std::unordered_map<std::string, int>;
%inline %{
std::unordered_map<std::string, int, std::hash< std::string >,std::equal_to< std::string >,std::allocator< std::pair< std::string const,int > > > inout(std::unordered_map<std::string, int> m) { return m; }
%}

View file

@ -8,7 +8,8 @@
%inline %{
template<typename T> struct Temper {
template<typename T> class Temper {
public:
T val;
};
@ -18,14 +19,20 @@ public:
int memberFunction() { return 100; }
};
class B {
public:
short member;
short memberFunction() { return 100; }
};
template class Temper<A>;
extern template class Temper<A>;
extern template class Temper<B>;
template class Temper<A*>;
extern template class Temper<A*>;
extern template class Temper<B*>;
template class Temper<int>;
extern template class Temper<int>;
extern template class Temper<short>;
%}
%template(TemperInt) Temper<int>;

View file

@ -20,8 +20,10 @@ extern "C++" thread_local int ecpptval;
thread_local int ThreadLocals::stval = 11;
thread_local int ThreadLocals::tsval = 22;
#if !defined(_MSC_VER)
thread_local const int ThreadLocals::stcval88;
thread_local const int ThreadLocals::tscval99;
#endif
%}
%{

View file

@ -10,6 +10,7 @@ Tests Sourceforge bug #444748.
class StaticMemberTest {
public:
static int static_int;
static int grab_int() { return static_int; }
};
class StaticFunctionTest {
@ -28,10 +29,12 @@ int StaticMemberTest::static_int = 99;
%inline %{
struct StaticBase {
static int statty;
static int grab_statty_base() { return statty; }
virtual ~StaticBase() {}
};
struct StaticDerived : StaticBase {
static int statty;
static int grab_statty_derived() { return statty; }
};
%}

View file

@ -26,7 +26,8 @@ CPP_TEST_CASES = \
enum_thorough_typesafe \
exception_partial_info \
intermediary_classname \
li_boost_intrusive_ptr
li_boost_intrusive_ptr \
li_std_list \
CPP11_TEST_CASES = \
cpp11_shared_ptr_const \

View file

@ -13,6 +13,20 @@ public class runme
{
MyProtectedBase mpb = new MyProtectedBase("MyProtectedBase");
mpb.accessProtected();
try {
// C++ destructor is protected
mpb.Dispose();
throw new Exception("failed to catch MethodAccessException");
} catch (MethodAccessException) {
// Exception message: C++ destructor does not have public access
}
ProtectedDerived pd = new ProtectedDerived("ProtectedDerived");
// Destroying via the ProtectedDerived's destructor should work
pd.Dispose();
ProtectedBase pb = new ProtectedDerived("ProtectedDerived");
// ProtectedDerived's destructor should be called via the Dispose(disposing) virtual call
pb.Dispose();
}
}

View file

@ -19,6 +19,13 @@ public class li_std_auto_ptr_runme {
if (Klass.getTotal_count() != 2)
throw new Exception("number of objects should be 2");
using (Klass k3 = li_std_auto_ptr.makeKlassAutoPtr("second")) {
if (Klass.getTotal_count() != 3)
throw new Exception("number of objects should be 3");
}
if (Klass.getTotal_count() != 2)
throw new Exception("number of objects should be 2");
k1 = null;
{
int countdown = 500;

View file

@ -0,0 +1,402 @@
using System;
using li_std_listNamespace;
public class li_std_list_runme {
private static readonly int collectionSize = 20;
public static void Main() {
// Setup a list of int
IntList list = new IntList();
IntList.IntListNode node;
for (int i = 0; i < 20; i++) {
int nb = i * 10;
list.Add(nb);
}
// Count property test
if (list.Count != collectionSize)
throw new Exception("Count test failed");
// IsReadOnly property test
if (list.IsReadOnly)
throw new Exception("IsReadOnly test failed");
// Contains method test
if (!list.Contains(0))
throw new Exception("Contains method test 1 failed");
if (!list.Contains(2 * 10))
throw new Exception("Contains method test 2 failed");
if (!list.Contains(19 * 10))
throw new Exception("Contains method test 3 failed");
if (list.Contains(20 * 10))
throw new Exception("Contains method test 4 failed");
// Nodes comparison method overload
{
IntList.IntListNode temp = new IntList.IntListNode(3);
if (list.First == temp)
throw new Exception("== overload method test (1) failed");
temp = new IntList.IntListNode(0);
if (list.First == temp)
throw new Exception("== overload method test (2) failed");
IntList.IntListNode temp2 = new IntList.IntListNode(0);
if (temp == temp2)
throw new Exception("== overload method test (3) failed");
if (!(list.First == list.First))
throw new Exception("== overload method test (4) failed");
if (list.First != list.First)
throw new Exception("!= overload method test (1) failed");
if (!(temp != temp2))
throw new Exception("!= overload method test (2) failed");
if (list.First.Equals(temp))
throw new Exception("Equals method test failed");
if (list.First.GetHashCode() == temp.GetHashCode())
throw new Exception("GetHashCode method test (1) failed");
if (list.First.GetHashCode() == list.First.GetHashCode())
throw new Exception("GetHashCode method test (2) failed");
}
// Getter test
{
if (list.First == null)
throw new Exception("First getter test (1) failed");
if (list.Last == null)
throw new Exception("Last getter test (1) failed");
if (list.Last.Next != null)
throw new Exception("Next getter test (1) failed");
if (list.First.Next == null)
throw new Exception("Next getter test (2) failed");
if (list.First.Previous != null)
throw new Exception("Previous getter test (1) failed");
if (list.Last.Previous == null)
throw new Exception("Previous getter test (2) failed");
}
// AddFirst method test
node = list.AddFirst(34);
if (list.First.Value != 34 || node.Value != 34 || node != list.First)
throw new Exception("AddFirst method test failed");
try {
list.AddFirst(null);
} catch (ArgumentNullException) {
try {
list.AddFirst(list.First);
} catch (InvalidOperationException) {
}
}
// RemoveFirst method test
int tmp = list.First.Value;
list.RemoveFirst();
if (list.First.Value == tmp || list.First.Value != 0 * 10)
throw new Exception("RemoveFirst method test failed");
// AddLast method test
node = list.AddLast(8);
if (list.Last.Value != 8 || node.Value != 8 || node != list.Last)
throw new Exception("AddLast method test failed");
try {
list.AddLast(null);
} catch (ArgumentNullException) {
try {
list.AddLast(list.First);
} catch (InvalidOperationException) {
}
}
// RemoveLast method test
int tmp2 = list.Last.Value;
list.RemoveLast();
if (list.Last.Value == tmp2 || list.Last.Value != (list.Count - 1) * 10)
throw new Exception("RemoveLast method test failed");
// AddBefore method test
node = list.AddBefore(list.Last, 17);
if (list.Last.Previous.Value != 17 || node.Value != 17 || node != list.Last.Previous)
throw new Exception("AddBefore method test (1) failed");
try {
node = null;
list.AddBefore(list.Last, node);
throw new Exception("AddBefore method test (2) failed");
} catch (ArgumentNullException) {
try {
node = new IntList.IntListNode(1);
list.AddBefore(null, node);
throw new Exception("AddBefore method test (3) failed");
} catch (ArgumentNullException) {
try {
list.AddBefore(list.Last, list.First);
} catch (InvalidOperationException) {
}
}
}
// AddAfter method test
node = list.AddAfter(list.First, 47);
if (list.First.Next.Value != 47 || node.Value != 47 || node != list.First.Next)
throw new Exception("AddAfter method test (1) failed");
try {
node = null;
list.AddAfter(list.First.Next, node);
throw new Exception("AddAfter method test (2) failed");
} catch (ArgumentNullException) {
try {
list.AddAfter(list.First, list.Last);
} catch (InvalidOperationException) {
}
}
// Find method test
node = list.Find(0);
if (node == null || node.Value != 0)
throw new Exception("Find method test (1) failed");
node = list.Find(47);
if (node == null || node.Value != 47)
throw new Exception("Find method test (2) failed");
node = list.Find(190);
if (node == null || node.Value != 190)
throw new Exception("Find method test (3) failed");
node = list.Find(-3);
if (node != null)
throw new Exception("Find method test (4) failed");
// Remove method test
if (!list.Remove(17) || list.Contains(17) || list.Last.Previous.Value == 17)
throw new Exception("Remove method test (1) failed");
if (!list.Remove(47) || list.Contains(47) || list.First.Next.Value == 47)
throw new Exception("Remove method test (2) failed");
if (!list.Remove(0) || list.Contains(0) || list.First.Value == 0)
throw new Exception("Remove method test (3) failed");
if (!list.Remove(190) || list.Contains(190) || list.Last.Value == 190)
throw new Exception("Remove method test (4) failed");
try {
node = null;
list.Remove(node);
throw new Exception("Remove method test (5) failed");
} catch (ArgumentNullException) {
try {
node = new IntList.IntListNode(4);
list.Remove(node);
throw new Exception("Remove method test (5) failed");
} catch (InvalidOperationException) {
}
}
// ICollection constructor test
{
int[] intArray = new int[] { 0, 11, 22, 33, 44, 55, 33 };
IntList il = new IntList(intArray);
if (intArray.Length != il.Count)
throw new Exception("ICollection constructor length check failed: " + intArray.Length + "-" + il.Count);
node = il.First;
for (int i = 0; i < intArray.Length; i++) {
if (intArray[i] != node.Value)
throw new Exception("ICollection constructor failed, index:" + i);
node = node.Next;
}
try {
new IntList((System.Collections.ICollection)null);
throw new Exception("ICollection constructor null test failed");
} catch (ArgumentNullException) {
}
}
// Enumerator test
{
node = list.First;
System.Collections.IEnumerator myEnumerator = list.GetEnumerator();
while (myEnumerator.MoveNext()) {
if ((int)myEnumerator.Current != node.Value)
throw new Exception("Enumerator (1) test failed");
node = node.Next;
}
}
{
node = list.First;
System.Collections.Generic.IEnumerator<int> myEnumerator = list.GetEnumerator();
while (myEnumerator.MoveNext()) {
if (myEnumerator.Current != node.Value)
throw new Exception("Enumerator (2) test failed");
node = node.Next;
}
}
{
node = list.First;
IntList.IntListEnumerator myEnumerator = list.GetEnumerator();
while (myEnumerator.MoveNext()) {
if (myEnumerator.Current != node.Value)
throw new Exception("Enumerator (3) test failed");
node = node.Next;
}
}
{
node = list.First;
foreach (var elem in list) {
if (elem != node.Value)
throw new Exception("Enumerator (4) test failed");
node = node.Next;
}
}
// CopyTo method test
{
int[] outputarray = new int[collectionSize - 2];
list.CopyTo(outputarray, 0);
int index = 0;
IntList.IntListNode temp = list.First;
foreach (int val in outputarray) {
if (temp.Value != val) {
throw new Exception("CopyTo method test (1) failed, index:" + index);
}
index++;
temp = temp.Next;
}
}
{
DoubleList inputlist = new DoubleList();
int arrayLen = 10;
for (int i = 0; i < arrayLen; i++) {
double num = i * 10.1;
inputlist.Add(num);
}
double[] outputarray = new double[arrayLen];
inputlist.CopyTo(outputarray, 0);
DoubleList.DoubleListNode temp = inputlist.First;
for (int i = 0; i < arrayLen; i++) {
if (outputarray[i] != temp.Value)
throw new Exception("CopyTo method test (2) failed, index:" + i);
temp = temp.Next;
}
}
{
StructList inputlist = new StructList();
int arrayLen = 10;
for (int i = 0; i < arrayLen; i++)
inputlist.Add(new Struct(i / 10.0));
Struct[] outputarray = new Struct[arrayLen];
inputlist.CopyTo(outputarray, 0);
StructList.StructListNode temp = inputlist.First;
for (int i = 0; i < arrayLen; i++) {
if (outputarray[i].num != temp.Value.num)
throw new Exception("CopyTo method test (3) failed, index:" + i);
temp = temp.Next;
}
foreach (Struct s in inputlist) {
s.num += 20.0;
}
temp = inputlist.First;
for (int i = 0; i < arrayLen; i++) {
if (outputarray[i].num != temp.Value.num)
throw new Exception("CopyTo method test (4) failed, index:" + i);
temp = temp.Next;
}
}
try {
list.CopyTo(null, 0);
throw new Exception("CopyTo method test (5) failed");
} catch (ArgumentNullException) {
}
// Clear() test
list.Clear();
if (list.Count != 0)
throw new Exception("Clear method failed");
// Finally test the methods being wrapped
{
IntList il = new IntList();
for (int i = 0; i < 4; i++) {
il.Add(i);
}
double x = li_std_list.average(il);
x += li_std_list.average(new IntList(new int[] { 1, 2, 3, 4 }));
DoubleList dlist = new DoubleList();
for (int i = 0; i < 10; i++) {
dlist.Add(i / 2.0);
}
li_std_list.halve_in_place(dlist);
}
// Dispose()
{
using (StructList ls = new StructList(new Struct[] { new Struct(0.0), new Struct(11.1) }))
using (DoubleList ld = new DoubleList(new double[] { 0.0, 11.1 })) { }
}
// More wrapped methods
{
FloatList l0 = li_std_list.listreal(new FloatList());
float flo = 123.456f;
l0.Add(flo);
flo = l0.First.Value;
IntList l1 = li_std_list.listint(new IntList());
IntPtrList l2 = li_std_list.listintptr(new IntPtrList());
IntConstPtrList l3 = li_std_list.listintconstptr(new IntConstPtrList());
l1.Add(123);
l2.Clear();
l3.Clear();
StructList l4 = li_std_list.liststruct(new StructList());
StructPtrList l5 = li_std_list.liststructptr(new StructPtrList());
StructConstPtrList l6 = li_std_list.liststructconstptr(new StructConstPtrList());
l4.Add(new Struct(123));
l5.Add(new Struct(123));
l6.Add(new Struct(123));
}
// Test lists of pointers
{
StructPtrList inputlist = new StructPtrList();
int arrayLen = 10;
for (int i = 0; i < arrayLen; i++) {
inputlist.Add(new Struct(i / 10.0));
}
Struct[] outputarray = new Struct[arrayLen];
inputlist.CopyTo(outputarray, 0);
StructPtrList.StructPtrListNode temp = inputlist.First;
for (int i = 0; i < arrayLen; i++) {
if (outputarray[i].num != temp.Value.num)
throw new Exception("StructPtrList test (1) failed, i:" + i);
temp = temp.Next;
}
foreach (Struct s in inputlist) {
s.num += 20.0;
}
for (int i = 0; i < arrayLen; i++) {
if (outputarray[i].num != 20.0 + i / 10.0)
throw new Exception("StructPtrList test (2) failed (a deep copy was incorrectly made), i:" + i);
}
}
// Test lists of const pointers
{
StructConstPtrList inputlist = new StructConstPtrList();
int arrayLen = 10;
for (int i = 0; i < arrayLen; i++) {
inputlist.Add(new Struct(i / 10.0));
}
Struct[] outputarray = new Struct[arrayLen];
inputlist.CopyTo(outputarray, 0);
StructConstPtrList.StructConstPtrListNode temp = inputlist.First;
for (int i = 0; i < arrayLen; i++) {
if (outputarray[i].num != temp.Value.num)
throw new Exception("StructConstPtrList test (1) failed, i:" + i);
temp = temp.Next;
}
foreach (Struct s in inputlist) {
s.num += 20.0;
}
for (int i = 0; i < arrayLen; i++) {
if (outputarray[i].num != 20.0 + i / 10.0)
throw new Exception("StructConstPtrList test (2) failed (a deep copy was incorrectly made), i:" + i);
}
}
}
}

View file

@ -0,0 +1,89 @@
using System;
using System.Collections.Generic;
using li_std_setNamespace;
public class runme
{
static void checkThat(bool mustBeTrue, string message)
{
if (!mustBeTrue)
throw new Exception("Test that the set " + message + " failed");
}
static void Main()
{
StringSet ss = new StringSet();
// Check the interface methods first.
ISet<string> s = ss;
checkThat(s.Count == 0, "is initially empty");
checkThat(!s.Contains("key"), "doesn't contain inexistent element");
checkThat(!s.Remove("key"), "returns false when removing inexistent element");
checkThat(s.Add("key"), "returns true when adding a new element");
checkThat(!s.Add("key"), "returns false when adding an existing element");
checkThat(s.Contains("key"), "contains the just added element");
checkThat(s.Remove("key"), "returns true when removing an existing element");
checkThat(s.Count == 0, "is empty again");
checkThat(s.Add("key1"), "Add(key1) returns true");
checkThat(s.Add("key2"), "Add(key2) returns true");
checkThat(s.Add("key3"), "Add(key3) returns true");
// Also check a different interface, providing a different Add() (sic!).
ICollection<string> coll = ss;
coll.Add("key");
checkThat(ss.Count == 4, "contains 4 elements");
// Now use object-specific methods, mimicking HashSet<>.
string val;
checkThat(ss.TryGetValue("key1", out val), "could retrieve existing item");
checkThat(val.Equals("key1"), "value was returned correctly by TryGetValue()");
checkThat(!ss.TryGetValue("no-such-key", out val), "couldn't retrieve inexistent item");
checkThat(val == null, "value was reset after failed TryGetValue()");
IList<string> list = new List<string>();
foreach (string str in ss) {
list.Add(str);
}
checkThat(list.Count == 4, "copy contains 4 elements");
ss.Clear();
checkThat(ss.Count == 0, "is empty after Clear()");
// Check set-theoretic methods.
checkThat(new StringSet().SetEquals(new StringSet()), "SetEquals() works for empty sets");
checkThat(new StringSet{"foo"}.SetEquals(new StringSet{"foo"}), "SetEquals() works for non-empty sets");
checkThat(!new StringSet{"foo"}.SetEquals(new[] {"bar"}), "SetEquals() doesn't always return true");
ss = new StringSet{"foo", "bar", "baz"};
ss.ExceptWith(new[] {"baz", "quux"});
checkThat(ss.SetEquals(new[] {"foo", "bar"}), "ExceptWith works");
ss = new StringSet{"foo", "bar", "baz"};
ss.IntersectWith(new[] {"baz", "quux"});
checkThat(ss.SetEquals(new[] {"baz"}), "IntersectWith works");
checkThat(ss.IsProperSubsetOf(new[] {"bar", "baz"}), "IsProperSubsetOf works");
checkThat(!ss.IsProperSubsetOf(new[] {"baz"}), "!IsProperSubsetOf works");
checkThat(ss.IsSubsetOf(new[] {"bar", "baz"}), "IsSubsetOf works");
checkThat(!ss.IsSubsetOf(new[] {"bar"}), "!IsSubsetOf works");
ss = new StringSet{"foo", "bar", "baz"};
checkThat(ss.IsProperSupersetOf(new[] {"bar"}), "IsProperSupersetOf works");
checkThat(!ss.IsProperSupersetOf(new[] {"quux"}), "IsProperSupersetOf works");
checkThat(ss.IsSupersetOf(new[] {"foo", "bar", "baz"}), "IsProperSupersetOf works");
checkThat(!ss.IsSupersetOf(new[] {"foo", "bar", "baz", "quux"}), "IsProperSupersetOf works");
checkThat(ss.Overlaps(new[] {"foo"}), "Overlaps works");
checkThat(!ss.Overlaps(new[] {"moo"}), "!Overlaps works");
ss.SymmetricExceptWith(new[] {"baz", "quux"});
checkThat(ss.SetEquals(new[] {"foo", "bar", "quux"}), "SymmetricExceptWith works");
ss = new StringSet{"foo", "bar", "baz"};
ss.UnionWith(new[] {"baz", "quux"});
checkThat(ss.SetEquals(new[] {"foo", "bar", "baz", "quux"}), "UnionWith works");
}
}

View file

@ -104,6 +104,9 @@
};
/// @return This is a bad place for this tag, but it should be ignored.
struct StructWithReturnComment {};
/**
An example of a list in a documentation comment.

View file

@ -32,4 +32,9 @@
SOME_ITEM_30 ///< Post comment for the third item
};
enum SomeEnumWithTrailingComma
{
SOME_ITEM_100, ///< Post comment after comma.
SOME_ITEM_200, ///< Post comment after last comma.
};
%}

View file

@ -1,5 +1,9 @@
%module doxygen_translate
#if defined(SWIGJAVA)
%javamethodmodifiers function "@Deprecated\npublic"
#endif
%inline %{
/**

View file

@ -1,5 +1,9 @@
%module doxygen_translate_all_tags
#if defined(SWIGJAVA)
%javamethodmodifiers func02 "@Deprecated\npublic"
#endif
%inline %{
/**

View file

@ -24,11 +24,11 @@ SWIG_LIB_SET = @SWIG_LIB_SET@
SWIGINVOKE = $(SWIG_LIB_SET) $(SWIGTOOL) $(SWIGEXE)
# All .i files with prefix 'cpp_' will be treated as C++ input and remaining .i files as C input
ALL_ERROR_TEST_CASES := $(patsubst %.i,%, $(notdir $(wildcard $(srcdir)/*.i)))
CPP_ERROR_TEST_CASES := $(filter cpp_%, $(ALL_ERROR_TEST_CASES))
C_ERROR_TEST_CASES := $(filter-out $(CPP_ERROR_TEST_CASES), $(ALL_ERROR_TEST_CASES))
DOXYGEN_ERROR_TEST_CASES := $(filter doxygen_%, $(C_ERROR_TEST_CASES))
C_ERROR_TEST_CASES := $(filter-out $(DOXYGEN_ERROR_TEST_CASES), $(C_ERROR_TEST_CASES))
ALL_ERROR_TEST_CASES := $(sort $(patsubst %.i,%, $(notdir $(wildcard $(srcdir)/*.i))))
CPP_ERROR_TEST_CASES := $(sort $(filter cpp_%, $(ALL_ERROR_TEST_CASES)))
C_ERROR_TEST_CASES := $(sort $(filter-out $(CPP_ERROR_TEST_CASES), $(ALL_ERROR_TEST_CASES)))
DOXYGEN_ERROR_TEST_CASES := $(sort $(filter doxygen_%, $(C_ERROR_TEST_CASES)))
C_ERROR_TEST_CASES := $(sort $(filter-out $(DOXYGEN_ERROR_TEST_CASES), $(C_ERROR_TEST_CASES)))
# Always use C++ for Doxygen tests, there doesn't seem to be any need to
# distinguish between C and C++ Doxygen tests.

View file

@ -0,0 +1 @@
cpp_final_destructor.i:7: Warning 525: Destructor BaseFinal::~BaseFinal() is final, BaseFinal cannot be a director class.

View file

@ -0,0 +1,14 @@
%module xxx
// Testing is_digits detecting gcc linemarkers
// These are valid
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 123 "header1.h"
// These are invalid
#a1 'a.h'
#1b 'b.h'
#1c1 'c.h'
#d1d 'd.h'

View file

@ -0,0 +1,4 @@
pp_unknowndirective3.i:10: Error: Unknown SWIG preprocessor directive: a1 (if this is a block of target language code, delimit it with %{ and %})
pp_unknowndirective3.i:11: Error: Unknown SWIG preprocessor directive: 1b (if this is a block of target language code, delimit it with %{ and %})
pp_unknowndirective3.i:12: Error: Unknown SWIG preprocessor directive: 1c1 (if this is a block of target language code, delimit it with %{ and %})
pp_unknowndirective3.i:13: Error: Unknown SWIG preprocessor directive: d1d (if this is a block of target language code, delimit it with %{ and %})

View file

@ -73,7 +73,18 @@ INCLUDES = -I$(abs_top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)
%.multicpptest:
$(setup)
+$(swig_and_compile_multi_cpp)
mkdir -p gopath/$*/src 2>/dev/null || true
if ! test -d gopath/$*/src/swigtests; then \
(cd gopath/$*/src && ln -s . swigtests); \
fi
+for f in `cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list` ; do \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
LIBS='$(LIBS)' INCLUDES='$(INCLUDES)' SWIGOPT='$(SWIGOPT)' NOLINK=true \
TARGET="$(TARGETPREFIX)$${f}$(TARGETSUFFIX)" INTERFACEDIR='$(INTERFACEDIR)' INTERFACE="$$f.i" \
GOMOD="$*" \
$(LANGUAGE)$(VARIANT)_cpp; \
done
$(run_multi_testcase)
li_windows.cpptest:
@ -82,50 +93,55 @@ li_windows.cpptest:
multi_import.multicpptest:
$(setup)
mkdir -p gopath/multi_import/src 2>/dev/null || true
if ! test -d gopath/multi_import/src/swigtests; then \
(cd gopath/multi_import/src && ln -s . swigtests); \
fi
for f in multi_import_b multi_import_a; do \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
LIBS='$(LIBS)' INCLUDES='$(INCLUDES)' SWIGOPT='$(SWIGOPT)' NOLINK=true \
TARGET="$(TARGETPREFIX)$${f}$(TARGETSUFFIX)" INTERFACEDIR='$(INTERFACEDIR)' INTERFACE="$$f.i" \
GOMOD="multi_import" \
$(LANGUAGE)$(VARIANT)_cpp; \
done
$(run_multi_testcase)
go_subdir_import.multicpptest:
$(setup)
mkdir -p testdir/go_subdir_import/
mkdir -p gopath/src/testdir/go_subdir_import/
mkdir -p gopath/go_subdir_import/src 2>/dev/null || true
if ! test -d gopath/go_subdir_import/src/swigtests; then \
(cd gopath/go_subdir_import/src && ln -s . swigtests); \
fi
mkdir -p testdir/go_subdir_import 2>/dev/null || true
mkdir -p gopath/go_subdir_import/src/testdir/go_subdir_import 2>/dev/null || true
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
LIBS='$(LIBS)' INTERFACEPATH='$(SRCDIR)$(INTERFACEDIR)go_subdir_import_b.i' \
INCLUDES='$(INCLUDES)' SWIGOPT='$(SWIGOPT) -outdir .' NOLINK=true \
TARGET='$(TARGETPREFIX)go_subdir_import_b$(TARGETSUFFIX)' INTERFACEDIR='$(INTERFACEDIR)' \
INTERFACE='testdir/go_subdir_import/go_subdir_import_b.i' \
GOMOD="go_subdir_import" \
$(LANGUAGE)$(VARIANT)_cpp;
for f in testdir/go_subdir_import/go_subdir_import_c go_subdir_import_a ; do \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
LIBS='$(LIBS)' INCLUDES='$(INCLUDES)' SWIGOPT='$(SWIGOPT)' NOLINK=true \
TARGET="$(TARGETPREFIX)$${f}$(TARGETSUFFIX)" INTERFACEDIR='$(INTERFACEDIR)' INTERFACE="$$f.i" \
GOMOD="go_subdir_import" \
$(LANGUAGE)$(VARIANT)_cpp; \
done
if $(GOGCC); then \
cp gopath/src/testdir/go_subdir_import/go_subdir_import_b/go_subdir_import_b.a gopath/src/testdir/go_subdir_import/go_subdir_import_b.gox; \
cp gopath/src/testdir/go_subdir_import/go_subdir_import_b/go_subdir_import_b.a .; \
cp gopath/src/testdir/go_subdir_import/go_subdir_import_c/go_subdir_import_c.a gopath/src/testdir/go_subdir_import/go_subdir_import_c.gox; \
cp gopath/src/testdir/go_subdir_import/go_subdir_import_c/go_subdir_import_c.a testdir/go_subdir_import/; \
fi
$(run_multi_testcase)
# Runs the testcase.
run_testcase = \
if test -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \
if $(GOGCC) ; then \
$(COMPILETOOL) $(GCCGO) -c -g -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
$(COMPILETOOL) $(GCCGO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ $*.a; \
$(COMPILETOOL) $(GCCGO) -c -g -I gopath/src/$* $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
$(COMPILETOOL) $(GCCGO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ gopath/src/$*/$*.a; \
elif $(GO12) || $(GO13) || $(GO15); then \
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld $(CC) -extldflags "$(CFLAGS) $(OSXOLDGOLINKFLAGS)" -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I gopath/src/$* $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -L gopath/src/$* -linkmode external -extld $(CC) -extldflags "$(CFLAGS) $(OSXOLDGOLINKFLAGS)" -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
else \
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -L . -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
@ -136,11 +152,11 @@ run_testcase = \
run_testcase_cpp = \
if test -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \
if $(GOGCC) ; then \
$(COMPILETOOL) $(GCCGO) -c -g -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
$(COMPILETOOL) $(GCCGO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ $*.a -lstdc++; \
$(COMPILETOOL) $(GCCGO) -c -g -I gopath/src/$* $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
$(COMPILETOOL) $(GCCGO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ gopath/src/$*/$*.a -lstdc++; \
elif $(GO12) || $(GO13) || $(GO15); then \
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld $(CXX) -extldflags "$(CXXFLAGS) $(OSXOLDGOLINKFLAGS)" -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I gopath/src/$* $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -L gopath/src/$* -linkmode external -extld $(CXX) -extldflags "$(CXXFLAGS) $(OSXOLDGOLINKFLAGS)" -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
else \
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -L . -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
@ -150,18 +166,24 @@ run_testcase_cpp = \
run_multi_testcase = \
if test -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \
if $(GOGCC) ; then \
$(COMPILETOOL) $(GCCGO) -c -g -I . -I gopath/src $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
if $(GO15) || $(GOGCC); then \
files=`cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list`; \
$(COMPILETOOL) $(GCCGO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ `for f in $$files; do echo $$f.a; done` -lstdc++; \
elif $(GO12) || $(GO13) || $(GO15); then \
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -L . -linkmode external -extld $(CXX) -extldflags "$(CXXFLAGS) $(OSXOLDGOLINKFLAGS)" -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
else \
$(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -L . -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
fi && \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) ./$*_runme; \
mkdir gopath/$*/src/$* 2>/dev/null || true; \
cp $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) gopath/$*/src/$*; \
GOPATH="`pwd`/gopath/$*"; \
export GOPATH; \
CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) `for f in $$files; do echo -I ../$$f; done`"; \
export CGO_CPPFLAGS; \
CGO_CFLAGS="$(CFLAGS)"; \
export CGO_CFLAGS; \
CGO_CXXFLAGS="$(CXXFLAGS)"; \
export CGO_CXXFLAGS; \
CGO_LDFLAGS="$(LDFLAGS) -lm"; \
export CGO_LDFLAGS; \
(cd gopath/$*/src/$* && \
$(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o ../../../../$*_runme) && \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) ./$*_runme; \
fi; \
fi
%.clean:

View file

@ -1,6 +1,6 @@
package main
import "./abstract_access"
import "abstract_access"
func main() {
d := abstract_access.NewD()

View file

@ -1,6 +1,6 @@
package main
import "./abstract_typedef2"
import "abstract_typedef2"
func main() {
abstract_typedef2.NewA_UF()

View file

@ -1,6 +1,6 @@
package main
import "./abstract_typedef"
import "abstract_typedef"
func main() {
e := abstract_typedef.NewEngine()

View file

@ -1,6 +1,6 @@
package main
import "./abstract_virtual"
import "abstract_virtual"
func main() {
abstract_virtual.NewD()

View file

@ -1,6 +1,6 @@
package main
import wrap "./argout"
import wrap "argout"
func main() {
ip := wrap.New_intp()

View file

@ -1,6 +1,6 @@
package main
import . "./array_member"
import . "array_member"
func main() {
f := NewFoo()

View file

@ -1,6 +1,6 @@
package main
import . "./arrays_global"
import . "arrays_global"
func main() {
SetArray_i(GetArray_const_i())

View file

@ -1,6 +1,6 @@
package main
import . "./char_binary"
import . "char_binary"
func main() {
t := NewTest()

View file

@ -1,6 +1,6 @@
package main
import "./class_ignore"
import "class_ignore"
func main() {
a := class_ignore.NewBar()

View file

@ -1,6 +1,6 @@
package main
import "./class_scope_weird"
import "class_scope_weird"
func main() {
f := class_scope_weird.NewFoo()

View file

@ -1,6 +1,6 @@
package main
import . "./compactdefaultargs"
import . "compactdefaultargs"
func main() {
defaults1 := NewDefaults1(1000)

View file

@ -1,9 +1,10 @@
package main
import (
"./constover"
"fmt"
"os"
"constover"
)
func main() {

View file

@ -1,6 +1,6 @@
package main
import . "./constructor_copy"
import . "constructor_copy"
func main() {
f1 := NewFoo1(3)

View file

@ -1,6 +1,6 @@
package main
import "./contract"
import "contract"
func main() {
contract.Test_preassert(1, 2)

View file

@ -1,7 +1,7 @@
package main
import "fmt"
import . "./cpp11_strongly_typed_enumerations"
import . "cpp11_strongly_typed_enumerations"
func enumCheck(actual int, expected int) int {
if actual != expected {

View file

@ -1,6 +1,6 @@
package main
import "./cpp_enum"
import "cpp_enum"
func main() {
f := cpp_enum.NewFoo()

View file

@ -1,7 +1,7 @@
// Note: This example assumes that namespaces are flattened
package main
import "./cpp_namespace"
import "cpp_namespace"
func main() {
n := cpp_namespace.Fact(4)

Some files were not shown because too many files have changed in this diff Show more