blob: 13c76f0ae52dc16c119426b1c88d3f4961ac6dc6 [file] [log] [blame]
SWIG (Simplified Wrapper and Interface Generator)
See the CHANGES.current file for changes in the current version.
See the RELEASENOTES file for a summary of changes in each release.
Issue # numbers mentioned below can be found on Github. For more details, add
the issue number to the end of the URL: https://github.com/swig/swig/issues/
Version 4.1.1 (30 Nov 2022)
===========================
2022-11-29: bero
Fix mismatch between #pragma GCC diagnostic push and pop statements
2022-11-26: wsfulton
#2449 Fix undefined behaviour in ccache-swig calculating md4 hashes and possibly
also handling errors when CCACHE_CPP2 is set.
2022-11-25: wsfulton
#961 Fix syntax error parsing unnamed template parameters with a default value.
2022-11-25: olly
#2447 Fix undefined behaviour in swig's parser when handling
default parameter expressions containing method calls.
2022-11-13: olly
[PHP] #2419 Update the documentation to reflect that SWIG 4.1.0
dropped support for -noproxy when generating PHP wrappers.
2022-11-05: wsfulton
#2417 Fix -swiglib for Windows when building with CMake.
2022-11-02: wsfulton
#2418 Fix infinite loop handling non-type template parameters.
Fixes infinite loop due to () brackets in a non-type template
parameter containing an expression.
2022-10-28: wsfulton
[R] R rtypecheck typemaps
Further switch to use rtypecheck typemaps instead of hard coded logic.
The full switch to typemaps is deferred until swig-4.2 as it can't be fully
backwards compatible. For now a warning is provided to help the
transition. It provides the full typemap that should be placed into
a user's interface file, for example:
%typemap("rtype") int32_t * "integer"
void testmethod(int32_t * i);
void testmethod();
If there is no rtypecheck typemap for int32_t *, the warning shown is:
example.i:7: Warning 750: Optional rtypecheck code is deprecated. Add the
following typemap to fix as the next version of SWIG will not work without it:
%typemap("rtypecheck") int32_t * %{ (is.integer($arg) || is.numeric($arg)) %}
The warning is shown for any code that previously used "numeric", "integer" or
"character" for the rtype typemap. Copying the rtypecheck typemap as
shown into the user interface file will provide the appropriate fix and
the warning will disappear. This is important to do as swig-4.2 will
not be able to provide this helpful warning.
2022-10-27: wsfulton
[R] Allow NULL to be used in overloaded functions taking shared_ptr.
Also fixes special variable $argtype expansion in rtypecheck typemaps.
2022-10-26: wsfulton
[R] Improve R wrapper error message when calling overloaded methods
when incorrect types passed are passed to the overloaded methods.
Old unhelpful error message:
Error in f(...) : could not find function "f"
Example of new improved error message:
Error in use_count(k) :
cannot find overloaded function for use_count with argtypes (NULL)
2022-10-26: wsfulton
[R] #2386 Fix memory leak in R shared_ptr wrappers.
Fix leak when a cast up a class inheritance chain is required.
Version 4.1.0 (24 Oct 2022)
===========================
2022-10-24: wsfulton, AndLLA
[R] #2386 Fix problems in shared_ptr wrappers where the class names
were not consistent when using the shared_ptr template or the actual
underlying type.
2022-10-24: wsfulton
[R] Add support for special variable replacement in the $typemap()
special variable macro for R specific typemaps (rtype, rtypecheck,
scoercein, scoereout).
2022-10-24: wsfulton
[R] Polymorphism in the wrappers was only working for C++ classes,
now this works for C++ structs too.
2022-10-19: olly
[Lua] #2126 Fix type resolution between multiple SWIG-wrapped
modules.
2022-10-17: wsfulton
[R] #2385 Add support for std::vector<std::vector<std::string>>.
2022-10-14: murillo128
[Javascript] #2109 Tweak unsigned long and unsigned long long typemaps
to create a v8::Number instead of v8::Integer if the value exceeds
the size of v8::Integer. Note that the v8::Number value will be
imprecise if the value is > MAX_SAFE_INTEGER.
2022-10-14: olly
[R] Arrange that destructors of local C++ objects in the wrapper
function get run on SWIG_fail (which calls Rf_error() which calls
longjmp()).
2022-10-14: olly
[Lua] Arrange that destructors of local C++ objects in the wrapper
function get run on SWIG_fail (which calls lua_error() which calls
longjmp()).
2022-10-13: wsfulton
[R] Add missing SWIGTYPE *const& typemaps for supporting pointers
by const reference.
2022-10-10: wsfulton
#2160 Fix compile error when using templates with more than one template
parameter and used as an input parameter in a virtual method in a
director class (problem affecting most of the scripting languages).
2022-10-10: treitmayr, wsfulton
[Python, Ruby] #1811 #1823 Fix invalid code generated in some cases when
returning a pointer or reference to a director-enabled class instance.
This previously only worked in very simple cases, now return types are
resolved to fix. A bug in template instantiations using pointers also
works now.
2022-10-06: wsfulton
[CFFI] #1966 #2200 Remove code for Common Lisp CFFI. We dropped support
for it in SWIG 4.0.0 by disabling it as the first stage. This is the
final stage for complete removal as there has been no meaningful
progress to revive it to the status of experimental language.
2022-10-06: olly
[Python] #2390 Remove deprecated and apparently useless defarg.swg
The only documentation is in the file itself and describes a Python
wrapper around the C function defined here, but digging though the
git history this Python wrapper doesn't seem to have ever actually
been generated by SWIG.
This file was also marked as deprecated in 2005.
2022-10-06: wsfulton
[Java] #2048 Fix quoting for doxygen \image command to quote the output
file name generated into the html src attribute.
2022-10-05: benjamin-sch
[Python] added an interpreter counter to fix deinitialization
issues if multiple subinterpreters are used
2022-10-05: olly, wsfulton
#672 Add support for parsing C++11 final classes such as:
class X final {};
This no longer gives a syntax error.
2022-10-05: wsfulton
[OCaml] Fix %rename for enum items. Previously the rename had no effect.
2022-10-05: olly
#1465 Report errors in preprocessor expressions by default
Until now SWIG quietly ignored such errors unless -Wextra (or -Wall
which implies -Wextra) was passed, but this is unhelpful as it tends
to hide genuine problems. To illustrate this point, enabling this
warning by default revealed a typo in the preproc_defined.i
testcase in SWIG's own testsuite.
If you really don't want to see this warning, you can suppress it
with command line option -w202 or by using this in your interface
file:
%warnfilter(SWIGWARN_PP_EVALUATION);
Both will work with older versions of SWIG too.
2022-10-04: olly
#1050 Consistently define SWIG_VERSION both at SWIG-time and in
the generated wrapper. Best practice remains to check at SWIG-time
where possible because that results in smaller generated wrapper
sources.
SWIGGO and SWIGJAVASCRIPT are now defined in the generated wrappers
to match behaviour for all other target languages.
The undocumented SWIGVERSION macro is no longer defined.
2022-09-29: olly
#2303 SWIG's internal hash tables now use a better hash function.
The old hash function only considerd the last five characters
plus the least significant bit of the last-but-sixth character,
which as you might guess generated a lot of many-way collisions.
This change seems to give about a 4% reduction in wallclock time
for processing li_std_list_wrap.i from the testsuite for Python.
The hash collision rate for this example drops from 39% to 0!
2022-09-29: wsfulton
#2303 Type tables are now output in a fixed order whereas previously
the order may change with any minor input code change. This shouldn't
affect users except SWIG_TypePrettyName may output a different C/C++
typedef to a type - it's used mostly for showing errors when the type
passed to a function is wrong.
2022-09-29: olly
[PHP] Dynamic class properties are no longer supported by default.
Historically PHP has supported dynamic class properties and SWIG
has implemented them too (because we implement the magic __get(),
__set() and __isset() methods we need to include explicit
handling).
PHP 8.2 deprecates dynamic class properties - initially they'll
warn, and apparently they'll not work by default in PHP 9.0:
https://wiki.php.net/rfc/deprecate_dynamic_properties
In PHP code dynamic properties can be enabled for a class by
marking that class with the attribute `#[AllowDynamicProperties]`.
To follow this PHP change, in SWIG you now need to specify
`%feature("php:allowdynamicproperties", 1) Foo;` (or
`%feature("php:allowdynamicproperties", 1)` to enable it for
all wrapped classes). Unknown features are ignored, so you can add
it unconditionally and it'll work with older SWIG too.
*** POTENTIAL INCOMPATIBILITY ***
2022-09-19: wsfulton
#1484 Fixes for class inheritance with the same name in different namespaces
such as:
namespace A { class Bar {}; }
namespace B { template<typename T, typename U> class Bar : public A::Bar {}; }
2022-09-19: wsfulton
#2316 Remove swig.spec file and srcrpm makefile target. These are very out of date
and don't seem to be used by RPM based Linux distributions which have their
own version of swig.spec.
2022-09-17: wsfulton
[Go, Guile, Racket, Scilab] Add throws typemaps for std::string so that thrown
string exception messages can be seen.
2022-09-17: wsfulton
[Racket] Add throws typemaps for char * so that thrown string exception
messages can be seen from Racket.
2022-09-17: wsfulton
[Javascript, Octave, R] Improve exceptions for %catches and exception
specifications for native types. String exception messages are shown as
the exception message instead of just the type of the exception.
2022-09-17: wsfulton
Add missing typecheck typemaps for std::auto_ptr and std::unique_ptr to
fix overloading when using these types.
2022-09-17: wsfulton
[Guile] Add error checking to SWIGTYPE and SWIGTYPE & in typemaps to prevent
seg faults when passing #nil to these parameter types.
2022-09-16: wsfulton
#999 Provide SWIGTYPE MOVE typemaps in swigmove.i for implementing full
move semantics when passing parameters by value.
2022-08-31: wsfulton
#999 Improve move semantics when using rvalue references.
The SWIGTYPE && input typemaps now assume the object has been moved.
These typemaps have been changed assuming that after the function call,
the rvalue reference parameter has been moved. The parameter's proxy class
that owns the C++ object thus has the underlying pointer set to null
so that the (moved from, but still valid) C++ object cannot be used again
and the object is additionally deleted.
*** POTENTIAL INCOMPATIBILITY ***
2022-08-28: wsfulton
[Octave] SWIG now marshals a C/C++ NULL pointer into the null matrix, [].
SWIG has always marshalled the null matrix into a NULL pointer; this remains
and now we have consistency in representing a NULL pointer.
2022-08-26: wsfulton
[Racket] SWIG now marshals a C/C++ NULL pointer into a null value by calling
scheme_make_null(), so that scheme's null? is true for a NULL C/C++ pointer value.
2022-08-18: wsfulton
[Racket] Add support for std::unique_ptr in std_unique_ptr.i.
Add support for std::auto_ptr in std_auto_ptr.i.
2022-08-13: wsfulton
[Guile] Add support for std::unique_ptr in std_unique_ptr.i.
Add support for std::auto_ptr in std_auto_ptr.i.
2022-08-11: wsfulton
[Lua] Add support for std::unique_ptr in std_unique_ptr.i.
Add support for std::auto_ptr in std_auto_ptr.i.
2022-08-05: wsfulton
[D] Fix occasional undefined behaviour with inheritance hierarchies, particularly
when using virtual inheritance as the pointers weren't correctly upcast from derived
class to base class when stored in the base's proxy class.
2022-08-05: wsfulton
[D] Add support for std::unique_ptr in std_unique_ptr.i.
Add support for std::auto_ptr in std_auto_ptr.i.
2022-08-03: wsfulton
[Javascript] Add support for std::unique_ptr in std_unique_ptr.i.
Add support for std::auto_ptr in std_auto_ptr.i.
2022-08-02: wsfulton
[Octave] Add support for std::unique_ptr in std_unique_ptr.i.
Add support for std::auto_ptr in std_auto_ptr.i.
2022-08-01: wsfulton
[Python] Add initialisers for additional members in PyHeapTypeObject
(builtin mode) for Python-3.11 - _ht_tpname, _spec_cache.
2022-07-30: wsfulton
C++20 has deprecated std::basic_string<>::reserve() and the C++11 method
std::basic_string<>::shrink_to_fit() is a replacement that can be used.
std_string.i and std_wstring.i provided wrappers for reserve with the following
template instantiations:
%template(string) std::basic_string<char>;
%template(wstring) std::basic_string<wchar_t>;
The reserve method is no longer wrapped, however the shrink_to_fit() method
can be used as an alternative from the target language (the generated wrappers
call reserve() instead if C++<=20).
Note that std::basic_string<>::reserve(size_t n) is still wrapped unchanged.
*** POTENTIAL INCOMPATIBILITY ***
2022-07-30: wsfulton
[Tcl] Add support for std::unique_ptr in std_unique_ptr.i.
Add support for std::auto_ptr in std_auto_ptr.i.
2022-07-27: ZackerySpytz, olly
#1678 Support parsing C++20 templated lambdas.
2022-07-27: ZackerySpytz, olly
#1622 Add support for the C++20 spaceship operator (<=>).
2022-07-26: olly
[Tcl] https://sourceforge.net/p/swig/bugs/977/
Fix handling of long long on 32-bit platforms. This fix raises
SWIG's minimum supported Tcl version to 8.4.0 (which was released
just under 20 years ago).
2022-07-26: olly
Fix incorrect operator precedence in preprocessor expressions.
2022-07-25: olly
Support for C++14 binary integer literals in preprocessor expressions.
2022-07-20: wsfulton
[C#, Java] Ensure the order of interfaces generated in proxy interfaces for the
%interface family of macros is the same as that parsed from the bases in C++.
2022-07-20: jicks, Ingener74, olly
#422 [Python] Fix mishandling of a Python class inheriting from
multiple SWIG-wrapped director classes.
2022-07-19: wsfulton
#692 [C#, Java, Perl, Python, Ruby] std::unique_ptr and std::auto_ptr typemaps
provided for inputs types in std_unique_ptr.i and std_auto_ptr.i.
Now these smart pointers can be used as input parameters to functions. A proxy
class instance transfers memory ownership of the underlying C++ object from the
proxy class to a smart pointer instance passed to the wrapped function.
2022-07-19: jschueller
[Python] #2314 Drop support for Python 3.2.
2022-07-19: olly
Remove remaining support code for classic macos, which has not been
supported by Apple for over 20 years now.
2022-07-12: wsfulton
#999 Performance optimisation for parameters passed by value that are C++11 movable.
The C++ wrappers create a temporary variable for a parameter to be passed to a
function. This is initially default constructed and then copy assigned from the
instance being passed in from the target language. This is unchanged, however,
when the temporary variable is passed to the wrapped function, it is now done using
std::move. If the type is move constructible, the move constructor will be used
instead of the copy constructor.
2022-07-12: wsfulton
[Perl] Add std::auto_ptr support in std_auto_ptr.i library file.
2022-07-12: erezgeva
[Perl] Add std::unique_ptr support in std_unique_ptr.i library file.
2022-07-07: jmarrec
#1158 #2286 Add basic support for C++11 attributes. These are now
crudely ignored by SWIG's parser's tokeniser, which is better than
failing with a parse error.
2022-07-05: ianlancetaylor
[Go] #2245 Handle NULL pointers for string* conversions.
Rearrange generation of director methods and rename
receiver argument from p to swig_p.
2022-07-03: wsfulton
#999 Performance optimisation for directors for classes passed by value. The directorin
typemaps in the director methods now use std::move on the input parameter when
copying the object from the stack to the heap prior to the callback into the target
language, thereby taking advantage of move semantics if available.
2022-07-02: wsfulton
#1722 [C#, Java, Python, Ruby] Add std::unique_ptr support. Ported from std::auto_ptr.
Use the %unique_ptr(T) macro as follows for usage std::unique_ptr<T>. For example, for
a class called Klass:
%include "std_unique_ptr.i"
%unique_ptr(Klass)
Support is currently limited to only returning a std::unique_ptr from a function.
2022-06-29: wsfulton
#999 #1044 Enhance SWIGTYPE "out" typemaps to use std::move when copying
objects, thereby making use of move semantics when wrapping a function returning
by value if the returned type supports move semantics.
Wrapping functions that return move only types 'by value' now work out the box
without having to provide custom typemaps.
The implementation removed all casts in the "out" typemaps to allow the compiler to
appropriately choose calling a move constructor, where possible, otherwise a copy
constructor. The implementation also required modifying SwigValueWrapper to
change a cast operator from:
SwigValueWrapper::operator T&() const;
to
#if __cplusplus >=201103L
SwigValueWrapper::operator T&&() const;
#else
SwigValueWrapper::operator T&() const;
#endif
This is not backwards compatible for C++11 and later when using the valuewrapper feature
if a cast is explicitly being made in user supplied "out" typemaps. Suggested change
in custom "out" typemaps for C++11 and later code:
1. Try remove the cast altogether to let the compiler use an appropriate implicit cast.
2. Change the cast, for example, from static_cast<X &> to static_cast<X &&>, using the
__cplusplus macro if all versions of C++ need to be supported.
*** POTENTIAL INCOMPATIBILITY ***
2022-06-15: wsfulton
#2039 Add move assignment operator to SwigValueWrapper used by the
valuewrapper feature.
2022-06-04: sethrj
Enhance $typemap to support typemap attributes.
$typemap(method:attribute, typepattern)
For example:
%typemap(cstype, out="object") XClass "XClass"
%typemap(cscode) BarClass %{
$typemap(cstype:out, XClass) bar() {
return null;
}
which expands to
object bar() {
return null;
}
2022-05-30: wsfulton
[C#, D] Add new special variable expansion: $imfuncname.
Expands to the function name called in the intermediary class.
2022-05-30: LindleyF
[Java] #2042 Add new special variable expansion: $imfuncname.
Expands to the function name called in the intermediary class.
2022-05-28: jkuebart
[Java] On some versions of Android, specifically Android 6,
detaching the current thread from the JVM after every invocation
causes a memory leak.
Offer SWIG_JAVA_DETACH_ON_THREAD_END to configure a behaviour
where the JVM is only detached in the thread destructor.
See https://developer.android.com/training/articles/perf-jni#threads.
2022-05-27: xypron
[Python] #2277 Define PY_SSIZE_T_CLEAN macro before #include "Python.h" as
recommended in Python 3.7 and later.
To avoid this macro definition, add the following to your interface file so
that SWIG_NO_PY_SSIZE_T_CLEAN is defined at the beginning of the C++ wrappers:
%begin %{
#define SWIG_NO_PY_SSIZE_T_CLEAN
%}
2022-05-26: rokups
[C#] #1323 Modify SwigDerivedClassHasMethod for a more efficient director
implementation when calling virtual methods that are not overridden.
2022-05-15: erezgeva, eiselekd
[Lua, Perl, Octave, PHP, Tcl] #2275 #2276 #2283 Add argcargv.i library containing
(int ARGC, char **ARGV) multi-argument typemaps.
Document this library in Typemaps.html.
2022-05-07: KrisThielemans
[Python] Fix "too many initializers for 'PyHeapTypeObject'" errors
using PyPy 3.8 and later.
2022-05-04: wsfulton
[C#] Add C# wchar_t * director typemaps
2022-04-20: cminyard
Fix an issue where newlines were not properly generated
for godirectorin typemaps. If you have a virtual function
not assigned to zero, in some cases it won't generate a
newline and you will see errors:
example.go:1508:3: expected ';', found swig_r
when compiling the go code.
Also add an example of using goin and godirectorin and add
a test for this situation.
2022-04-29: jason-daly, JerryJoyce, wsfulton
[C#] #1233 Add wchar_t * and std::wstring Unicode string support on Linux.
2022-04-11: robinst
#2257 Fix new Ruby 3.2 warning "undefining the allocator of T_DATA
class swig_runtime_data".
2022-04-07: olly
#1750 SWIG now recognises and ignores Doxygen group commands `@{` and `@}`.
2022-04-06: wsfulton
./configure now enables C++11 and later C++ standards testing by default (when
running: 'make check').
The options to control this testing are the same:
./configure --enable-cpp11-testing
./configure --disable-cpp11-testing
But the former is now the default and the latter can be used to turn off C++11 and
later C++ standards testing.
2022-04-06: wsfulton
[Python] #1635 The "autodoc" feature no longer overrides Doxygen comments
in the generated docstring.
If a "docstring" feature is present it will still override a Doxygen comment.
If the "autodoc" feature is also present, the combined "autodoc" and "docstring"
will override the Doxygen comment. If no "docstring" is present then the
"autodoc" feature will not be generated when there is a Doxygen comment.
This way the "autodoc" feature can be specified and used to provide documentation
for 'missing' Doxygen comments.
*** POTENTIAL INCOMPATIBILITY ***
2022-04-01: olly
Remove undocumented and non-functional -browse command line option.
2022-03-26: eltoder
[Python] #1684 Use different capsule names with and without -builtin
Types generated with and without -builtin are not compatible. Mixing
them in a common type list leads to crashes. Avoid this by using
different capsule names: "type_pointer_capsule" without -builtin and
"type_pointer_capsule_builtin" with.
2022-03-25: wsfulton
The debug command line options that display parse tree nodes
(-debug-module, -debug-top, -debug-symtabs) now display previously hidden
linked list pointers which are useful for debugging parse trees.
Added new command line option -debug-quiet. This suppresses the display
of most linked list pointers and symbol table pointers in the parse tree nodes.
The keys in the parse tree node are now shown in alphabetical order.
2022-03-24: wsfulton
#2244 Fix using declaration in derived class bugs when all the base
class's overloaded methods were overridden in the derived class -
fixes "multiply defined" errors.
2022-03-23: wsfulton
[Python] #1779 The -py3 option is deprecated and now has no effect on the
code generated. Use of this option results in a deprecated warning.
The related SWIGPYTHON_PY3 macro that this option defined is no longer generated.
Note that %pythonnondynamic feature generates a metaclass that works on both
Python 2 and Python 3.
2022-03-21: wsfulton
[Python] #1779 pyabc.i for abstract base classes now supports versions of
Python prior to 3.3 by using the collection module for these older versions.
Python-3.3 and later continue to use the collections.abc module.
The -py3 option no longer has any effect on the %pythonabc feature.
2022-03-21: jschueller, jim-easterbrook, wsfulton
[Python] #2137 C++ static member functions no longer generate a "flattened"
name in the Python module. For example:
s = example.Spam()
s.foo() # Spam::foo() via an instance
example.Spam.foo() # Spam::foo() using class method
example.Spam_foo() # Spam::foo() "flattened" name
The "flattened" name is no longer generated, but can be generated
by using the new -flatstaticmethod option.
*** POTENTIAL INCOMPATIBILITY ***
2022-03-18: ianlancetaylor
[Go] #337 Implement %extend base methods in child classes.
2022-03-17: olly
[Python] #1779 SWIG's Python test-suite and examples are now
run with Python 3 by default. To run them with Python 2, set
PY2 to a non-empty value, e.g.:
make check-python-test-suite PY2=1
2022-03-16: olly
[Go] #683 -intgosize is now optional - if not specified the
generated C/C++ wrapper code will use ptrdiff_t for intgo and
size_t for uintgo.
2022-03-15: ianlancetaylor
[Go] Add typemaps for std::string*.
2022-03-15: ianlancetaylor
[Go] Don't convert arrays to pointers if there is a "gotype"
typemap entry.
2022-03-15: ianlancetaylor
[Go] Add documentation note about Go and C++ exceptions.
2022-03-12: wsfulton
#1524 %interface family of macros no longer contain the getter/setter
methods for wrapping variables. The interface only contains
virtual and non-virtual instance methods, that is, no static methods.
Enums are also no longer added to the interface (affects Java only where
they were missing from the proxy class, C# never had them in the interface).
*** POTENTIAL INCOMPATIBILITY ***
2022-03-12: wsfulton
#1277 Fixes for the family of %interface macros, %interface,
%interface_impl and %interface_custom fixes for overloaded methods
in an inheritance chain.
When C++ methods are not able to be overloaded in a derived class,
such as when they differ by just const, or the target language
parameters types are identical even when the C++ parameter types
are different, SWIG will ignore one of the overloaded methods with
a warning. A %ignore is required to explicitly ignore one of the
overloaded methods to avoid the warning message. Methods added
in the derived classes due to one of the %interface macros are now
similarly ignored/not added to the derived class.
The methods added to the derived classes can now also be modified
via %feature and %rename.
2022-03-08: ianlancetaylor
[Go] Treat a nil argument as a NULL pointer.
2022-03-08: ianlancetaylor
[Go] Add documentation notes about thread local storage.
2022-03-08: olly
#1006 SWIG now copes with an interface filename specified on the
command line which contains a closing parenthesis `)`, and more
generally with attributes to `%include` and `%import` which
are quoted and contain parentheses.
2022-03-07: Omar Medina
[Tcl] https://sourceforge.net/p/swig/bugs/1290/
Fix SWIG_AsWCharPtrAndSize() to actually assign to result
variable. It looks like SWIG/Tcl wide character handling is
currently fundamentally broken except on systems which use wide
characters as the system encoding, but this should fix wrapping
functions which take a wide string as a parameter on Microsoft
Windows.
2022-03-07: olly
[Javascript] #682 Fix handling of functions which take void*.
2022-03-06: olly
SWIG should now reliably exit with status 0 if the run was
successful and status 1 if there was an error (or a warning and
-Werror was in effect).
Previously in some situations SWIG would try to exit with the
status set to the number of errors encountered, but that's
problematic - for example if there were 256 errors this would
result in exit status 0 on most platforms. Also some error
statuses have special meanings e.g. those defined by <sysexits.h>.
Also SWIG/Javascript tried to exit with status -1 in a few places
(which typically results in exit status 255).
2022-03-05: wsfulton
#1441 Fix using declaration in derived class incorrectly introducing a method
from a base class when the using declaration is declared before the method
declaration. Problem occurred when within a namespace and the parameter types
in the method signatures were not fully qualified.
2022-03-05: ianlancetaylor
[Go] Treat non-const references as pointers.
2022-03-05: ianlancetaylor
In SWIG Go testsuite, fail test if "go build" fails.
2022-03-03: olly
#1901 #2223 SWIG should now always exit cleanly if memory
allocation fails, including removing any output files created
during the current run.
Previously most places in the code didn't check for a NULL return
from malloc()/realloc()/calloc() at all, typically resulting in
undefined behaviour; some places used assert() to check for a NULL
return (which is a misuse of assert() and such checks disappear if
built with NDEBUG defined leaving us back with undefined
behaviour).
2022-03-03: olly
#891 Report errors for typemap attributes without a value
(previously SWIG segfaulted) and for typemap types with a value
(previously the value was quietly ignored).
The old way of specifying a language name in the typemap attributes
is no longer supported (it has been deprecated for 16 years).
2022-03-02: geographika, wsfulton
[Python] #1951 Add Python variable annotations support.
Both function annotations and variable annotations are turned on using the
"python:annotations" feature. Example:
%feature("python:annotations", "c");
struct V {
float val;
};
The generated code contains a variable annotation containing the C float type:
class V(object):
val: "float" = property(_example.V_val_get, _example.V_val_set)
...
Python 3.5 and earlier do not support variable annotations, so variable
annotations can be turned off with a "python:annotations:novar" feature flag.
Example turning on function annotations but not variable annotations globally:
%feature("python:annotations", "c");
%feature("python:annotations:novar");
or via the command line:
-features python:annotations=c,python:annotations:novar
*** POTENTIAL INCOMPATIBILITY ***
2022-02-27: wsfulton
[Python] #735 #1561 Function annotations containing C/C++ types are no longer
generated when using the -py3 option. Function annotations support has been
moved to a feature to provide finer grained control. It can be turned on
globally by adding:
%feature("python:annotations", "c");
or by using the command line argument:
-features python:annotations=c
Also see entry dated 2022-03-02, regarding variable annotations.
*** POTENTIAL INCOMPATIBILITY ***
2022-02-26: wsfulton
#655 #1840 Add new warning WARN_LANG_USING_NAME_DIFFERENT to warn when a
method introduced by a using declaration in a derived class cannot
be used due to a conflict in names.
2022-02-24: olly
#1465 An invalid preprocessor expression is reported as a pair of
warnings with the second giving a more detailed message from the
expression evaluator. Previously SWIG prefixed the second message
with "Error:" - that was confusing as it's actually only a warning
by default so we've now dropped this prefix.
Before:
x.i:1: Warning 202: Could not evaluate expression '1.2'
x.i:1: Warning 202: Error: 'Floating point constant in preprocessor expression'
Now:
x.i:1: Warning 202: Could not evaluate expression '1.2'
x.i:1: Warning 202: Floating point constant in preprocessor expression
2022-02-23: olly
#1384 Fix a preprocessor expression evaluation bug. A
subexpression in parentheses lost its string/int type flag and
instead used whatever type was left in the stack entry from
previous use. In practice we mostly got away with this because
most preprocessor expressions are integer, but it could have
resulted in a preprocessor expression incorrectly evaluating as
zero. If -Wextra was in use you got a warning:
Warning 202: Error: 'Can't mix strings and integers in expression'
2022-02-21: davidcl
[Scilab] Improve 5.5.2, 6.0.0 and 6.1.0 support.
For Scilab 5, long names are reduced to small names preserving the
class prefix and accessor suffix (get or set).
For Scilab 6, long names with the class prefix and accessor suffix
should be used on the user code.
The `-targetversion` option has been removed as the generated code
now detects the Scilab version in loader.sce or builder.sce.
*** POTENTIAL INCOMPATIBILITY ***
2022-02-20: wsfulton
Fix %warnfilter warning suppress for warning 315 SWIGWARN_PARSE_USING_UNDEF.
2022-02-17: olly
[PHP] https://sourceforge.net/p/swig/bugs/1211/
Fix to call cleanup code in exception situations and not to invoke
the freearg typemap twice in certain situations.
2022-02-15: olly
#300 #368 Improve parser handling of % followed immediately by
an identifier. If it's not a recognised directive the scanner
now emits MODULO and then rescans what follows, and if the parser
then gives a syntax error we report it as an unknown directive.
This means that `a%b` is now allowed in an expression, and that
things like `%std::vector<std::string>` now give an error rather
than being quietly ignored.
2022-02-11: adr26
[Python] #2154 Fix memory leak.
SWIG python objects were being freed after the corresponding SWIG
module information was destroyed in Python 3, causing leaks when as
a result the object destructor could not be invoked. To prevent this
misordering, SWIG python objects now obtain a reference to the
Python capsule wrapping the module information, so that the module
information is correctly destroyed after all SWIG python objects
have been freed (and corresponding destructors invoked).
2022-02-10: olly
[Tcl] https://sourceforge.net/p/swig/bugs/1207/
https://sourceforge.net/p/swig/bugs/1213/
Fix Tcl generic input typemap for std::vector.
2022-02-07: sethrj
#2196 Add alternative syntax for specifying fragments in typemaps.
New syntax:
%typemap("in", fragment="frag1", fragment="frag2", fragment="frag3") {...}
which is equivalent to:
%typemap(in, fragment="frag1,frag2,frag3") {...}
2022-02-07: olly
#1806 Remove support for the "command" encoder, which was mostly
intended for use in `%rename` - most uses can be achieved using
the "regex" encoder, so we recommend using that instead.
The "command" encoder suffers from a number of issues - as the
documentation for it admitted, "[it] is extremely slow compared to
all the other [encoders] as it involves spawning a separate process
and using it for many declarations is not recommended" and that it
"should generally be avoided because of performance
considerations".
But it's also not portable. The design assumes that `/bin/sh`
supports `<<<` but that's a bash-specific feature so it doesn't
work on platforms where `/bin/sh` is not bash - it fails on
Debian, Ubuntu and probably some other Linux distros, plus most
non-Linux platforms. Microsoft Windows doesn't even have a
/bin/sh as standard.
Finally, no escaping of the passed string is done, so it has
potential security issues (though at least with %rename the input
is limited to valid C/C++ symbol names).
2022-02-06: olly
#2193 -DFOO on the SWIG command line now sets FOO to 1 for
consistency with C/C++ compiler preprocessors. Previously
SWIG set FOO to an empty value.
Existing invocations of SWIG with `-DFOO` where the empty value
matters can be updated to `-DFOO=` which should work with both
old and new releases of SWIG.
*** POTENTIAL INCOMPATIBILITY ***
2022-02-06: sethrj
#2194 Classes that are non-assignable due to const data or const
reference members are now automatically detected.
2022-02-04: friedrichatgc
[Octave] #1672 Fix for isobject for Octave 4.4 - 6.0.
2022-02-03: olly
[C#] #283 #998 Fix memory leak in directorin typemap for
std::string.
2022-02-03: olly
[Python] #967 Make `self` parameter available to user typemaps.
2022-02-03: teythoon
[Python] #801 Fix -Wunused-parameter warnings with builtin,
2022-02-03: teythoon
#801 Fix -Wstrict-prototypes warnings in generated pointer
functions.
2022-02-03: olly
#660 https://sourceforge.net/p/swig/bugs/1081/
Default parameter values containing method calls are now parsed and
handled - e.g. `x->foo(3,4)` and `y.z()`.
2022-02-02: olly
[Ruby] https://sourceforge.net/p/swig/bugs/1136/ Fix remove of prefix
from method name to only remove it at the start.
2022-02-01: olly
#231 Handle returning an object by reference in a C++ trailing
return type.
2022-02-01: davidcl
[Scilab] #745 use SWIG_<module>_Init() as a C module init function.
2022-02-01: olly
[OCaml] #2083 Fix to work when CAML_SAFE_STRING is on, which it is
by default in recent Ocaml releases.
2022-01-31: mreeez
https://sourceforge.net/p/swig/bugs/1147/
Fix copyToR() generated for a struct in a namespace.
2022-01-29: fschlimb
#655 Better handling of using declarations.
2022-01-29: dontpanic92
[Go] #676 Fix code generated for a C++ class with a non-capitalised
name.
2022-01-26: trex58
#1919 #1921 #1923 Various fixes for AIX portability.
2022-01-26: olly
#1935 Don't crash on an unclosed HTML tag in a doxygen comment
when -doxygen is specified.
2022-01-25: olly
Constant expressions now support member access with `.` such as
`foo.bar`. Previous this only worked in a case like `x->foo.bar`.
2022-01-25: olly
#2091 Support most cases of `sizeof` applied to an expression
in constant expressions. Previously there was only support for
`sizeof(<type>)` and expressions which syntactically look like a
type (such as `sizeof(foo)`).
2022-01-25: olly
#80 #635 https://sourceforge.net/p/swig/bugs/1139/
Add support for parsing common cases of `<` and `>` comparisons
in constant expressions. Adding full support for these seems hard
to do without introducing conflicts into the parser grammar, but in
fact all reported cases have had parentheses around the comparison
and we can support that with a few restrictions on the left side of
`<`.
2022-01-25: wsfulton
New warning 327 for extern templates, eg:
extern template class std::vector<int>;
extern template void Func<int>();
results in warning
example.i:3: Warning 327: Extern template ignored.
example.i:4: Warning 327: Extern template ignored.
Extern template classes previously resulted in warning 320.
2022-01-24: romintomasetti
#2131 #2157 C++11 extern function template parsing error fix.
2022-01-21: wsfulton
#2120 #2138 Replace legacy PCRE dependency with PCRE2.
This requires changes for building SWIG from source. See updated
html documentation in Preface.html and Windows.html. Updated
instructions are also shown when running ./configure if PCRE2 is not
found. Note that debian based systems can install PCRE2 using:
apt install libpcre2-dev
Note that https://github.com/swig/swig/wiki/Getting-Started also has
updated information for building from source.
2022-01-19: olly
[PHP] #2027 Automatically generate PHP type declarations for PHP 8.
The generate code still compiles for PHP 7.x, but without type
declarations since PHP 7.x has much more limited type declaration
support.
2022-01-18: olly
[Perl] #1629 Perl 5.8.0 is now the oldest version we aim to support.
2022-01-14: wsfulton
[Python] Fix %callback and specifying the callback function as a
static member function using Python staticmethod syntax, such as
Klass.memberfunction instead of Klass_memberfunction when using
-builtin and -fastproxy.
2022-01-11: wsfulton
[Python] Accept keyword arguments accessing static member functions when
using -builtin and kwargs feature and Python class staticmethod syntax.
The missing keyword argument support was only when using the
class staticmethod syntax, such as Klass.memberfunction, and not when
using the flat static method syntax, such as Klass_memberfunction.
2022-01-04: juierror
[Go] #2045 Add support for std::array in std_array.i.
2021-12-18: olly
[PHP] Add PHP keyword 'readonly' (added in 8.1) to the list SWIG
knows to automatically rename. This keyword is special in that PHP
allows it to be used as a function (or method) name.
2021-12-07: vstinner
[Python] #2116 Python 3.11 support: use Py_SET_TYPE()
2021-12-05: rwf1
[Octave] #2020 #1893 Add support for Octave 6 up to and including 6.4.
Also add support for compiling with -Bsymbolic which is used by default
by mkoctfile.
2021-12-02: jsenn
[Python] #2102 Fixed crashes when using embedded Python interpreters.
2021-11-12: wsfulton
[Javascript] v8 and node only. Fix mismatched new char[] and free()
when wrapping C code char arrays. Now calloc is now used instead of
new char[] in SWIG_AsCharPtrAndSize.
2021-10-03: ajrh1
[Perl] #2074: Avoid -Wmisleading-indentation in generated code
when using gcc11.
2021-10-03: jschueller
[CMake] #2065: Add option to enable or disable PCRE support.
2021-09-16: ianlancetaylor
[Go] Improved _cgo_panic implementation.
2021-09-16: ianlancetaylor
[Go] Don't use crosscall2 for panicking. Instead rely on documented
and exported interfaces.
2021-09-14: ianlancetaylor
[Go] Remove -no-cgo option (long unsupported in Go)
2021-05-04: olly
[PHP] #2014 Throw PHP exceptions instead of using PHP errors
PHP exceptions can be caught and handled if desired, but if they
aren't caught then PHP exits in much the same way as it does for a
PHP error.
In particular this means parameter type errors and some other cases
in SWIG-generated wrappers now throw a PHP exception, which matches
how PHP's native parameter handling deals with similar situations.
`SWIG_ErrorCode()`, `SWIG_ErrorMsg()`, `SWIG_FAIL()` and `goto thrown;`
are no longer supported (these are really all internal implementation
details and none are documented aside from brief mentions in CHANGES
for the first three). I wasn't able to find any uses in user interface
files at least in FOSS code via code search tools.
If you are using these:
Use `SWIG_PHP_Error(code,msg);` instead of `SWIG_ErrorCode(code);
SWIG_ErrorMsg(msg);` (which will throw a PHP exception in SWIG >= 4.1
and do the same as the individual calls in older SWIG).
`SWIG_FAIL();` and `goto thrown;` can typically be replaced with
`SWIG_fail;`. This will probably also work with older SWIG, but
please test with your wrappers if this is important to you.
*** POTENTIAL INCOMPATIBILITY ***
2021-05-17: adr26
[Python] #1985 Fix memory leaks:
1. Python object references were being incorrectly retained by
SwigPyClientData, causing swig_varlink_dealloc() never to run / free
memory. SwigPyClientData_New() / SwigPyClientData_Del() were updated
to fix the object reference counting, causing swig_varlink_dealloc()
to run and the memory swig_varlink owns to be freed.
2. SwigPyClientData itself was not freed by SwigPyClientData_Del(),
causing another heap leak. The required free() was added to
SwigPyClientData_Del()
3. Fix reference counting/leak of python cached type query
4. Fix reference counting/leak of SwigPyObject dict (-builtin)
5. Python object reference counting fixes for out-of-memory
scenarios were added to: SWIG_Python_RaiseOrModifyTypeError(),
SWIG_Python_AppendOutput(), SwigPyClientData_New(),
SwigPyObject_get___dict__() and SwigPyObject_format()
6. Add error handling for PyModule_AddObject() to
SWIG_Python_SetModule() (failure could be caused by OOM or a name
clash caused by malicious code)
2021-05-13: olly
[UFFI] #2009 Remove code for Common Lisp UFFI. We dropped support
for it in SWIG 4.0.0 and nobody has stepped forward to revive it in
over 2 years.
2021-05-13: olly
[S-EXP] #2009 Remove code for Common Lisp S-Exp. We dropped
support for it in SWIG 4.0.0 and nobody has stepped forward to
revive it in over 2 years.
2021-05-13: olly
[Pike] #2009 Remove code for Pike. We dropped support for it in
SWIG 4.0.0 and nobody has stepped forward to revive it in over 2
years.
2021-05-13: olly
[Modula3] #2009 Remove code for Modula3. We dropped support for it
in SWIG 4.0.0 and nobody has stepped forward to revive it in over 2
years.
2021-05-13: olly
[CLISP] #2009 Remove code for GNU Common Lisp. We dropped support
for it in SWIG 4.0.0 and nobody has stepped forward to revive it in
over 2 years.
2021-05-13: olly
[Chicken] #2009 Remove code for Chicken. We dropped support for it
in SWIG 4.0.0 and nobody has stepped forward to revive it in over 2
years.
2021-05-13: olly
[Allegrocl] #2009 Remove code for Allegro Common Lisp. We dropped
support for it in SWIG 4.0.0 and nobody has stepped forward to
revive it in over 2 years.
2021-05-04: olly
[PHP] #1982 #1457 https://sourceforge.net/p/swig/bugs/1339/
SWIG now only use PHP's C API to implement its wrappers, and no
longer generates PHP code to define classes. The wrappers should
be almost entirely compatible with those generated before, but
faster and without some previously hard-to-fix bugs.
The main notable difference is SWIG no longer generates a .php
wrapper at all by default (only if %pragma(php) code=... or
%pragma(php) include=... are specified in the interface file).
This also means you need to load the module via extension=...
in php.ini, rather than letting the dl() in the generated
.php wrapper load it (but dl() has only worked for command-line
PHP for some years now).
*** POTENTIAL INCOMPATIBILITY ***
2021-04-30: olly
#1984 Remove support for $source and $target.
These were officially deprecated in 2001, and attempts to use them have
resulted in a warning (including a pointer to what to update them to)
for most if not all of that time.
2021-04-27: wsfulton
#1987 [Java] Fix %interface family of macros for returning by const
pointer reference.
2021-04-19: olly
Fix use of uninitialised variable in the generated code for an
empty typecheck typemap, such as the dummy one we include for
std::initializer_list.
2021-04-12: olly
#1777 [Python] Specifying -py3 now generates a check for Python
version >= 3.0.
2021-03-26: olly
[PHP] Add PHP keywords 'fn' (added in 7.4) and 'match' (added in
8.0) to the list SWIG knows to automatically rename.
2021-03-23: wsfulton
#1942 [Python] Fix compilation error in wrappers when using -builtin
and wrapping varargs in constructors.
2021-03-22: goto40
#1977 Fix handling of template template parameters.
2021-03-21: olly
#1929, #1978 [PHP] Add support for PHP 8.
2021-03-19: wsfulton
#1610 Remove -ansi from default compilation flags.
2021-03-19: dot-asm
#1934 [Java] Clean up typemaps for long long arrays.
2021-03-19: olly
#1527 [PHP] Improve PHP object creation in directorin case.
Reportedly the code we were using in this case gave segfaults in
PHP 7.2 and later - we've been unable to reproduce these, but the
new approach is also simpler and should be bit faster too.
2021-03-18: olly
#1655 [PHP] Fix char* typecheck typemap to accept PHP Null like the
corresponding in typemap does.
2021-03-18: olly
#1900, #1905 [PHP] Fix wrapping of overloaded directed methods with
non-void return.
2021-03-11: murillo128
#1498 [Javascript] Support type conversion.
2021-03-06: nshmyrev
#872 [Javascript] Various typemap issues in arrays_javascript.i fixed.
2021-03-03: vaughamhong
#577 [Javascript] Implemented SetModule/GetModule for JSC to allow type sharing
across modules.
2021-03-01: xantares, Oliver Buchtala, geographika
#1040 Add support for building SWIG with CMake. See documentation in Windows.html.
2021-03-01: vadz
#1952 Fix incorrect warning "Unknown Doxygen command: ."
2021-02-28: p2k
#969 [Javascript] v8/node - prevent crash calling a constructor without new keyword.
2021-02-28: alecmev
#405 #1121 [Javascript] Fix OUTPUT typemaps on methods that don't return void.
The output value is appended to the return value.
2021-02-26: murillo128, wsfulton
#1269 [Javascript] Fix handling of large positive unsigned long and
unsigned long long values.
2021-02-24: tomleavy, yegorich, tungntpham
#1746 [Javascript] Add support for Node v12, v14 and v16.
SWIG support for Node is now for v6 and later only.
2020-02-09: ZackerySpytz
#1872 Fix typos in attribute2ref macros.
2020-10-10: wsfulton
[Javascript] Fix so that ccomplex.i interface to file can be used.
2020-10-10: wsfulton
#252 complex can now be used as a C identifier and doesn't give a syntax error.
2020-10-10: lpsinger
#1770 Correct C complex support.
_Complex is now parsed as a keyword rather than complex as per the C99 standard.
The complex macro is available in the ccomplex.i library file along with other
complex number handling provided by the complex.h header.
2020-10-07: ZackerySpytz
[Python] #1812 Fix the error handling for the PyObject_GetBuffer() calls in
pybuffer.i.
2020-10-07: treitmayr
#1824 Add missing space in director method declaration returning
const pointer.
2020-10-07: adelva1984
#1859 Remove all (two) exceptions from SWIG executable.
2020-09-25: wsfulton
[C#, Java] #1874 Add ability to change the modifiers for the interface
generated when using the %interface macros.
For C# use the 'csinterfacemodifiers' typemap.
For Java use the 'javainterfacemodifiers' typemap.
For example:
%typemap(csinterfacemodifiers) X "internal interface"
2020-09-24: geefr
[C#] #1868 Fix wchar_t* csvarout typemap for member variable wrappers.
2020-08-28: wsfulton
[Java] #1862 Fix crashes in swig_connect_director during director class construction
when using the director class from multiple threads - a race condition initialising
block scope static variables. The fix is guaranteed when using C++11, but most
compilers also fix it when using C++03/C++98.
2020-08-16: wsfulton
[Python] Add missing initializer for member '_heaptypeobject::ht_module' when using
-builtin to complete Python 3.9 support.
2020-08-16: wsfulton
[Python] Remove PyEval_InitThreads() call for Python 3.7 and later as Python calls
it automatically now. This removes a deprecation warning when using Python 3.9.
2020-08-15: wsfulton
[Python] All Python examples and tests are written to be Python 2 and Python 3
compatible, removing the need for 2to3 to run the examples or test-suite.
2020-08-13: wsfulton
[C#] Add support for void *VOID_INT_PTR for member variables.
2020-07-29: chrisburr
#1843 [Python] Compilation error fix in SwigPyBuiltin_SetMetaType when using PyPy.
2020-06-14: ZackerySpytz
#1642 #1809 Fix virtual comparison operators in director classes by removing an
incorrect space in the function name (for example, operator= = is now operator==).
Version 4.0.2 (8 Jun 2020)
==========================
2020-06-07 vigsterkr
[Ruby] #1717 Nil fix mangling strings
2020-06-07 vadz
#1748 Fix doxygen comments quoting issue
2020-06-07 munoah
#1800 Escape spaces in file paths for dependencies (-M -MM etc)
2020-06-06 andreas-schwab
[Ruby] #1801 Fix encoding on big endian systems when wrapping std::wstring.
2020-05-31 kwwette
[Octave] #1789 error handling improvements and return error code on exit for SWIG wrapped modules.
2020-05-30 msteinbeck
[D] #1593 Replace broken imports when using newer versions of D.
2020-05-29: ZackerySpytz
[Python] #1716 Performance improvements when converting strings when using Python >= 3.3.
2020-05-28: ZackerySpytz
#1776 Quite dramatically decrease run times when generating very large interface files by changing
some internal memory pool sizes.
2020-05-28: mcfarljm
#1788 Fix handling of Doxygen \endlink command.
2020-05-24: vapier
[Javascript] #1796 Fix pkg-config invocation in configure.
2020-04-30: kwwette
[Octave] Fix exception raising for newer Octave versions
Since (at least) Octave 5.1.0, the Octave error() function now raises a C++ exception,
which if uncaught immediately exits a SWIG wrapper function, bypassing any cleanup code
that may appear after a "fail:" label. This patch adds a "try { ... } catch(...) { }"
block around the contents of SWIG wrapper functions to first execute the cleanup code
before rethrowing any exception raised. It is backward compatible with earlier versions
of Octave where error() does not raise an exception, which will still branch to the
"fail:" block to execute cleanup code if an error is encountered.
Note that the new "try { ... } catch(...) { }" block will localise any local variables
used in typemaps that were NOT declared through SWIG's %typemap(...) syntax, so it's
possible this could break existing SWIG wrappers which were implicitly sharing local
variables between typemaps. This can be fixed, however, by declaring local variables
which need to be shared between typemaps through SWIG's %typemap(...) syntax.
2020-02-18: ryannevell
[Lua] #1728 Add support for LUA lightuserdata to SWIG_Lua_ConvertPtr.
2020-02-18: dmach
[Ruby] #1725 Fix gcc -Wcatch-value warnings.
2020-02-14: treitmayr
#1724 Fix wrapping of abstract user-defined conversion operators.
2020-02-13: ddurham2
[Python] #1512 Fix memleak when using STL containers of shared_ptr objects.
2020-02-06: wsfulton
[Python] #1673 #1674 Fix setting 'this' when extending a proxy class with __slots__.
2020-01-31: vadz
[Ruby] #1651 Add std::auto_ptr<> typemaps.
2020-01-31: ZackerySpytz
[Python] #1700 The Python C API functions PyBytes_AsStringAndSize() and
PyString_AsStringAndSize() are now checked for failure.
2020-01-31: vadz
[Python] #1710 Fix crash parsing empty docstrings.
2020-01-30: Alzathar
[R] #910 #914 Fix R memory leak on exception.
2020-01-30: richardbeare
[R] #1511 Fix bug wrapping functions. These were previously incorrectly wrapped as if
they were variables. This happened when 'get' or 'set' was in the name of the function
or method, but sometimes also in some other circumstances. If you were using R
attribute syntax to access these methods, you'll need to switch to calling them as R
methods.
*** POTENTIAL INCOMPATIBILITY ***
2020-01-24: etse-dignitas, wsfulton
[C#, D, Java] #1533 Fix upcasting for shared_ptr's of templated types.
2020-01-16: mcfarljm
#1643 #1654 When using -doxygen, fix segfault when nameless parameters or vararg parameters
are used.
2020-01-16: mcfarljm
#1632 #1659 Fix newline handling for doxygen "///" comments.
2020-01-14: mcfarljm
#1647 #1656 Fix crash handling empty doxygen comments.
2020-01-14: mcfarljm
#1608 Improve doxygen support.
- Add support for \param[] commands such as: \param[in].
- Optional arguments are marked as 'optional' in pydoc.
- Improve support for \code commands so that other languages are supported as code blocks.
Support added for java, c and py. For example Python: \code{.py} ... \endcode
- Fix doxygen handling of \em and \p tags for Python.
2020-01-13: wsfulton
[Python] #1595 Python -builtin constructors silently ignored keyword arguments.
Instead of silently ignoring them, now a "TypeError: f() takes no keyword arguments"
exception is thrown if keyword arguments are used. Hence constructors and normal methods/
functions behave in the same way. Note, -keyword should be used with -builtin to obtain
keyword argument support.
2020-01-05: jschueller shadchin
[Python] #1670 #1696 Add missing field initializers introduced in python 3.8:
tp_vectorcall and tp_print.
2020-01-05: friedrichatgc
[Octave] #1688 Change swig_this() to use size_t instead of long for compatibility
with Windows 64 bit.
2020-01-05: treitmayr
[Ruby] #1692 #1689 Add support for Ruby 2.7
2019-12-30: treitmayr
[Ruby] #1653 #1668 Fix code generated when using -globalmodule option.
2019-12-29: ZackerySpytz
[OCaml] #1686 Fix compilation errors with OCaml 4.09.0.
2019-12-10: wsfulton
#1679 Fix parsing of C++11 identifiers with special meaning (final and override) when
they are used as part of the scope name of an identifier, such as a namespace name.
2019-11-26: wsfulton
[C#] #1628 'out' or 'ref' used in a cstype typemap was not always stripped out in parts
of director code generation.
2019-11-01: wsfulton
[Python] #1595 Fix bug in support for keyword arguments (kwargs feature or -keyword)
when using -builtin. The fix is in the argument error checking when wrapping zero
argument constructors only.
Version 4.0.1 (21 Aug 2019)
===========================
2019-08-20: TekuConcept
[Javascript] #1535 Add %native support to Javascript.
2019-08-20: bkotzz
[Java] #1616 Add SWIG_JavaIllegalStateException to support throwing
java.lang.IllegalStateException from JNI code.
2019-08-19: sjml
[Lua] #1596 tostring output changes to show the underlying C/C++ pointer.
2019-08-08: rokups
[C#, Java] #1601 Fix invalid code generated for "%constant enum EnumType.
2019-08-07: wsfulton
[Python] Fix method overloading of methods that take STL containers of different
types. The following usage (using std::vector) would fail when using -builtin:
%include <std_string.i>
%include <std_vector.i>
%inline %{
struct X {};
%}
%template(VectorX) std::vector<X>;
%template(VectorInt) std::vector<int>;
%inline %{
using namespace std;
string VectorOverload(vector<X> v);
string VectorOverload(vector<int> v);
%}
The following would incorrectly fail:
s = VectorOverload([1, 2, 3])
With:
Traceback (most recent call last):
File "runme3.py", line 20, in <module>
ret = VectorOverload([1, 2, 3])
TypeError: Wrong number or type of arguments for overloaded function 'VectorOverload'.
Possible C/C++ prototypes are:
VectorOverload(std::vector< Number,std::allocator< Number > >)
VectorOverload(std::vector< int,std::allocator< int > >)
The problem was due to some error handling that was not cleared during typechecking.
In this case an error was not cleared when the elements in the list failed the
typecheck for converting to X. Only occurs in Python 3+.
In some combinations of overloaded methods, the following type of error message would
occur:
RuntimeError: in sequence element 0
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "runme3.py", line 23, in <module>
check(VectorOverload(v), "vector<X>")
SystemError: <built-in function VectorOverload> returned a result with an error set
2019-08-01: wsfulton
#1602 Fix regression in 4.0.0 where a template function containing a parameter
with the same name as the function name led to the parameter name used in the
target language being incorrectly modified.
2019-07-29: wsfulton
Remove all generated files on error. Previously generated files were not removed,
potentially breaking Makefiles using file dependencies, especially when -Werror
(warnings as errors) was used.
2019-07-23: smithx
[C#] #1530 #1532 Fix marshalling of std::wstring to C#.
2019-07-18: gicmo
[Python] #1587 Python 3.8 support - remove use of deprecated PyObject_GC_UnTrack.
2019-07-18: cher-nov
[Python] #1573 Generated Python code uses consistent string quoting style - double
quotes.
2019-07-16: geefr
[C#] #616 #1576 Fix C# bool INPUT[], bool OUTPUT[], bool INOUT[] typemaps to marshall
as 1-byte.
2019-07-12: vadz
[C#, Java] #1568 #1583 Fix std::set<> typemaps for primitive types.
2019-07-12: vadz
#1566 #1584 Regression in 4.0.0 - fix missing value for first item of enums with
trailing comma.
2019-07-11: mcfarljm
#1548 #1578 Fix segfault in Doxygen parser parsing empty lines in some commands like
\code.
2019-07-09: IsaacPascual
[C#, Java] #1570 Fix name of generated C#/Java classes for %interface macros
in swiginterface.i when wrapping nested C++ classes.
2019-07-05: wsfulton
[Python] #1547 Whitespace fixes in Doxygen translated comments into pydoc comments
for Sphinx compatibility.
2019-06-28: wsfulton
[MzScheme, OCaml] #1559 $arg and $input were incorrectly substituted in the
argout typemap when two or more arguments were present.
2019-06-24: wsfulton
[Python, Ruby] #1538 Remove the UnknownExceptionHandler class in order to be
C++17 compliant as it uses std::unexpected_handler which was removed in C++17.
This class was intended for director exception handling but was never used by
SWIG and was never documented.
*** POTENTIAL INCOMPATIBILITY ***
2019-06-06: bkotzz
[Java] #1552 Improve performance in Java std::vector constructor wrapper that takes
a native Java array as input.
2019-06-03: olly
[Python] Fix regression in implicit_conv handling of tuples,
introduced in SWIG 4.0.0. Fixes #1553, reported by Alexandre
Duret-Lutz.
2019-05-24: wsfulton
[Octave] Fix detection of Octave on MacOS.
2019-05-24: opoplawski
[Octave] #1522 Adapt OCTAVE_LDFLAGS for Octave 5.1.
2019-05-22: ferdynator
[PHP] #1528 Don't add a closing '?>' PHP tag to generated files.
PSR-2 says it MUST be omitted for files containing only PHP.
Version 4.0.0 (27 Apr 2019)
===========================
2019-04-24: vadz
#1517 Fix crash if "@return" Doxygen tag was used on a node without any return type.
2019-04-24: vadz
#1515 Fix parsing of enums with trailing comma when using -doxygen.
2019-04-19: ianlancetaylor
[Go] #1055 When generating Go code, make -cgo the default. Add new -no-cgo option
to disable the default.
2019-04-19: pbecherer
[Tcl] #1508 Fix Visual Studio 2015 and later compilation errors due to snprintf macro
definition.
2019-04-09: wsfulton
[C#] Fix FxCop warning CA2002 in SWIGPendingException - a lock on a reference of
type 'Type'.
2019-03-30: wsfulton
[Java, D] Add the parameters typemap attribute to the javadestruct,
javadestruct_derived, ddispose, ddispose_derived typemaps to mirror enhanced
flexibility in the csdisposing and csdisposing_derived (C#) typemaps. If provided
the contents are generated as the delete/dispose method's parameters declaration.
2019-03-30: wsfulton
[C#] #421 Fix FxCop warning CA1063 by implementing the recommended Dispose methods for
the IDisposable interface. Previously just the Dispose() method was generated.
Now the Dispose() and Dispose(bool disposing) methods are generated.
Changes are required if custom "csfinalize", "csdestruct" or "csdestruct_derived"
typemaps are being used. Details in #421 on Github. SWIG will error out if one of
the "csfinalize, "csdestruct" or "csdestruct_derived" typemaps are found. Example
error message:
foo.h:60: Error: A deprecated csfinalize typemap was found for Foo, please remove
it and replace all csdestruct, csdestruct_derived and csfinalize typemaps by the
csdispose, csdispose_derived, csdisposing and csdisposing_derived typemaps.
*** POTENTIAL INCOMPATIBILITY ***
2019-03-25: Liryna
[C#] #1143 Add std_list.i for std::list support.
The C# std::list<T> wrappers are made to look and feel like a C#
System.Collections.Generic.LinkedList<> collection.
The IEnumerable<> interface is implemented in the proxy class.
The ICollection<> interface can also be implemented to provide enhanced functionality
whenever a C++ operator== is available. This is the case for when T is a
primitive type or a pointer. If T does define an operator==, then use the
SWIG_STD_LIST_ENHANCED macro to obtain this enhanced functionality, for example:
SWIG_STD_LIST_ENHANCED(SomeNamespace::Klass)
%template(ListKlass) std::list<SomeNamespace::Klass>;
2019-03-18: richardbeare
[R] #1328 Non-trivial enums are working now. The enum values are now obtained from
the C/C++ layer. const reference enums and C++11 enum classes are also now working.
2019-03-14: mochizk
[Javascript] #1500 Fix compilation errors due to deprecating V8 API in Node.js.
New V8 API is used if node.js >= v10.12, or if V8 >= v7.0.
2019-03-12: vadz
[C#] #1495 Add std_set.i for std::set support.
2019-03-11: dirteat,opoplawski
[Octave] Fix compilation errors in Octave 5.1.
error: format not a string literal and no format arguments [-Werror=format-security]
2019-02-28: wsfulton
[Java] std::vector improvements for types that do not have a default constructor.
The std::vector wrappers have been changed to work by default for elements that are
not default insertable, i.e. have no default constructor. This has been achieved by
not wrapping:
vector(size_type n);
Previously the above had to be ignored via %ignore.
If the above constructor is still required it can be added back in again via %extend:
%extend std::vector {
vector(size_type count) { return new std::vector< T >(count); }
}
Alternatively, the following wrapped constructor could be used as it provides near-enough
equivalent functionality:
vector(jint count, const value_type& value);
*** POTENTIAL INCOMPATIBILITY ***
2019-02-25: wsfulton
[Python] Fix compile errors wrapping overloaded functions/constructors where a vararg
function is declared after a non-vararg function.
2019-02-23: zphensley42
Use fully qualified name 'java.lang.Object' instead of 'Object' in generated code to
avoid clashes with wrapped C++ classes called 'Object'.
2019-02-23: gtbX
[Java] #1035 Add (const char *STRING, size_t LENGTH) typemaps in addition to the non-const
typemaps (char *STRING, size_t LENGTH) which does not attempt to write back to the const
string.
2019-02-22: tamuratak
[Ruby] #984 Add support for RTypedData introduced in Ruby 1.9.3.
2019-02-22: ZackerySpytz
#1483 Fix compilation failures when a director class has final methods.
2019-02-21: wsfulton
[Java] #1240 Suppress Java 9 deprecation warnings on finalize method.
2019-02-21: ZackerySpytz
#1480 Fix some rejections of valid floating-point literals.
2019-02-19: wsfulton
#1475 Fix regression parsing gcc preprocessor linemarkers in the form:
# linenum filename flags
2019-02-18: jakecobb
[Python] #945 #1234 Elements in std::vector memory access fix.
Accessing an element in a std::vector obtains a reference to the element via an
iterator pointing to the element in the container. If the vector is garbage collected,
the SWIG wrapper containing the pointer to the element becomes invalid. The fix is
to obtain a back-reference to the container by the wrapper to the element in the Python
layer to prevent the garbage collector from destroying the underlying container.
2019-02-17: wsfulton
Fix typemap matching to expand template parameters when the name contains
template parameters. In the %typemap below the type is T and the name is X<T>::make
and the name now expands correctly to X< int >::make
template<typename T> struct X {
%typemap(out) T X<T>::make "..."
T make();
};
%template(Xint) X<int>;
2019-02-16: wsfulton
Fix parser error containing multiple #define statements inside an enum.
The second #define fails to parse:
enum FooEnum {
ENUM1 = 0,
ENUM2 = 1,
#define MACRO_DEF1 "Hello"
#define MACRO_DEF2 "World!"
ENUM3 = 2,
ENUM4 = 3,
};
Bug mentioned at https://sourceforge.net/p/swig/patches/333/
2019-02-14: wsfulton
Add some missing copy constructors into STL containers.
2019-02-14: bkotzz
[Java] #1356 Add STL containers:
std::unordered_map
std::unordered_set
std::set
2019-02-14: bkotzz
[Java] #1356 std::map wrappers have been modified. Now the Java proxy class
extends java.util.AbstractMap. The std::map container looks and feels much like
a java.util.HashMap from Java.
A few members have changed their names. If the old method signatures are needed,
then copy std_map.i from swig-3.0.12 and use that instead. Alternatively,
add the old missing methods to the new methods by using the following %proxycode:
%extend std::map {
%proxycode %{
// Old API
public boolean empty() {
return isEmpty();
}
public void set($typemap(jboxtype, K) key, $typemap(jboxtype, T) x) {
put(key, x);
}
public void del($typemap(jboxtype, K) key) {
remove(key);
}
public boolean has_key($typemap(jboxtype, K) key) {
return containsKey(key);
}
%}
}
*** POTENTIAL INCOMPATIBILITY ***
2019-02-13: ZackerySpytz
#1469 Add support for C++17 hexadecimal floating literals.
2019-02-11: wsfulton
[OCaml] #1437 OCaml has been give the 'Experimental' language status. The examples work
and most of the test-suite is also working, so it is quite close to being a 'Supported' language.
2019-02-10: ZackerySpytz
#1464 Add support for C++14 binary integer literals.
2019-02-10: ZackerySpytz
#1450 Add support for C++11 UCS-2 and UCS-4 character literals. Also, add support for
C++17 UTF-8 character literals.
2019-02-10: wsfulton
[MzScheme] #1437 MzScheme/Racket is now an 'Experimental' language. The examples work
and a large portion of the test-suite is also working.
2019-02-10: wsfulton
[MzScheme] Destructor wrappers were not being generated.
2019-02-10: wsfulton
[MzScheme] Static variable wrappers fixed - $argnum was not expanded.
2019-02-10: sethrj
#1452 Fix %apply for anonymous template instantiations
2019-02-09: olly
[PHP] Fix access to already released memory during PHP module
shutdown, which often didn't cause visible problems, but could
result in segmentation faults, bus errors, etc. Fixes #1170,
reported by Jitka Plesníková.
2019-02-09: olly
[PHP] A renamed constructor is now wrapped as a static method in
PHP.
2019-02-08: olly
[PHP] Don't generate code which references $r when $r hasn't been
defined. This could happen in overloaded methods which returned
void and took at least one const std::string& parameter.
2019-02-08: olly
[PHP] The generated code is now compatible with PHP 7.3, and the
testsuite now runs cleanly with this version too.
2019-02-05: wsfulton
#1437 SWIG now classifies the status of target languages into either 'Experimental' or
'Supported'. This status is provided to indicate the level of maturity to expect when using
a particular target language as not all target languages are fully developed. Details are
in the Introduction.html chapter of the documentation.
2019-02-04: wsfulton
[CFFI] #1447 Common Lisp CFFI has been disabled as a target language in SWIG as part of a
clean up to remove target languages that have been neglected/not functional.
2019-02-04: wsfulton
[Allegrocl] #1447 Allegro Common Lisp has been disabled as a target language in SWIG as part of a
clean up to remove target languages that have been neglected/not functional.
2019-02-04: wsfulton
[Chicken] #1447 CHICKEN has been disabled as a target language in SWIG as part of a
clean up to remove target languages that have been neglected/not functional.
2019-02-04: wsfulton
[CLISP] #1447 GNU Common Lisp has been disabled as a target language in SWIG as part of a
clean up to remove target languages that have been neglected/not functional.
2019-02-04: wsfulton
[S-EXP] #1447 Common Lisp S-Exp has been disabled as a target language in SWIG as part of a
clean up to remove target languages that have been neglected/not functional.
2019-02-04: wsfulton
[UFFI] #1447 Common Lisp UFFI has been disabled as a target language in SWIG as part of a
clean up to remove target languages that have been neglected/not functional.
2019-02-04: wsfulton
[Pike] #1447 Pike has been disabled as a target language in SWIG as part of a
clean up to remove target languages that have been neglected/not functional.
2019-02-04: wsfulton
[Modula3] #1447 Modula3 has been disabled as a target language in SWIG as part of a
clean up to remove target languages that have been neglected/not functional.
2019-02-02: ahnolds
[Python] Documentation enhancements for Python:
#728 Fixed the handling of autodoc when using -fastproxy.
#1367 Added documentation to wrapped member variables using the
property(... doc="...") construct.
Only show a single documentation entry for functions with default arguments when
using autodoc.
Fixed a bug where a cached doxygen docstring could be deleted while still in use,
causing swig to segfault.
2019-01-31: olly
SWIG now requires a target language to be specified instead of
defaulting to wrapping for Tcl. Specifying swig --help without
a target language now just shows the generic help. The -nolang
option has been removed.
2019-01-28: ZackerySpytz
[OCaml] #1429 Remove support for OCaml versions < 3.12.0.
*** POTENTIAL INCOMPATIBILITY ***
2019-01-22: vadz
[Ruby, Octave] #1424 Improve autodoc parameter naming.
2019-01-22: vadz
[Python] #1271 #1423 Always include default parameter values in autodoc strings.
2019-01-19: vadz
#1272, #1421 When a function's parameter is a keyword, the name of the paramater is
no longer simply changed to argN, where N is the argument number. Instead the
parameter name is changed to the renaming rules for keywords that normally apply to
symbols such as classes/functions etc. Note that unlike other symbol renaming,
parameter renaming does not issue a warning when the parameter is renamed. This
change only affects languages where the parameter names are actually used, for example,
Java function parameter lists in the proxy class or Python documentation comments.
2019-01-18: wsfulton
#1420 Fix gdb debugger functions 'swigprint' and 'locswigprint' from swig.gdb to
work with newer versions of gdb-8. Fixes errors when debugging SWIG source with gdb:
(gdb) swigprint n
Undefined command: "Printf". Try "help".
2019-01-16: wsfulton
Python static method wrapper changes
- Static method wrappers were using the 'fastproxy' approach by default.
This is inconsistent with instance method wrappers. The fastproxy approach
is now turned off by default to be consistent with instance methods.
Static method wrappers can now also be controlled using the -fastproxy and
-olddefs options.
Example:
struct Klass {
static int statmethod(int a = 2);
};
generates by default:
class Klass(object):
...
@staticmethod
def statmethod(a=2):
return _example.Klass_statmethod(a)
instead of the following (which can be restored by using -fastproxy):
class Klass(object):
...
statmethod = staticmethod(_example.Klass_statmethod)
- Modernise wrappers for static methods to use decorator syntax - @staticmethod.
- Add missing runtime test for static class methods and using the actual class method.
2019-01-12: ZackerySpytz
[OCaml] #1403 #1194 Fix compilation problems for OCaml >= 4.03.0 due to OCaml using
int64_t instead of int64.
2019-01-11: ZackerySpytz
[OCaml] #1400 Fix the getters and setters of non-static member variables.
2019-01-07: wsfulton
#358 Add VOID to windows.i
2019-01-05: wsfulton
#948 #1019 #1273 Fix for C++11 raw strings where the delimiters were mistakenly left
in the string contents in situations where the string was copied into generated code.
For example, %constant, the "docstring" feature and for C#/Java/D constants turned on
with %javaconst/%csconst/%dmanifestconst.
2019-01-05: wsfulton
[Ruby] #538. Fix Ruby support for %feature("docstring").
2019-01-03: wsfulton
#1202 Fix overloading of non-pointer class types in scripting languages when overloaded
with a pointer and a NULL scripting language equivalent is used, eg None in Python.
The implementation changes the SWIGTYPE, SWIGTYPE& and SWIGTYPE&& typecheck typemaps to
prevent accepting a conversion to a NULL pointer.
2019-01-03: ZackerySpytz
[OCaml] #1386 Fix the OCaml examples and test suite for out-of-source builds.
2019-01-01: wsfulton
[Python] #639 remove duplicate proxy method definitions for global function wrappers.
Global functions previously generated two definitions, eg:
def foo():
return _example.foo()
foo = _example.foo
The first definition is replaced by the second definition and so the second definition
is the one used when the method is actually called. Now just the first definition is
generated by default and if the -fastproxy command line option is used, just the second
definition is generated. The second definition is faster as it avoids the proxy Python
method as it calls the low-level C wrapper directly. Using both -fastproxy and -olddefs
command line options will restore the previously generated code as it will generate both
method definitions.
With this change, the wrappers for global C/C++ functions and C++ class methods now work
in the same way wrt to generating just a proxy method by default and control via
-fastproxy/-olddefs options.
2018-12-20: hasinoff,wsfulton
[Java] #1334 Set Java thread name to native thread name when using directors.
Default is to use name "Thread-XXX" and is still works like this by default. However,
adding the following will turn on the thread name setting (works for more recent
versions of Linux and MacOS):
%begin %{
#define SWIG_JAVA_USE_THREAD_NAME
%}
2018-12-20: chlandsi
[Python] #1357. Fix overriding __new__ in Python 3.6.
Fixes SystemError: Objects/tupleobject.c:81: bad argument to internal function"
2018-12-16: wsfulton
[Python] #848 #1343 The module import logic has changed to stop obfuscating real ImportError
problems. Only one import of the low-level C/C++ module from the pure Python module is
attempted now. Previously a second import of the low-level C/C++ module was attempted
after an ImportError occurred and was done to support 'split modules'. A 'split module' is
a configuration where the pure Python module is a module within a Python package and the
low-level C/C++ module is a global Python module. Now a 'split module' configuration is
no longer supported by default. This configuration can be supported with a simple
customization, such as:
%module(package="mypackage", moduleimport="import $module") foo
or if using -builtin:
%module(package="mypackage", moduleimport="from $module import *") foo
instead of
%module(package="mypackage") foo
See the updated Python chapter titled "Location of modules" in the documentation.
2018-12-11: tlby
[Perl] #1374 repair EXTEND() handling in typemaps
2018-12-06: vadz
#1359 #1364 Add missing nested class destructor wrapper when the nested class is
inside a template. Removes associated bogus 'Illegal destructor name' warning. Only
occurred when the nested class' destructor is explicitly specified.
2018-12-04: adr26
[Python] #1368 #1369 Access Violation in tp_print caused by mismatched Python/extension
CRT usage
Remove all use of tp_print, as this API uses a FILE*, which can be
mismatched when modules are built with different C libraries from
the main python executable.
This change also brings consistent output between Python 2 and 3 for the 'cvar' SWIG
object (that contains the global variables) and SWIG packed objects (such as callback
constants).
2018-12-04: wsfulton
[Python] #1282 Fix running 'python -m' when using 'swig -builtin'
Similar to the earlier PEP 366 conforming fix for non-builtin.
2018-11-29: adr26
[Python] #1360 Leak of SWIG var link object
Fix reference counting on _SWIG_globals to allow var link to be freed on module unload.
2018-11-28: wsfulton
[Python] When using -builtin, the two step C-extension module import is now
one step and the wrapped API is only available once and not in an underlying
module attribute like it is without -builtin. To understand this, consider a
module named 'example' (using: %module example). The C-extension is compiled into
a Python module called '_example' and a pure Python module provides the actual
API from the module called 'example'. It was previously possible to additionally
access the API from the module attribute 'example._example'. The latter was an
implementation detail and is no longer available. It shouldn't have been used, but
if necessary it can be resurrected using the moduleimport attribute described in the
Python chapter of the documentation. If both modules are provided in a Python
package, try:
%module(moduleimport="from . import _example\nfrom ._example import *") example
or more generically:
%module(moduleimport="from . import $module\nfrom .$module import *") example
and if both are provided as global modules, try:
%module(moduleimport="import _example\nfrom _example import *") example
or more generically:
%module(moduleimport="import $module\nfrom $module import *") example
The module import code shown will appear in the example.py file.
2018-11-24: vadz
#1358 Fix handling of abstract base classes nested inside templates
Correct detecting of whether a derived class method overrides a pure virtual
base class method when both classes are nested inside a template class: this
notably didn't work correctly for methods taking parameters of the base class
type.
2018-11-22: rupertnash
[Python] #1282 Make generated module runnable via python -m (PEP 366 conforming)
Previously any SWIG generated modules in a package would fail with an ImportError
when using 'python -m' for example 'python -m mypkg.mymodule'.
This fix also allows the SWIG generated module to be placed into a directory and
then renamed __init__.py to convert the module into a package again. This ability
stopped working in swig-3.0.9. However, only Python 2.7 or 3.3 and later work. If
Python 3.2 support is needed, use moduleimport in %module to customise the import
code.
2018-11-13: wsfulton
#1340 Remove -cppcast and -nocppcast command line options (this was an option
available to the scripting language targets).
The -cppcast option is still turned on by default. The -nocppcast option
to turn off the use of c++ casts (const_cast, static_cast etc) has been
removed. However, defining SWIG_NO_CPLUSPLUS_CAST will still generate C casts
instead of C++ casts for C++ wrappers.
*** POTENTIAL INCOMPATIBILITY ***
2018-11-13: wsfulton
[Python] #1340 Remove -outputtuple and -nooutputtuple command line options.
Both the command line and %module options of the same name have been
removed. These were undocumented. The -outputtuple option returned a
Python tuple instead of a list, mostly typically in the OUTPUT
typemap implementations.
It unclear why a tuple instead of a list return type is needed and
hence this option has been removed as part of the simplification of
the SWIG Python command line options for SWIG 4.
2018-11-13: wsfulton
[Python] #1340 Remove -noproxyimport command line option.
This option turned off the insertion of Python import statements
derived from a %import directive. For example given:
%module module_b
%import "module_a.i"
then module_b.py will contain:
import module_a
*** POTENTIAL INCOMPATIBILITY ***
2018-10-29: AlexanderGabriel
[PHP] The following PHP7 reserved keywords are now only renamed by
SWIG when used as function names in the API being wrapper:
__halt_compiler array die echo empty eval exit include include_once
isset list print require require_once return unset
2018-10-22: olly,wsfulton
[Python] #1261 #1340 Turn on many optimisation options by default and rationalise the
number of command line options.
There were an unnecessary number of command line options and many of these have now
been removed in a drive for simplification. Some were needed to support older versions
of Python (2.6 and earlier).
Many of the options could be turned on individually and when using -O. Previously -O
resulted in turning on a set of options:
-modern -fastdispatch -nosafecstrings -fvirtual -noproxydel
-fastproxy -fastinit -fastunpack -fastquery -modernargs -nobuildnone
Now -O results in turning on this reduced set:
-fastdispatch -fastproxy -fvirtual
The following options are now on by default, a deprecated warning is displayed if they
are used:
-fastinit Class initialisation code done in C/C++ rather than in Python code.
-fastquery Python dictionary used for lookup of types.
-fastunpack Faster unpacking of function arguments in C/C++ wrappers.
-modern Use Python 2.3 features such as object and property.
-modernargs Use Python 2.3 C APIs for unpacking arguments in tuples.
-noproxydel Stop generating a proxy __del__ method for backwards compatiblity.
-safecstrings No discernable difference
The following options have been removed altogether:
-aliasobj0
-buildnone
-classptr
-new_repr
-newrepr
-noaliasobj0
-nobuildnone
-nocastmode
-nodirvtable
-noextranative
-nofastinit
-nofastproxy
-nofastquery
-nomodern
-nomodernargs
-nooutputtuple
-nosafecstrings
-old_repr
-oldrepr
-proxydel
-new_vwm is no longer supported. Use the -newvwm alias instead.
*** POTENTIAL INCOMPATIBILITY ***
2018-10-22: olly
[Python] #1261 Remove command line option no longer needed as Python 2.3 and earlier
are no longer supported:
-classic
2018-10-09: wsfulton
[D, Go, Guile, Lua, Mzscheme, Ocaml, Perl5, Php, Scilab, Tcl]
Allow wrapping of std::map using non-default comparison function.
2018-10-09: vadz
[Java] #1274 Allow wrapping of std::map using non-default comparison function.
2018-10-04: wsfulton
[Python] #1126 Fix C default arguments with -builtin and -fastunpack and -modernargs.
Problem occurred when there is just one (defaulted) parameter in the parameter list.
2018-09-24: wsfulton
[Python] #1319 C++11 hash tables implementation is finished now (including for -builtin):
std::unordered_map
std::unordered_set
std::unordered_multimap
std::unordered_multiset
2018-09-21: wsfulton
[Python] Fix when using -builtin and wrapping std::map, std::set, std::unordered_map or
std::unordered_set to ensure __contains__ is called. This is a wrapper for the STL
container's find method. Without it, Python will do its own slower sequence search.
2018-09-19: wsfulton
[Python] Fix functors (wrapped as __call__) when using -builtin -modern -fastunpack.
2018-09-02: andreas.gaeer,tkrasnukha
[Python] #1321 Fix assert in PyTuple_GET_SIZE in debug interpreter builds of python-3.7
when calling tp_new.
2018-09-01: ChristopherHogan
[Guile] #1288 Fix garbage collection for guile >= 2.0.12.
2018-08-31: wsfulton
[Python] #1319 C++11 hash tables support:
std::unordered_map
std::unordered_set
std::unordered_multimap
std::unordered_multiset
is now compiling and working (sorting using -builtin not fully functional yet though).
2018-08-20: wkalinin
#1305 Fix nested structure symbol tables in C mode to fix member name conflicts
in different structs with the same nested struct member name.
2018-08-18: wsfulton
[Python] #688 Fix makefile recursion when running python test-suite.
2018-08-18: wsfulton
[Python] #1310 Re-implement Python -fastproxy option.
The previous implementation failed with Python 3 and abstract base clases.
The new implementation replaces the Python 2 implementation using
new.instancemethod with the C API PyMethod_New to match the equivalent Python 3
implementation which uses PyInstanceMethod_New.
The new approach runs slightly faster. See #1310.
2018-08-12: gmazzamuto
[Python] #1283 Update pybuffer.i library to use new-style Python buffer C API.
2018-08-12: brianhatwood,wsfulton
[Java] #1303 #1304 Fix crash in directors when using OUTPUT and INOUT typemaps in typemaps.i and
passing NULL pointers in C++ to director method overloaded and implemented in Java.
2018-08-10: wsfulton
[Python] #1293 Improve TypeError message inconsistencies between default and fastdispatch
mode when handling overloaded C++ functions. Previously the error message did not always
display the possible C/C++ prototypes in fastdispatch mode.
2018-08-02: furylynx,jacobwgillespie,p2k
[Javascript] #1290, #968. Add support for NodeJS versions 2-10.
2018-07-31: wsfulton
[Python] #1293 Overloaded C++ function wrappers now raise a TypeError instead
of NotImplementedError when the types passed are incorrect. This change means
there is now consistency with non-overloaded function wrappers which have always
raised TypeError when the incorrect types are passed. The error message remains
the same and is for example now:
TypeError: Wrong number or type of arguments for overloaded function 'f'.
Possible C/C++ prototypes are:
f(int)
f(char const *)
instead of:
NotImplementedError: Wrong number or type of arguments for overloaded function 'f'.
Possible C/C++ prototypes are:
f(int)
f(char const *)
*** POTENTIAL INCOMPATIBILITY ***
2018-06-23: wsfulton
[Python] #718 Fix pythonnondynamic feature for modern classes
Fixes nondynamic mode when an instance variable is set with the same
name as a class variable in a class derived from a SWIG proxy class.
This corner case set an instance variable instead of raising an AttributeError.
Also fix %pythonnondynamic in Python 3 with -modern. The metaclass
containing the implementation was previously not being applied in Python 3.
2018-07-17: petrmitrichev,wsfulton
[Python] #1275 #1279 Initialize function-local statics (singletons) that call Python
code during Python module initialization in order to avoid deadlocks with subsequent
multi-threaded usage.
2018-06-15: wsfulton
[Python] Fix seg fault using Python 2 when passing a Python string, containing
invalid utf-8 content, to a wstring or wchar * parameter. A TypeError is thrown instead, eg:
%include <std_wstring.i>
void instring(const std::wstring& s);
instring(b"h\xe9llooo") # Python
2018-06-15: wsfulton
[Python] Python 3.7 support: Replace use of deprecated PyUnicode_GetSize with
PyUnicode_GetLength to remove deprecated warnings compiling the C/C++ wrappers.
2018-06-12: wsfulton
[Python] Python 3.7 support: The %pythonabc feature in pyabc.i now uses base classes
collections.abc.MutableSequence
collections.abc.MutableMapping
collections.abc.MutableSet
instead of
collections.MutableSequence
collections.MutableMapping
collections.MutableSet
as the latter are deprecated in Python 3.7 and are due to be removed in Python 3.8.
The classes in collections.abc.* are available from Python 3.3 onwards. If you
require support for Python 3.2, then copy the pyabc.i file and modify by removing
the few instances of the .abc sub-module.
*** POTENTIAL INCOMPATIBILITY ***
2018-06-12: olly,wsfulton
[Python] #701 Remove support for Python versions < 2.7 and 3.0 and 3.1.
*** POTENTIAL INCOMPATIBILITY ***
2018-06-11: olly
[Python] Fix new GCC8 warnings in generated code by avoiding casts
between incompatible function types where possible, and by
suppressing the warning when it's due to the design of Python's C
API. Fixes #1259.
2018-06-08: philippkraft
[Python] Stop exposing <CLASS>_swigregister to Python. It's not
useful for user Python code to call this, and it just clutters the
API unnecessarily. Fixes #1225.
2018-06-07: cmfoil, kabbi, Jamie Kirkpatrick, markok314, vadz, wsfulton, Yann Diorcet
#170 Doxygen documentation support added. This allows translation of Doxygen comments
into JavaDoc and PyDoc documentation. It is enabled via the -doxygen command line
option. See the Doxygen.html chapter in the documentation for further information.
2018-06-07: olly
[PHP] We've finally removed support for %pragma(php4) which was
deprecated back in 2008. Use %pragma(php) instead, which has been
supported since at least 2005.
*** POTENTIAL INCOMPATIBILITY ***
2018-06-07: olly
[PHP5] Support for PHP5 has been removed. PHP5 is no longer
actively supported by the PHP developers and security support for
it ends completely at the end of 2018, so it doesn't make sense
to include support for it in the upcoming SWIG 4.0.0 release.
*** POTENTIAL INCOMPATIBILITY ***
2018-06-06: olly
[Lua] Improve configure probes for Lua headers and libs used in testsuite.
2018-05-15: kwwette
[Octave] add support for version 4.4
- Should not introduce any user-visible incompatibilities
2018-05-15: wsfulton
[C#, D, Java] Fix lookup of csconstruct, dconstruct and javaconstruct typemaps.
The C++ namespace was previously ignored when looking up the typemap.
2018-05-15: wsfulton
[Javascript] Fix generated C++ code when using %nspace on namespaces that are more
than two levels deep.
2018-05-14: wsfulton
Issue #1251 Add support for C++17 nested namespace definitions,
for example:
namespace A::B { ... }
2018-05-11: wsfulton
[C#, D, Java] Add support so that the %csmethodmodifiers, %dmethodmodifiers,
%javamethodmodifiers can modify the method modifiers for the destructor wrappers
in the proxy class: dispose, Dispose, delete. With this feature, it is now possible
to make a C# proxy class sealed, eg when wrapping a class X, the virtual method modifiers
can be removed using:
%typemap(csclassmodifiers) X "public sealed class"
%csmethodmodifiers X::~X "public /*virtual*/";
2018-04-18: olly
[Python] Suppress new pycodestyle warning:
E252 missing whitespace around parameter equals
2018-04-07: goatshriek
[Ruby] #1213 Fix ruby %alias directive for global C/C++ functions.
2018-04-03: olly
[Ruby] Fix to pass Qnil instead of NULL to rb_funcall(), which silences GCC
-Wconversion-null warning (on by default with recent GCC).
2018-03-09: wsfulton
[Java] #1184 Fix swigReleaseOwnership() and swigTakeOwnership() regression
for non-director classes. Restores a dynamic_cast which was previously removed.
2018-03-07: llongi
Github PR #1166 - Fix preprocessor handling of macros with commas
in a // comment.
2018-02-18: JPEWdev
Patch #1164 - Add support for a command-line options file, also sometimes
called a response file. This is useful if the command-line options exceed
the system command-line length limit. To use, put the command-line options
into a file, then provide the file name prefixed with @, for example using
a file called args.txt:
swig @args.txt
2018-02-11: wsfulton
[Javascript] #1187 Fix compilation error wrapping std::complex via
std_complex.i.
2018-01-30: smarchetto
[Scilab] add type name argument in SWIG_ptr() function to cast from pointer address to typed pointers
2018-01-16: wsfulton
Expressions following a preprocessor directive must now be separated by whitespace
or non-numeric characters. This syntax change makes the SWIG preprocessor work like
the C preprocessor in this area.
For example, the following code used be accepted as valid syntax:
#if1
#define ABC 123
#endif
Now you get an error:
example.h:1: Error: Unknown SWIG preprocessor directive: if1 (if this is a block of
target language code, delimit it with %{ and %})
example.h:3: Error: Extraneous #endif.
The following is the correct syntax:
#if 1
#define ABC 123
#endif
The following of course also works:
#if(1)
#define ABC 123
#endif
*** POTENTIAL INCOMPATIBILITY ***
2018-01-15: wsfulton
Fix issue #1183. Floating point exception evaluating preprocessor expressions
resulting in division by zero.
2018-01-14: wsfulton
Fix issue #1172. Seg fault parsing invalid exponents in the preprocessor.
2018-01-12: Liryna
[C#] Patch #1128. Add ToArray function to std::vector wrappers.
2018-01-12: wsfulton
[Java] Fix issue #1156. Add missing throws clause for interfaces when using the
%interface family of macros.
2018-01-05: wsfulton
Fix default arguments using expressions containing -> syntax error. Problem reported on
swig-user mailing list.
2017-12-30: wsfulton
[Python] Replace pep8 with pycodestyle for checking the Python code style when
running Python tests.
2017-12-30: davedissian
Fixed a symbol lookup issue when encountering a typedef of a symbol from the tag
namespace to the global namespace when the names are identical, such as 'typedef
struct Foo Foo;'.
2017-12-13: wsfulton
[Perl] add missing support for directorfree typemaps.
2017-12-13: wsfulton
Issue #1167 Fix directorout typemaps which were causing undefined behaviour when
returning pointers by reference.
2017-12-08: olly
[PHP] Use ZEND_MODULE_GLOBALS_ACCESSOR to access globals so the
generated code builds when PHP was built with ZTS enabled.
2017-12-04: wsfulton
[Python] Add missing checks for failures in calls to PyUnicode_AsUTF8String. Previously a
seg fault could occur when passing invalid UTF8 strings (low surrogates), eg passing
u"\udcff" to the C layer (Python 3).
2017-11-24: joequant
[R] Fix #1124 and return R_NilValue for null pointers
2017-11-29: wsfulton
[Java] director exception handling improvements.
When a director method throws an exception and it is caught by DirectorException
and passed back to Java using Swig::DirectorException::throwException, the Java
stack trace now contains the original source line that threw the exception.
Deprecate Swig::DirectorException::raiseJavaException, please replace usage with
Swig::DirectorException::throwException.
*** POTENTIAL INCOMPATIBILITY ***
2017-10-26: wsfulton
Add support for C++11 ref-qualifiers when using directors.
2017-10-26: wsfulton
Fix generated code when using directors and methods returning const ref pointers.
2017-10-26: wsfulton
[C#, D, Java, Octave, R, Scilab] Port director typemaps to these additional languages.
Issue #700.
2017-10-26: radarsat1
[Ruby Python] Patch #1029 - Correct handling of null using directors and shared_ptr.
2017-10-10: joequant
[R] pass enum expressions to R. This will generate
incorrect files when there is an arithmetic expression
in the enum, but this is better than silently generating
incorrect code
2017-10-09: olly
[PHP] Fix incorrect wrapper code generated when there's a
combination of overloading, parameters with a default value
and %newobject. Fixes https://sourceforge.net/p/swig/bugs/1350/
2017-10-09: olly
Remove GCJ support. It isn't in a good state and doesn't seem to
be used, and GCC7 dropped GCJ. Closes
https://sourceforge.net/p/swig/bugs/823/
2017-10-07: olly
Fix preprocessor handling of empty macro arguments to match that of
C/C++ compilers. Fixes issue #1111 and
https://sourceforge.net/p/swig/bugs/826/
2017-10-06: wsfulton
[Python] Issue #1108. Fix platform inconsistency in Python default argument handling.
32 bit and 64 bit compiled versions of SWIG generated different Python files
when default arguments were outside the range of 32 bit signed integers.
The default arguments specified in Python are now only those that are in the
range of a 32 bit signed integer, otherwise the default is obtained from C/C++ code.
2017-10-02: wsfulton
[C#] Fix std::complex types passed by value.
2017-10-02: wsfulton
[Javascript, Python, Ruby] Issue #732 - Missing type information for std::complex
in std_complex.i meant that previously std::complex always had to be fully qualified
in order to be wrapped with the appropriate typemaps.
2017-10-01: joequant
allow R package names with docs
allowing multiple get accessors in R
fix smart-pointer and NAMESPACE support
constructors now returning smart pointers (if class
declared as such)
smart-pointer classes deriving from parent smart-pointers
2017-09-29: wsfulton
Issue #1100 - Allow an instantiated template to have the same name in the target
language as the C++ template name, for example, this is now possible:
template<typename T> struct X { ... };
%template(X) X<int>;
2017-09-23: wsfulton
Issue #1098. Fix overloading of shared_ptr with underlying pointer types, eg:
void m(std::shared_ptr<T> p);
void m(T &p);
void m(T *p);
Only the first method is wrapped and the others are ignored/shadowed.
The implementation is done via a new attribute in the 'typecheck' typemap called
'equivalent'. If specified, it must contain the equivalent pointer type for overloading
and can only be used for the special SWIG_TYPECHECK_POINTER precedence level.
The shared_ptr 'typecheck' typemaps have been modified accordingly.
Here is a simplified version:
%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="T *")
T,
T CONST &,
T CONST *,
T *CONST&,
std::shared_ptr< T >,
std::shared_ptr< T > &,
std::shared_ptr< T > *,
std::shared_ptr< T > *&
{ ... }
Overloading with any of these types will result in SWIG ignoring all but the first
overloaded method by default. Without the 'equivalent' attribute, wrapping the overloaded
methods resulted in types being shadowed (scripting languages) or code that did not
compile (statically typed languages).
2017-09-19: futatuki
[Python] #1003 Add --with-2to3=/path/to/2to3 option to configure.
2017-09-18: wsfulton
Fix type promotion wrapping constant expressions of the form:
# define EXPR_MIXED1 (0x80 + 11.1) - 1
This was previously an integral type instead of a floating point type.
2017-09-17: wsfulton
Fix generated code for constant expressions containing wchar_t L literals such as:
# define __WCHAR_MAX (0x7fffffff + L'\0')
# define __WCHAR_MIN (-__WCHAR_MAX - 1)
2017-09-10: mlamarre
[Python] Patch #1083. Define_DEBUG to 1 to do exactly like Visual Studio
/LDd, /MDd or /MTd compiler options.
2017-08-25: wsfulton
Issue #1059. Add support for C++11 ref-qualifiers on non-static member functions.
Members with lvalue ref-qualifiers such as:
struct RQ {
void m1(int x) &;
void m2(int x) const &;
};
are wrapped like any other member function. Member functions with rvalue ref-qualifiers
are ignored by default, such as:
struct RQ {
void m3(int x) &&;
void m4(int x) const &&;
};
example.i:7: Warning 405: Method with rvalue ref-qualifier m3(int) && ignored.
example.i:8: Warning 405: Method with rvalue ref-qualifier m4(int) const && ignored.
These can be unignored and exposed to the target language, see further documentation in
CPlusPlus11.html.
2017-08-16: wsfulton
Fix #1063. Add using declarations to templates into typedef table.
Using declarations to templates were missing in SWIG's internal typedef tables.
This led to a few problems, such as, templates that did not instantiate and generated
C++ code that did not compile as SWIG did not know what scope the template was
in. This happened mostly when a using declaration was used on a template type in a
completely unrelated namespace.
2017-08-16: wsfulton
Fix type lookup in the presence of using directives and using declarations.
Fix some cases of type lookup failure via a combination of both using directives and
using declarations resulting in C++ code that did not compile as the generated type was
not fully qualified for use in the global namespace. Example below:
namespace Space5 {
namespace SubSpace5 {
namespace SubSubSpace5 {
struct F {};
}
}
using namespace SubSpace5;
using SubSubSpace5::F;
void func(SubSubSpace5::F f);
}
2017-08-16: wsfulton
Issue #1051. %template scope enforcement and class definition fixes.
The scoping rules around %template have been specified and enforced.
The %template directive for a class template is the equivalent to an
explicit instantiation of a C++ class template. The scope for a valid
%template instantiation is now the same as the scope required for a
valid explicit instantiation of a C++ template. A definition of the
template for the explicit instantiation must be in scope where the
instantiation is declared and must not be enclosed within a different
namespace.
For example, a few %template and C++ explicit instantiations of std::vector
are shown below:
// valid
namespace std {
%template(vin) vector<int>;
template class vector<int>;
}
// valid
using namespace std;
%template(vin) vector<int>;
template class vector<int>;
// valid
using std::vector;
%template(vin) vector<int>;
template class vector<int>;
// ill-formed
namespace unrelated {
using std::vector;
%template(vin) vector<int>;
template class vector<int>;
}
// ill-formed
namespace unrelated {
using namespace std;
%template(vin) vector<int>;
template class vector<int>;
}
// ill-formed
namespace unrelated {
namespace std {
%template(vin) vector<int>;
template class vector<int>;
}
}
// ill-formed
namespace unrelated {
%template(vin) std::vector<int>;
template class std::vector<int>;
}
When the scope is incorrect, an error now occurs such as:
cpp_template_scope.i:34: Error: 'vector' resolves to 'std::vector' and
was incorrectly instantiated in scope 'unrelated' instead of within scope 'std'.
Previously SWIG accepted the ill-formed examples above but this led to
numerous subtle template scope problems especially in the presence of
using declarations and using directives as well as with %feature and %typemap.
Actually, a valid instantiation is one which conforms to the C++03
standard as C++11 made a change to disallow using declarations and
using directives to find a template.
// valid C++03, ill-formed C++11
using std::vector;
template class vector<int>;
Similar fixes for defining classes using forward class references have
also been put in place. For example:
namespace Space1 {
struct A;
}
namespace Space2 {
struct Space1::A {
void x();
}
}
will now error out with:
cpp_class_definition.i:5: Error: 'Space1::A' resolves to 'Space1::A' and
was incorrectly instantiated in scope 'Space2' instead of within scope 'Space1'.
Previously some symbols would have been instantiated in the wrong scope and led
to lots of scope problems involving SWIG typemaps, features, renames etc.
You will need to correct the scope used in other SWIG directives which do not
support 'using declarations' and 'using directives'. For example, if you previously had:
%rename(Zap) vector<int>::clear;
using namespace std;
%template(VectorInt) vector<int>;
Prior versions of SWIG incorrectly instantiated vector<int> in the global namespace
and so the %rename matched. Now the template is instantiated in the correct namespace,
so is fully qualified as std::vector<int>. The other SWIG directives need correcting as
they do not follow 'using declarations' and 'using directives'. Change it to:
%rename(Zap) std::vector<int>::clear;
using namespace std;
%template(vin) vector<int>;
*** POTENTIAL INCOMPATIBILITY ***
2017-08-16: wsfulton
Fix scope lookup for template parameters containing unary scope operators.
Fixes cases like:
namespace Alloc {
template<typename T> struct Rebind {
typedef int Integer;
};
}
%template(RebindBucket) Alloc::Rebind< Bucket >;
OR
%template(RebindBucket) Alloc::Rebind< ::Bucket >;
Alloc::Rebind< Bucket >::Integer Bucket1();
Alloc::Rebind< ::Bucket >::Integer Bucket2();
Alloc::Rebind<::template TemplateBucket<double>>::Integer Bucket3();
2017-08-16: wsfulton
For templates only, the template parameters are fully resolved when
handling typemaps. Without this, it is too hard to have decent rules
to apply typemaps when parameter types are typedef'd and template
parameters have default values.
Fixes %clear for typedefs in templates, eg:
%typemap("in") XXX<int>::Long "..."
template typename<T> struct XXX {
typedef long Long;
};
%clear XXX<int>::Long;
as the typemap was previously incorrectly stored as a typemap for long
instead of XXX<int>::Long.
2017-08-05: olly
[C++11] Allow static_assert at the top level (and disallow it right
after template<T>). Fixes issue 1031 reported by Artem V L.
2017-08-02: wsfulton
Fix incorrectly shown warning when an empty template instantiation was used on a
class used as a base class and that base class was explicitly ignored with %ignore.
Example of the warning which will no longer appear:
Warning 401: Base class 'Functor< int,int >' has no name as it is an empty
template instantiated with '%template()'. Ignored.
2017-07-17: fflexo
[Java] #674 Add std_list.i to add support for std::list containers. The Java proxy
extends java.util.AbstractSequentialList and makes the C++ std::list container look
and feel much like a java.util.LinkedList from Java.
2017-07-07: wsfulton
[Python] Fix display of documented template types when using the autodoc
feature. For example when wrapping:
%feature("autodoc");
template<typename X> struct T {};
%template(TInteger) T<int>;
the generated documentation contains:
"""Proxy of C++ T< int > class."""
instead of:
"""Proxy of C++ T<(int)> class."""
and
"""__init__(TInteger self) -> TInteger"""
instead of
"""__init__(T<(int)> self) -> TInteger"""
2017-06-27: nihaln
[PHP] Update the OUTPUT Typemap to add return statement to the
PHP Wrapper.
2017-06-27: nihaln
[PHP] Update the enum and value examples to use the OO wrappers
rather than the flat functions produced with -noproxy. There's
not been a good reason to use -noproxy for since PHP5 OO wrapping
was fixed back in 2005.
2017-06-23: m7thon
[Python] fix and improve default argument handling:
1. Fix negative octals. Currently not handled correctly by `-py3`
(unusual case, but incorrect).
2. Fix arguments of type "octal + something" (e.g. `0640 | 04`).
Currently drops everything after the first octal. Nasty!
3. Fix bool arguments "0 + something" (e.g. `0 | 1`) are always
"False" (unusual case, but incorrect).
4. Remove special handling of "TRUE" and "FALSE" from
`convertValue` since there's no reason these have to match
"true" and "false".
5. Remove the Python 2 vs. Python 3 distinction based on the
`-py3` flag. Now the same python code is produced for default
arguments for Python 2 and Python 3. For this, octal default
arguments, e.g. 0644, are now wrapped as `int('644', 8)`. This
is required, as Python 2 and Python 3 have incompatible syntax
for octal literals.
Fixes #707
2017-06-21: futatuki
#1004 - Fix ccache-swig executable name to respect configure's --program-prefix and
--program-suffix values if used.
2017-06-21: tamuratak
[Ruby] #911 - Add std::wstring support.
2017-06-19: wsfulton
[Python] Fix handling of rich comparisons when wrapping overloaded operators:
operator< operator<= operator> operator>= operator== operator!=
Previously a TypeError was always thrown if the type was not correct. NotImplemented
is now returned from these wrapped functions if the type being compared with is
not correct. The subsequent behaviour varies between different versions of Python
and the comparison function being used, but is now consistent with normal Python
behaviour. For example, for the first 4 operator overloads above, a TypeError
'unorderable types' is thrown in Python 3, but Python 2 will return True or False.
NotImplemented should be returned when the comparison cannot be done, see PEP 207 and
https://docs.python.org/3/library/constants.html#NotImplemented
Note that the bug was only present when overloaded operators did not also have a
function overload.
Fixes SF bug #1208 (3441262) and SF patch #303.
*** POTENTIAL INCOMPATIBILITY ***
2017-06-17: fabrice102
[Go] Fix Go callback example. Fixes github #600, #955, #1000.
2017-06-16: wsfulton
Make sure warning and error messages are not split up by other processes writing to
stdout at the same time.
2017-06-16: wsfulton
[R] Fix wrapping function pointers containing rvalue and lvalue reference parameters.
2017-06-13: olly
[Perl] Fix testsuite to work without . in @INC - it was removed in
Perl 5.26 for security reasons, and has also been removed from
older versions in some distros. Fixes #997 reported by lfam.
2017-06-03: wsfulton
Fix %import on a file containing a file scope %fragment forced inclusion to not
generate the fragment contents as %import should not result in code being generated.
The behaviour is now the same as importing code insertion blocks.
Wrapping FileC.i in the following example will result in no generated code, whereas
previously "#include <limits.h>" was generated:
// FileA.i
%fragment("<limits.h>", "header") %{
#include <limits.h>
%}
%{
#include <stdio.h>
%}
%fragment("<limits.h>");
// FileC.i
%import "FileA.i"
*** POTENTIAL INCOMPATIBILITY ***
2017-05-26: Volker Diels-Grabsch, vadz
[Java] #842 Extend from java.util.AbstractList<> and implement java.util.RandomAccess for
std::vector wrappers. This notably allows to iterate over wrapped vectors in a natural way.
Note that boxed types are now used in the Java layer when wrapping vector of C primitive
types, for example. This may introduce some subtle incompatibilities due to some
differences in how Java converts boxed types and unboxed types. For example,
int i=0;
double d1 = i; // ok
Double d2 = i; // error: incompatible types: int cannot be converted to Double
This can be a problem when calling the add and set functions. A suggested backwards
compatible workaround is to use something like (shown for std::vector<double>:
#if defined(SWIGJAVA)
// Add in old api that uses non-boxed types
%extend std::vector<double> {
%proxycode %{
public void add(double x) {
add(Double.valueOf(x));
}
public void set(int i, double val) {
set(i, Double.valueOf(val));
}
%}
}
#endif
%include "std_vector.i"
%template(VectorDouble) std::vector<double>;
*** POTENTIAL INCOMPATIBILITY ***
2017-05-30: davidcl
[Scilab] #994 Undefined symbol error when loading in Scilab 6
2017-05-25: asibross
[Java] #370 #417 Missing smart pointer handling in Java director extra methods
swigReleaseOwnership() and swigTakeOwnership().
2017-05-23: wsfulton
[Java] #230 #759 Fix Java shared_ptr and directors for derived classes java compilation
error.
For shared_ptr proxy proxy classes, add a protected method swigSetCMemOwn for modifying
the swigCMemOwn and swigCMemOwnDerived member variables which are used by various other
methods for controlling memory ownership.
2017-05-21: Sghirate
[Java, C#, D] #449 Remove unnecessary use of dynamic_cast in directors to enable
non-RTTI compilation.
2017-05-21: wsfulton
[Python] #993 Fix handling of default -ve unsigned values, such as:
void f(unsigned = -1U);
2017-05-20: jschueller
[Python] #991 Fix E731 PEP8 warning: do not assign a lambda expression
2017-05-16: nihal95
[PHP] Add %pragma version directive to allow the version of the
extension to be set. Patch #970, fixes #360.
2017-05-13: yag00
Patch #975 - Add support for noexcept on director methods.
2017-04-27: redbrain
Issue #974, Patch #976 - Fix preprocessor handling of macros with commas in a comment.
2017-04-25: jleveque
[Lua] #959 - Fix Visual Studio C4244 conversion warnings in Lua wrappers.
2017-04-21: tamuratak
[Ruby] #964 - Add shared_ptr director typemaps.
2017-04-20: wsfulton
[Ruby] #586, #935 Add assert for invalid NULL type parameter when calling SWIG_Ruby_NewPointerObj.
2017-04-20: tamuratak
[Ruby] #930, #937 - Fix containers of std::shared_ptr.
Upcasting, const types (eg vector<shared_ptr<const T>>) and NULL/nullptr support added.
2017-04-12: smarchetto
[Scilab] New parameter targetversion to specify the Scilab target version (5, 6, ..) for code generation
With Scilab 6 target specified, identifier names truncation is disabled (no longer necessary)
2017-03-24: tamuratak
[Ruby] Fix #939 - Wrapping std::vector<bool> fix due to incorrect null checks
on VALUE obj.
2017-03-17: vadz
[C#] #947 Add support for std::complex<T>
2017-03-17: wsfulton
[Go] Fix handling of typedef'd function pointers and typedef'd member function pointers
such as:
typedef int (*FnPtr_td)(int, int);
int do_op(int x, int y, FnPtr_td op);
2017-03-16: wsfulton
Add support for member const function pointers such as:
int fn(short (Funcs::* parm)(bool)) const;
Also fix parsing of references/pointers and qualifiers to member
pointers such as:
int fn(short (Funcs::* const parm)(bool));
int fn(short (Funcs::* & parm)(bool));
2017-03-10: wsfulton
Extend C++11 alternate function syntax parsing to support const and noexcept, such as:
auto sum1(int x, int y) const -> int { return x + y; }
auto sum2(int x, int y) noexcept -> int { return x + y; }
2017-02-29: tamuratak
[Ruby] #917 - Add Enumerable module to all container class wrappers. It was missing
for std::list, std::multiset, std::unordered_multiset and std::unordered_map.
2017-02-27: assambar
[C++11] Extend parser to support throw specifier in combination
with override and/or final.
2017-02-10: tamuratak
[Ruby] #883 - Add support for C++11 hash tables:
std::unordered_map
std::unordered_set
std::unordered_multimap
std::unordered_multiset
2017-02-08: jcsharp
[C#] #887 Improve std::vector<T> wrapper constructors -
Replace constructor taking ICollection with IEnumerable and also add IEnumerable<T>
constructor to avoid the boxing and unboxing overhead of the original constructor,
when the type parameter is a value type.
Version 3.0.12 (27 Jan 2017)
============================
2017-01-27: wsfulton
[C#] #882 Fix missing filename in error messages when there is a problem
writing out C# files.
2017-01-27: briancaine
[Guile] #744 Fix compilation errors in Guile wrappers - regression
introduced in swig-3.0.11.
2017-01-24: andrey-starodubtsev
[Java] Apply #704 - director typemap improvements.
Memory leak fixes, add support for "directorargout" typemap and
add director support to typemaps.i.
2017-01-24: wsfulton
Enhance %extend to extend a class with template constructors, eg:
struct Foo {
%extend {
template<typename T>
Foo(int a, T b) {
...
}
}
};
%template(Foo) Foo::Foo<double>;
2017-01-22: wsfulton
Issue #876 Enhance %extend to extend a class with template methods, eg:
struct Foo {
%extend {
template<typename T>
void do_stuff(int a, T b) {
...
}
}
};
%template(do_stuff_inst) Foo::do_stuff<double>;
Similarly for static template methods.
2017-01-22: kwwette
[Octave] add support for version 4.2
- The Octave API now uses some C++11 features. It is recommended to use
the mkoctfile program supplied by Octave to compile the SWIG-generated
wrapper code, as mkoctfile will ensure the correct C++ compiler/options
are used. Otherwise, the value of `mkoctfile -p CXX` should be parsed
for any -std=* flags which might be present.
- Octave has dropped support for << and >> operators, so SWIG now
ignores them.
- The Octave error() function now raises C++ exceptions to propagate
Octave errors, so %exception directives may need to be modified.
For convenience the SWIG_RETHROW_OCTAVE_EXCEPTIONS macro can be used
to rethrow any Octave exceptions for Octave itself to handle, e.g.:
try {
$action // may call error()
}
SWIG_RETHROW_OCTAVE_EXCEPTIONS // error() exceptions are rethrown
catch(...) {
... // all other exceptions
}
*** POTENTIAL INCOMPATIBILITY ***
2017-01-16: wkalinin
[C#] Fix #733 regression introduced in swig-3.0.9.
Missing virtual function override in C# layer when using %import.
2017-01-16: fschlimb
Fix #813 template symbol name lookup bug when typedef names are the same but in different
namespaces.
2017-01-15: wsfulton
[C# D Java]
The SWIG library no longer uses the javatype, dtype or cstype typemaps, thereby
completely freeing them up for users to use without having to replicate the library
code that they previously added. The code previously generated by these typemaps
has been replaced by the new %proxycode directive. Their use in the library code
was fairly minimal:
C# cstype: std_array.i std_map.i std_vector.i
D dtype: std_vector.i
Java javatype: arrays_java.i
2017-01-14: wsfulton
The %extend directive can now optionally support one of the 'class', 'struct' or 'union'
keywords before the identifier name, for example:
struct X { ... };
%extend struct X { ... }
Previously this had to specified as:
struct X { ... };
%extend X { ... }
2017-01-13: wsfulton
[C# D Java] Add new %proxycode directive which is a macro for %insert("proxycode").
This is a way of adding pure C#/D/Java code into the appropriate proxy class, eg:
%extend Proxy2 {
%proxycode %{
public int proxycode2(int i) {
return i+2;
}
%}
}
%inline %{
struct Proxy2 {};
%}
There will then be a pure Java/C#/D method called proxycode2 in the Proxy2 class.
2016-12-31: ajrheading1
Issue #860 - Remove use of std::unary_function and std::binary_function
which is deprecated in C++11.
2016-12-30: olly
[PHP7] Register internal 'swig_runtime_data_type_pointer' constant
as "CONST_PERSISTENT" to avoid segmentation fault on module unload.
Fixes #859 reported by Timotheus Pokorra. Thanks also to Javier Torres
for a minimal reproducer.
Version 3.0.11 (29 Dec 2016)
============================
2016-12-24: wsfulton
[C#] Add %feature("csdirectordelegatemodifiers") to enable customization
of the delegate access modifiers generated in director classes.
Fixes issue #748.
2016-12-23: wsfulton
[Python] Fix builtin "python:slot" feature failing for tp_hash when using
hashfunc closure with a "Wrong type for hash function" for Python 2.
Issue #843.
2016-12-21: joequamt
Changed generation of functions so that only functions
that end in _set generate accessor functions rather than
looking for "set".
Change generation of operators to not have underscores
to start in R. Users need to provide custom names for these operator overloads.
2016-12-21: olly
Fix isfinite() checks to work with all C++11 compilers.
Fixes issues #615, #788 and #849.
2016-12-20: wsfulton
%namewarn unnecessarily caused keyword warnings for non-instantiated template classes
and duplicate warnings for instantiated template classes when keywords were used.
Issue #845.
2016-12-18: ezralanglois
[Python, Ruby, Octave] Memory leak fix on error in std::pair wrappers.
Issue #851.
2016-12-18: wsfulton
Zero initialize arrays when using %array_class and %array_functions.
2016-12-18: t-ikegami
[Python] Fix #446
Python %array_class of carrays.i failed with -builtin option.
2016-12-16: briancaine
[Guile] Patch #744 Added support for Guile's native pointer functionality
2016-12-01: wsfulton
[Python] Issue #769.
Add optional moduleimport attribute to %module so that the
default module import code can be overridden. See the "Searching for the wrapper module"
documentation in Python.html. Example:
%module(moduleimport="import _foo") foo
$module also expands to the low-level C/C++ module name, so the following is the
same as above
%module(moduleimport="import $module") foo
2016-11-30: olly
[PHP] Add support for PHP7. PHP5's C extension API has changed
substantially so you need to use -php7 to specify you want PHP7
compatible wrappers. The default extension for generated wrappers
is now .cxx (to match SWIG's default for every other language - to
generate foo_wrap.cpp you can run SWIG with -cppext cpp). Fixes
issue #571.
As part of this change, the language subdirectory for PHP5 has
changed from "php" to "php5" - if you are making use of the search
path feature where the language subdirectory of each directory
is also searched, you'll need to update your bindings. A simple
fix which works for older and newer SWIG is to add a symlink:
ln -s php php5
*** POTENTIAL INCOMPATIBILITY ***
2016-11-30: olly
[PHP] Only emit one copy of each distinct arginfo. Previously we
emitted a separate one for every wrapped function, but typically
many functions have the same number of parameters and combinations
of parameters passed by reference or not.
This change significantly reduces both the size of the generated
wrapper, and of the compiled PHP extension module (e.g. by ~6% for
the stripped extension module for Xapian's PHP7 bindings).
2016-11-28: wsfulton
Fix %rename override of wildcard %rename for templates. For example:
%rename(GlobalIntOperator) *::operator bool; // wildcard %rename
%rename(XIntOperator) X::operator bool; // fix now overrides first %rename above
OR
%rename(XIntOperator) X<int>::operator bool; // fix now overrides first %rename above
template<typename T> struct X {
operator bool();
...
};
%template(Xint) X<int>;
This also fixes %rename override of global %rename for templates. For example:
// Global rename to make all functions start with a lower case letter
%rename("%(firstlowercase)s", %$isfunction ) "";
%rename(woohoo) W::Woo; // fix now overrides above %rename
template<typename T> struct W {
W Woo();
...
};
%template(Wint) W<int>;
The above also introduces a possibly unexpected change. Many of the STL containers
provided by SWIG use %rename to rename some methods, eg in std::vector, push_back
is renamed to add in Java. Previously this intended rename did not happen when using
using global %rename rules and the method would remain as push_back, but is now
renamed to add. Some more info in issue #856.
*** POTENTIAL INCOMPATIBILITY ***
2016-11-26: m7thon
[Python] Issue #709 - improved wrapping of division operators
'from __future__ import division' now works in Python 2 whether or not the
-py3 flag is used.
2016-11-12: joequant
[R] Issue #697 - fix comma issue with overload methods
2016-11-12: joequant
[R] Issue #555 - R runtime needs stdio.h
2016-11-02: wsfulton
[Python] Issue #816 - fix compilation error when using -extranative and -builtin.
2016-11-02: liorgold
Patch #741 - Add support for C++11 alias templates, see updated CPlusPlus11.html
documentation.
2016-10-30: myd7349
[C#] Patch #740 Add std_array.i for C# for wrapping std::array.
Patch also enhances std::vector<std::wstring> C# wrappers with additional functions
(Contains, IndexOf, LastIndexOf and Remove).
2016-10-30: tobilau
[Java] Fix wrappers for wstring parameters in director methods to cleanup local
ref after director callback has finished.
2016-10-23: wsfulton
[C#] Add missing csdirectorin VOID_INT_PTR and csdirectorout VOID_INT_PTR typemaps.
2016-10-23: jiulongw
Patch #781 - Fix wrapping of C compound expressions containing char constants
in quotes such as:
#define H_SUPPRESS_SCALING_MAGIC (('s'<<24) | ('u'<<16) | ('p'<<8) | 'p')
enum DifferentTypes {
typecharcompound='A'+1,
typecharcompound2='B' << 2
};
2016-10-13: wsfulton
[Python] Issue #808 - fix Python pickling and metaclass for builtin wrappers.
The metaclass (SwigPyObjectType) for SWIG objects was not defined in
a way that let importlib successfully import the Python wrappers.
The pickle module previously failed to pickle objects because it couldn't
determine what module the SWIG wrapped objects were in.
2016-09-29: wsfulton
[Allegrocl, CFFI, GO, Javascript, Ocaml, R, Scilab]
Add missing support for the "ret" typemap in a few target languages.
The documentation also now has info on the "ret" typemap.
2016-09-27: ahmed-usman
[xml] Handle template parameters correctly.
2016-09-27: dontpanic92
[Go] Fix argument names in inherited functions taking more than 8
parameters. Fixes #795.
2016-09-26: smarchetto
[Scilab] mlists that map pointers can be given a custom type name.
2016-09-25: wsfulton
Patch #793 from q-p to expand exception handling to include std::bad_cast
in std_except.i.
2016-09-24: olly
[PHP] Fix code generated for feature("director:except") -
previously the return value of call_user_function() was ignored and
we checked an uninitialised value instead. Fixes #627. Based on
patch from Sergey Seroshtan.
2016-09-22: wsfulton
[Python] More flexible python builtin slots for overloaded C++ function.
The closure names used for builtin slots are mangled with their functype so
that overloaded C++ method names can be used for multiple slots.
For example:
%feature("python:slot", "mp_subscript", functype="binaryfunc") SimpleArray::__getitem__;
%feature("python:slot", "sq_item", functype="ssizeargfunc") SimpleArray::__getitem__(Py_ssize_t n);
will generate closures:
SWIGPY_SSIZEARGFUNC_CLOSURE(_wrap_SimpleArray___getitem__) /* defines _wrap_SimpleArray___getitem___ssizeargfunc_closure */
SWIGPY_BINARYFUNC_CLOSURE(_wrap_SimpleArray___getitem__) /* defines _wrap_SimpleArray___getitem___binaryfunc_closure */
Previously only one name was defined: _wrap_SimpleArray___getitem___closure.
Hence the overloaded __getitem__ method can be used to support both mp_subscript and sq_item slots.
2016-09-17: wsfulton
[Python] Fix iterators for containers of NULL pointers (or Python None) when using
-builtin. Previously iteration would stop at the first element that was NULL.
2016-09-16: olly
[Javascript] Fix SWIG_exception() macro to return from the current
function. Fixes #789, reported by Julien Dutriaux.
2016-09-16: olly
[PHP] Fix SWIG_exception() macro to return from the current function.
Fixes #240, reported by Sergey Seroshtan.
2016-09-12: xypron
[C#] Patch #786 Keyword rename to be CLS compliant by adding an underscore
suffix instead of an underscore prefix to the C symbol name. Please use an explicit
%rename to rename the symbol with a _ prefix if you want the old symbol name.
*** POTENTIAL INCOMPATIBILITY ***
2016-09-09: olly
[Python] Fix import handling for Python 2.6 to work in a frozen
application. Fixes #145, reported by Thomas Kluyver.
2016-09-02: smarchetto
[Scilab] Pointers are mapped to mlist instead of tlist
(mlist better for scilab overloading)
2016-09-02: olly
[PHP] Fix "out" typemap for member function pointers and "in"
typemap for char INPUT[ANY].
2016-09-01: wsfulton
[Python] More efficient Python slicing.
Call reserve for container types that support it to avoid repeated
memory reallocations for new slices or slices that grow in size.
2016-09-01: wsfulton
[Python] #771 - Make builtin types hashable by default.
Default hash is the underlying C/C++ pointer. This matches up with testing for
equivalence (Py_EQ in SwigPyObject_richcompare) which compares the pointers.
2016-08-22: wsfulton
[Python] The following builtin slots can be customized like other slots via the
"python:<x>" and "python:slot" features where <x> is the appropriate slot name:
tp_allocs
tp_bases
tp_basicsize
tp_cache
tp_del
tp_dealloc
tp_flags
tp_frees
tp_getset
tp_is_gc
tp_maxalloc
tp_methods
tp_mro
tp_new
tp_next
tp_prev
tp_richcompare
tp_subclasses
tp_weaklist
was_sq_ass_slice
was_sq_slice
A few documentation improvements for slot customization.
2016-08-09: joequant
[R] Patch #765 Fix extern "C" header includes for C++ code.
2016-08-05: olly
[xml] Fix how the output filename is built to avoid problems when
it contains the embedded strings ".c", ".cpp" or ".cxx".
Fixes #540 reported by djack42.
2016-07-01: wsfulton
Fix corner case of wrapping std::vector of T pointers where a pointer to a pointer of T
also exists in the wrapped code. SF Bug 2359417 (967).
2016-06-26: wkalinin
[Java, C#] Patch #681 Fix seg fault when ignoring nested classes.
2016-06-25: mromberg
[Python] #711 Fix -castmode and conversion of signed and unsigned integer types.
See 2015-12-23 CHANGES entry for details of these improvements when they were
implemented for the default options (ie not using -castmode).
2016-06-25: ahnolds
Patch #730 - Fix %implicitconv for overloaded functions when using
-castmode or -fastdispatch options.
The result is that in all overload cases where there are multiple possibilities
with the same number of arguments, the dispatch function will first check for
exact (aka non implicit) matches, and then subsequently check for implicit
casting matches. This was already happening in the normal dispatch situation,
and in the -fastdispatch case two passes through the candidates were happening,
just with SWIG_POINTER_IMPLICIT_CONV always set. After this patch, it is not set
on the first pass, and then set on the second pass.
2016-06-25: liorgold
Patch #727 - Add support for C++11 type aliasing.
Version 3.0.10 (12 Jun 2016)
============================
2016-06-06: mromberg
[Python] Patch #698. Add support for -relativeimport for python 2.7, so -py3 is no
longer also required for relative import support.
2016-06-05: mromberg
[Python] Patch #694 - Fix package import regressions introduced in swig-3.0.9.
1) The code in 3.0.9 did not fall back to 'import _foo' if 'import bar._foo' failed
(assuming bar.foo was the main module). Every place _foo is imported now first tries
it from the package where foo was found and if that fails tries _foo as a global module.
2) The separate block of Python code that injected code to pull in the attributes
from _foo when -builtin is used made use of the -py3 switch to either do
'from ._foo import *' or "from _foo import *". This block of code no longer does this
and instead checks the Python version at runtime to switch between the two syntaxes.
In summary, swig-3.0.10 has been modified to ease the creation of wrapper modules
that can be fully made part of a Python package. SWIG no longer
assumes the dynamically linked C module is a global module.
The dynamic module can now be placed into either the same package as the pure Python
module or as a global module. Both locations are used by the Python wrapper to
locate the C module.
However, this could cause a backwards incompatibility with some code
that was relying on the ability of "from package import _module" to
pull attributes out of the package directly. If your code populates a
module (which is also a package) with attributes that are SWIG
generated modules which were not loaded in a conventional way,
swig-3.0.8 and earlier may have worked due to 'from package import
_module' bypassing a real import and pulling your module in as an
attribute. This will no longer work. Since this is not a common (or
even recommended) practice, most folk should not be affected.
*** POTENTIAL INCOMPATIBILITY ***
2016-05-31: wsfulton
Fix #690 - Smart pointer to %ignored class doesn't expose inherited methods.
Regression introduced in swig-3.0.9.
Version 3.0.9 (29 May 2016)
===========================
2016-05-24: mromberg
[Python] Patch #612 - Add support for Python's implicit namespace packages.
2016-05-23: wsfulton
[Ruby] Fix #602 - Error handling regression of opaque pointers introduced
in swig-3.0.8 when C functions explicitly reset a pointer using 'DATA_PTR(self) = 0'.
An ObjectPreviouslyDeleted error was incorrectly thrown when the pointer was used
as a parameter.
2016-05-17: tamuratak
[Ruby] Patch #651 - Correct overloaded function error message when function is
using %newobject.
2016-05-17: aurelj
[Ruby] Patch #582 - add support for docstring option in %module()
2016-05-14: wsfulton
Fix #434 - Passing classes by value as parameters in director methods did not create
a copy of the argument leading to invalid memory accesses if the object was used
after the upcall into the target language. Passing arguments by value shouldn't give
rise to these sorts of memory problems and so the objects are now copied and ownership
of their lifetime is controlled by the target language.
2016-05-07: wsfulton
Fix #611. Fix assertion handling defaultargs when using %extend for a template
class and the extended methods contain default arguments.
2016-05-05: ejulian
[Python] Patch #617. Fix operator/ wrappers.
2016-05-02: wsfulton
Fix #669. Don't issue warning about ignoring base classes when the derived class is
itself ignored.
2016-04-18: ianlancetaylor
[Go] Fix use of goout typemap when calling base method by
forcing the "type" attribute to the value we need.
2016-04-17: ianlancetaylor
[Go] Fixes for Go 1.6: avoid returning Go pointers from
directors that return string values; add a trailing 0 byte
when treating Go string as C char*.
2016-04-06: smarchetto
[Scilab] #552 Make Scilab runtime keep track of pointer types
Instead of a Scilab pointer which has no type, SWIG Scilab maps a
pointer to a structure tlist containing the pointer adress and its type.
2016-04-02: ahnolds
[Python] Apply #598. Fix misleading error message when attempting to read a non-existent
attribute. The previous cryptic error message:
AttributeError: type object 'object' has no attribute '__getattr__'
is now replaced with one mentioning the attribute name, eg:
AttributeError: 'Foo' object has no attribute 'bar'
2016-04-02: derkuci
[Python] Patch #610 to fix #607.
Fix single arguments when using python -builtin -O with %feature("compactdefaultargs")
2016-03-31: wsfulton
Fixes #594. Fix assertion for some languages when wrapping a C++11 enum class that
is private in a class.
Also don't wrap private enums for a few languages that attempted to do so.
2016-03-31: wsfulton
[Java] unsigned long long marshalling improvements when a negative number
is passed from Java to C. A cast to signed long long in the C layer will now
result in the expected value. No change for positive numbers passed to C.
Fixes #623.
2016-03-22: alexwarg
[Lua] #398 Fix lua __getitem + inheritance
The new handling of classes in Lua (not merging methods into the derived classes)
breaks for classes that provide a __getitem function. The __getitem function
prevents method calls to any method defined in a base class. This fix calls
__getitem only if the member is not found using recursive lookup.
2016-03-18: ptomulik
[Python] #563 Stop generating unnecessary _swigconstant helpers.
2016-03-16: richardbeare
[R] #636 Add extra std::vector numeric types
2016-03-14: wsfulton
[Java] Add std_array.i for C++11 std::array support.
2016-03-12: wsfulton
[Java, C#, D] Fix static const char member variables wrappers with %javaconst(1)
%csconst(1) or %dmanifestconst.
This fixes the case when an integer is used as the initializer, such as:
struct W { static const char w = 100; };
Fix generated code parsing enum values using char escape sequences
when these values appear in the Java code (usually when using %javaconst(1))
such as:
enum X { x1 = '\n', x2 = '\1' };
Similarly for static const member char variables such as:
struct Y { static const char y = '\n'; }
Likewise for D and %dmanifestconstant. For C# and %csconst(1), char
values in C# are now hex escaped as C# doesn't support C octal escaping.
2016-03-11: wsfulton
[Java C#] Add support for treating C++ base classes as Java interfaces
instead of Java proxy classes. This enable some sort of support for
multiple inheritance. The implementation is in swiginterface.i and
provides additional macros (see Java.html for full documentation):
%interface(CTYPE)
%interface_impl(CTYPE)
%interface_custom("PROXY", "INTERFACE", CTYPE)
2016-03-01: wsfulton
Add rstrip encoder for use in %rename. This is like the strip encoder but
strips the symbol's suffix instead of the prefix. The example below
will rename SomeThingCls to SomeThing and AnotherThingCls to AnotherThing:
%rename("%(rstrip:[Cls])s") "";
class SomeThingCls {};
struct AnotherThingCls {};
2016-03-01: olly
Fix isfinite() check to work with GCC6. Fixes
issue #615 reported by jplesnik.
2016-02-17: olly
[Python] Add missing keywords 'as' and 'with' to pythonkw.swg.
2016-02-07: kwwette
[Octave] recognise various unary functions
* Use __float__() for numeric conversions, e.g. when calling double()
* Map various unary functions, e.g. abs() to __abs__(), see full list
in section 32.3.10 of manual; only available in Octave 3.8.0 or later
2016-02-07: kwwette
[Octave] export function swig_octave_prereq() for testing Octave version
2016-02-06: pjohangustavsson
[C#] Fix duplicate symbol problems when linking the source generated
from multiple SWIG modules into one shared library for the -namespace
option. The namespace is now mangled into the global PInvoke function
names.
*** POTENTIAL INCOMPATIBILITY ***
2016-01-27: ahnolds
[Python] Added support for differentiating between Python Bytes
and Unicode objects using by defining SWIG_PYTHON_STRICT_BYTE_CHAR
and SWIG_PYTHON_STRICT_UNICODE_WCHAR.
2016-01-27: steeve
[Go] Ensure structs are properly packed between gc and GCC/clang.
2016-01-25: ahnolds
[Python] Support the full Python test suite in -classic mode
* Convert long/unsigned long/long long/unsigned long long to PyInt
rather than PyLong when possible. Certain python functions like
len() require a PyInt when operating on old-style classes.
* Add support for static methods in classic mode, including support
for pythonappend, pythonprepend, and docstrings.
* Removing the use of __swig_getmethods__ for static member methods
since they will always be found by the standard argument lookup
* Fix a bug where the wrong type of exception was caught when
checking for new-style class support
2016-01-23: ahnolds
[Go] Enable support for the Go test-suite on OSX:
* The linker on OSX requires that all symbols (even weak symbols)
are defined at link time. Because the function _cgo_topofstack is
only defined starting in Go version 1.4, we explicitly mark it as
undefined for older versions of Go on OSX.
* Avoid writing empty swigargs structs, since empty structs are not
allowed in extern "C" blocks.
2016-01-12: olly
[Javascript] Look for "nodejs" as well as "node", as it's packaged
as the former on Debian.
2016-01-12: olly
[Javascript] For v8 >= 4.3.0, use V8_MAJOR_VERSION.
Fixes issue 561.
2016-01-10: ahnolds
Improved size_t and ptrdiff_t typemaps to support large values
on platforms where sizeof(size_t) > sizeof(unsigned long) and
sizeof(ptrdiff_t) > sizeof(long).
Version 3.0.8 (31 Dec 2015)
===========================
2015-12-30: wsfulton
The pdf documentation is now generated by wkhtmltopdf and has colour
for the code snippets just like the html documentation!
2015-12-23: ahnolds
[Python] Fixes for conversion of signed and unsigned integer types:
No longer check for PyInt objects in Python3. Because PyInt_Check
and friends are #defined to the corresponding PyLong methods, this
had caused errors in Python3 where values greater than what could be
stored in a long were incorrectly interpreted as the value -1 with
the Python error indicator set to OverflowError. This applies to
both the conversions PyLong->long and PyLong->double.
Conversion from PyLong to long, unsigned long, long long, and
unsigned long long now raise OverflowError instead of TypeError in
both Python2 and Python3 for PyLong values outside the range
expressible by the corresponding C type. This matches the existing
behavior for other integral types (signed and unsigned ints, shorts,
and chars), as well as the conversion for PyInt to all numeric
types. This also indirectly applies to the size_t and ptrdiff_t
types, which depend on the conversions for unsigned long and long.
2015-12-19: wsfulton
[Python] Python 2 Unicode UTF-8 strings can be used as inputs to char * or
std::string types if the generated C/C++ code has SWIG_PYTHON_2_UNICODE defined.
2015-12-17: wsfulton
Issues #286, #128
Remove ccache-swig.1 man page - please use the CCache.html docs instead.
The yodl2man and yodl2html tools are no longer used and so SWIG no
longer has a dependency on these packages which were required when
building from git.
2015-12-16: zturner/coleb
[Python] Fix Python3.5 interpreter assertions when objects are being
deleted due to an existing exception. Most notably in generators
which terminate using a StopIteration exception. Fixes #559 #560 #573.
If a further exception is raised during an object destruction,
PyErr_WriteUnraisable is used on this second exception and the
original exception bubbles through.
2015-12-14: ahnolds/wsfulton
[Python] Add in missing initializers for tp_finalize,
nb_matrix_multiply, nb_inplace_matrix_multiply, ht_qualname
ht_cached_keys and tp_prev.
2015-12-12: wsfulton
Fix STL wrappers to not generate <: digraphs.
For example std::vector<::X::Y> was sometimes generated, now
corrected to std::vector< ::X::Y >.
2015-11-25: wsfulton
[Ruby] STL ranges and slices fixes.
Ruby STL container setting slices fixes:
Setting an STL container wrapper slice better matches the way Ruby
arrays work. The behaviour is now the same as Ruby arrays. The only
exception is the default value used when expanding a container
cannot be nil as this is not a valid type/value for C++ container
elements.
Obtaining a Ruby STL container ranges and slices fixes:
Access via ranges and slices now behave identically to Ruby arrays.
The fixes are mostly for out of range indices and lengths.
- Zero length slice requests return an empty container instead of nil.
- Slices which request a length greater than the size of the container
no longer chop off the last element.
- Ranges which used to return nil now return an empty array when the
the start element is a valid index.
Ruby STL container negative indexing support improved.
Using negative indexes to set values works the same as Ruby arrays, eg
%template(IntVector) std::vector<int>;
iv = IntVector.new([1,2,3,4])
iv[-4] = 9 # => [1,2,3,9]
iv[-5] = 9 # => IndexError
2015-11-21: wsfulton
[Ruby, Python] Add std::array container wrappers.
These work much like any of the other STL containers except Python/Ruby slicing
is somewhat limited because the array is a fixed size. Only slices of
the full size are supported.
2015-10-10: wsfulton
[Python] #539 - Support Python 3.5 and -builtin. PyAsyncMethods is a new
member in PyHeapTypeObject.
2015-10-06: ianlancetaylor
[Go] Don't emit a constructor function for a director
class with an abstract method, since the function will
always panic.
2015-10-01: wsfulton
Fix %shared_ptr support for private and protected inheritance.
- Remove unnecessary Warning 520: Derived class 'Derived' of 'Base'
is not similarly marked as a smart pointer
- Do not generate code that attempts to cast up the inheritance chain in the
type system runtime in such cases as it doesn't compile and can't be used.
Remove unnecessary warning 520 for %shared_ptr when the base class is ignored.
2015-10-01: vkalinin
Fix #508: Fix segfault parsing anonymous typedef nested classes.
2015-09-26: wsfulton
[Ruby] Add shared_ptr support
2015-09-13: kkaempf
[Ruby] Resolve tracking bug - issue #225.
The bug is that the tracking code uses a ruby hash and thus may
allocate objects (Bignum) while running the GC. This was tolerated in
1.8 but is invalid (raises an exception) in 1.9.
The patch uses a C hash (also used by ruby) instead.
2015-09-09: lyze
[CFFI] Extend the "export" feature in the CFFI module to support
exporting to a specified package.
2015-09-04: olly
[Python] Fix docstrings for %callback functions.
2015-09-03: demi-rluddy
[Go] Removed golang stringing for signed/unsigned char
Changed default handling of signed char* and unsigned char* to be
opaque pointers rather than strings, similarly to how other
languages work.
Any existing code relying on treating signed char* or unsigned
char* as a string can restore the old behavior with typemaps.i by
using %apply to copy the [unchanged] char* behavior.
*** POTENTIAL INCOMPATIBILITY ***
2015-08-07: talby
[Perl] tidy -Wtautological-constant-out-of-range-compare warnings when building generated code under clang
2015-08-07: xantares
[Python] pep257 & numpydoc conforming docstrings:
- Mono-line module docsstring
- Rewrite autodoc parameters section in numpydoc style:
https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt
- One line summary should end with "."
- Adds a blank line after class docstring
2015-08-05: vadz
[Java] Make (char* STRING, size_t LENGTH) typemaps usable for
strings of other types, e.g. "unsigned char*".
Version 3.0.7 (3 Aug 2015)
==========================
2015-08-02: wsfulton
[Java] Fix potential security exploit in generated Java classes.
The swigCPtr and swigCMemOwn member variables in the generated Java
classes are now declared 'transient' by default. Further details of the exploit
in Android is being published in an academic paper as part of USENIX WOOT '15:
https://www.usenix.org/conference/woot15/workshop-program/presentation/peles.
In the unlikely event that you are relying on these members being serializable,
then you will need to override the default javabody and javabody_derived typemaps
to generate the old generated code. The relevant typemaps are in the Lib directory
in the java.swg, boost_shared_ptr.i and boost_intrusive_ptr.i files. Copy the
relevant default typemaps into your interface file and remove the 'transient' keyword.
*** POTENTIAL INCOMPATIBILITY ***
2015-08-01: vadz
Make configure --without-alllang option more useful: it can now be overridden by the following
--with-xxx options, allowing to easily enable just one or two languages.
2015-07-30: wsfulton
Fix #440 - Initialise all newly created arrays when using %array_functions and %array_class
in the carrays.i library - bug is only relevant when using C++.
2015-07-29: wsfulton
[Python] Improve indentation warning and error messages for code in the following directives:
%pythonprepend
%pythonappend
%pythoncode
%pythonbegin
%feature("shadow")
Old error example:
Error: Line indented less than expected (line 3 of pythoncode)
New error example:
Error: Line indented less than expected (line 3 of %pythoncode or %insert("python") block)
as no line should be indented less than the indentation in line 1
Old warning example:
Warning 740: Whitespace prefix doesn't match (line 2 of %pythoncode or %insert("python") block)
New warning example:
Warning 740: Whitespace indentation is inconsistent compared to earlier lines (line 3 of
%pythoncode or %insert("python") block)
2015-07-28: wsfulton
[Python] Fix #475. Improve docstring indentation handling.
SWIG-3.0.5 and earlier sometimes truncated text provided in the docstring feature.
This occurred when the indentation (whitespace) in the docstring was less in the
second or later lines when compared to the first line.
SWIG-3.0.6 gave a 'Line indented less than expected' error instead of truncating
the docstring text.
Now the indentation for the 'docstring' feature is smarter and is appropriately
adjusted so that no truncation occurs.
2015-07-22: wsfulton
Support for special variable expansion in typemap attributes. Example usage expansion
in the 'out' attribute (C# specific):
%typemap(ctype, out="$*1_ltype") unsigned int& "$*1_ltype"
is equivalent to the following as $*1_ltype expands to 'unsigned int':
%typemap(ctype, out="unsigned int") unsigned int& "unsigned int"
Special variables can be used within special variable macros too. Example usage expansion:
%typemap(cstype) unsigned int "uint"
%typemap(cstype, out="$typemap(cstype, $*1_ltype)") unsigned int& "$typemap(cstype, $*1_ltype)"
Special variables are expanded first and hence the above is equivalent to:
%typemap(cstype, out="$typemap(cstype, unsigned int)") unsigned int& "$typemap(cstype, unsigned int)"
which then expands to:
%typemap(cstype, out="uint") unsigned int& "uint"
2015-07-22: lindleyf
Apply patch #439 - support for $typemap() (aka embedded typemaps or special variable
macros) in typemap attributes. A simple example where $typemap() is expanded in the
'out' attribute (C# specific):
%typemap(cstype) unsigned int "uint"
%typemap(cstype, out="$typemap(cstype, unsigned int)") unsigned int& "$typemap(cstype, unsigned int)"
is equivalent to:
%typemap(cstype, out="uint") unsigned int& "uint"
2015-07-18: m7thon
[Python] Docstrings provided via %feature("docstring") are now quoted and added to
the tp_doc slot when using python builtin classes (-builtin). When no docstring is
provided, the tp_doc slot is set to the fully qualified C/C++ class name.
Github issues #445 and #461.
2015-07-17: kwwette
[octave] Support Octave version 4.0.0 (thanks to patches from Orion Poplawski).
2015-07-07: wsfulton
SWIG no longer generates a wrapper for a class' constructor if that class has
any base class with a private destructor. This is because your compiler should
not allow a class to be instantiated if a base has a private destructor. Some
compilers do, so if you need the old behaviour, use the "notabstract" feature, eg:
%feature("notabstract") Derived;
class Base {
~Base() {}
};
struct Derived : Base {};
Version 3.0.6 (5 Jul 2015)
==========================
2015-07-02: wsfulton
Fix syntax error when the template keyword is used in types, eg:
std::template vector<int> v;
2015-07-02: ngladitz
[Lua] Push characters as unformatted 1-character strings to avoid
unprintable characters such as (char)127 being converted to
"<\127>" with Lua 5.3 and later. (github PR #452)
2015-06-29: olly
[Python] Improve handling of whitespace in %pythoncode.
Previously SWIG looked at the indentation of the first line and
removed that many characters from each subsequent line, regardless
of what those characters were. This was made worse because SWIG's
preprocessor removes any whitespace before a '#'. Fixes github
issue #379, reported by Joe Orton.
2015-06-12: wsfulton
[R] Fix #430 - call to SWIG_createNewRef in copyToC was incorrectly named.
2015-06-11: sghirate
[C#] Patch #427 adds in new command line option -outfile to combine all the
generated C# code into a single file.
2015-06-09: wsfulton
Fix seg fault processing C++11 type aliasing. Issue #424.
2015-05-28: wsfulton
[Python] Add new feature "python:cdefaultargs" to control default argument
code generation. By default, SWIG attempts to convert C/C++ default argument values
into Python values and generates code into the Python layer with these values.
Recent versions of SWIG are able to convert more of these values, however, the
new behaviour can be circumvented if desired via this new feature, such that
the default argument values are obtained from the C layer and not the Python layer.
For example:
struct CDA {
int fff(int a = 1, bool b = false);
};
The default code generation in the Python layer is:
class CDA(_object):
...
def fff(self, a=1, b=False):
return _default_args.CDA_fff(self, a, b)
Adding the feature:
%feature("python:cdefaultargs") CDA::fff;
Results in:
class CDA(_object):
...
def fff(self, *args):
return _default_args.CDA_fff(self, *args)
Some code generation modes, eg -builtin and -fastproxy, are unaffected by this as
the default values are always obtained from the C layer.
2015-05-27: wsfulton
[Python] Deal with an integer as the default value of a typedef to bool
parameter in the C++ prototype. See #327. Regression from 3.0.0 onwards.
2015-05-19: olly
[Python] Fix warning when compiling generated code with MSVC.
(Fixes https://sourceforge.net/p/swig/patches/351/ reported by
Mateusz Szyma¿ski).
2015-05-14: wsfulton
Fix seg fault wrapping shared_ptr of classes with private constructors and destructors.
This also fixes the "unref" feature when used on classes with private destructors.
2015-05-10: wsfulton
[Java] Fix multi-argument typemaps (char *STRING, size_t LENGTH)
so that they can be applied to a wider range of types. Fixes #385.
2015-05-07: olly
[Python] Deal with an integer as the default value of a bool
parameter in the C++ prototype. Fixes github #327, reported by
Greg Allen.
2015-05-07: LindleyF
[Java] Allow feature("director") and feature("ref") to be used
together. Github PR#403.
2015-05-05: olly
Suppress warning 325 "Nested class not currently supported (Foo
ignored)" when Foo has already been explicitly ignored with "%ignore".
2015-05-04: wsfulton
Add support for friend templates, including operator overloading - fixes #196. Considering
the example below, previously the operator gave a syntax error and friendfunc incorrectly
warned with:
"Warning 503: Can't wrap 'friendfunc<(Type)>' unless renamed to a valid identifier."
template <class Type> class MyClass {
friend int friendfunc <Type>(double is, MyClass <Type> & x);
friend int operator<< <Type>(double un, const MyClass <Type> &x);
};
The following also previously incorrectly warned with:
"Warning 302: Identifier 'template_friend' redefined (ignored),"
template<typename T> T template_friend(T);
struct MyTemplate {
template<typename T> friend T template_friend(T);
};
2015-05-01: wsfulton
Fix handling of conversion operators where the operator is split over multiple
lines or has comments within the operator type. Fixes #401.
Also fix similar problem with normal operators which gave a syntax error if split over
multiple lines or had a comment within the operator declaration.
2015-04-30: olly
Ignore unknown preprocessor directives which are inside an inactive
conditional (github issue #394, reported by Dan Wilcox).
Regression introduced in 3.0.3.
2015-04-27: vadz
[Python] Fix "default" typemap used after an argument with "numinputs=0" (#377).
2015-04-24: wsfulton
[Python] Fix #256. Code generated with '-builtin -modernargs' segfaults for any
method taking zero arguments.
Also fixes: "SystemError: error return without exception set" during error checking
when using just -builtin and the incorrect number of arguments is passed to a class
method expecting zero arguments.
2015-04-23: wsfulton
[Java] Bug #386 - Memory leak fix in (char *STRING, size_t LENGTH) typemaps.
2015-04-23: vadz
[Python] Make "default" typemap work again (#330, #377).
2015-04-23: vadz
[Python] Fix the use of default values for the pointer types (#365, #376).
2015-04-23: wsfulton
Fix 'make check-ccache' which is part of 'make check' when one of the CCACHE_
environment variables, for example CCACHE_DISABLE, is set.
2015-04-14: wsfulton
Clearer warning message for badly constructed typecheck typemaps. For example, was:
example.i:3: Warning 467: Overloaded foo(int) not supported (no type checking
rule for 'int').
Now:
example.i:3: Warning 467: Overloaded foo(int) not supported (incomplete type checking
rule - no precedence level in typecheck typemap for 'int').
2015-04-11: wsfulton
[Java] Fix #353 - Linker multiple definition of 'ExceptionMatches' when
using directors and multiple modules.
2015-04-11: wsfulton
Merge #320 - Make __dict__ accessible for Python builtin classes.
2015-04-07: wsfulton
Fix #375 - parsing of extern "C" and typedef for example:
extern "C" typedef void (*Hook2_t)(int, const char *);
extern "C" typedef int Integer;
2015-03-12: olly
-DSWIG_DIRECTOR_STATIC is now supported for all languages with
director support, not only Python and PHP.
2015-03-02: ianlancetaylor
[Go] Add -cgo option, required for Go versions 1.5 and
later.
2015-02-26: olly
Fix segmentation fault when top==NULL, introduced by nested class
handling (reported in issue#346 by Pawe¿ Tomulik).
2015-02-09: wsfulton
[Guile] Fix generated code for static const char member variables when
defined and declared inline.
2015-02-09: mishas
[Go] Fix %import of files in sub directories.
2015-02-05: ianlancetaylor
[Go] Ignore Go specific type maps (goin, goout, etc.) if they are empty.
2015-02-05: ianlancetaylor
[Go] Generated Go code no longer calls _swig_goallocate or
_swig_makegostring, as they will no longer work as of Go 1.5.
Version 3.0.5 (31 Jan 2015)
===========================
2015-01-30: wsfulton
[Python] Fix Python -classic and property setting. Setting properties on classic classes
was broken in swig-3.0.3 by attempting to use __setattr__. This regression is fixed now
by using __dict__ again when using -classic.
Fixes patch #232.
2015-01-27: smarchetto
[Scilab] Support for the Scilab language has been added
2015-01-23: olly
[PHP] When wrapping a returned resource as an object, check if all
cases wrap it in the same class, and if so eliminate the pointless
switch statement wrapper we previously generated.
2015-01-22: wsfulton
[Octave] Merge patch #297 for SF bug #1277 - Octave shared_ptr support
2015-01-15: wsfulton
[Python] Merge patch #250 - Fixes for using %constant and objects (non-primitive types)
2015-01-15: wsfulton
[C# Go] Merge patch #308 and fix #307 - C++11 strongly typed enum support
in directors
2015-01-15: wsfulton
[Python] Second fix for #294 #296 - Regression introduced in SWIG-3.0.3 when
wrapping functions with default arguments, this time when using kwargs.
Version 3.0.4 (14 Jan 2015)
===========================
2015-01-12: olly
[PHP] Fix segfault in director upcall check when using PHP built with
ZTS enabled. Fixes #155, reported by Pierre Labastie.
2015-01-12: vadz
[Python] Fix #294 #296 - Regression introduced in SWIG-3.0.3 when
wrapping functions with default arguments. Invalid or missing default
arguments were sometimes being generated into the python layer.
2015-01-08: olly
Allow C++11 "explicit constexpr". Fixes github issue #284 reported
by Pawel Tomulik. Also handle "constexpr explicit" and "constexpr
static".
2015-01-08: olly
When reporting an error for a construct which hasn't been
terminated when the end of the file is reached, report it at the
start line rather than "EOF" as then tools like editors and IDEs
will take you to a generally more useful place for fixing the
problem.
2015-01-08: olly
Improve error messages for a few cases which previously gave the
one of the cryptic catch-all errors "Syntax error in input".
2015-01-08: olly
Provide -cppext as a general command line option for setting the
extension used for generated C++ files (previously it was specific
to the PHP backend). Deprecate the equivalent -suffix option
provided by the Ocaml backend, but continue to support that for
now.
Version 3.0.3 (30 Dec 2014)
===========================
2014-12-27: wsfulton
Fix #280 - abort using all default template parameters within other template
parameters.
2014-12-27: talby
[Perl] Issue #282 perl5 archlib vs archlibexp
[Perl] tidy "warning: duplicate 'extern' declaration specifier" when building generated code
under clang
2014-12-18: wsfulton
Add support for %constant and structs/classes - issue #272
2014-12-09: wsfulton
Fix #245 - regression (since swig-3.0.0) in templated constructors.
Templated constructors could not be instantiated - they were incorrectly ignored with a warning 504:
"Function: xyz must have a return type. Ignored."
2014-12-07: wsfulton
Add support for C++11 strongly typed enumerations.
2014-11-21: wsfulton
[Java C#] Fix multiply defined error when using %rename of enum items when using the "simple enum"
wrappers.
2014-10-28: vadz
[Python] Patch #201 The generated .py file no longer uses *args for all Python parameters.
Instead, the parameters are named using the C++ parameter names.
"compactdefaultargs" feature can be enabled to restore the old behaviour.
*** POTENTIAL INCOMPATIBILITY ***
2014-10-24: timotheecour
[D] Patch #204 Use core.atomic.atomicOp to mutate shared variables
2014-10-21: wsfulton
Fix issue #242 - Use of the "kwargs" feature no longer automatically turns on the
"compactdefaultargs" feature if the target language does not support kwargs.
This change affects all languages except Python and Ruby.
*** POTENTIAL INCOMPATIBILITY ***
2014-10-10: diorcety
[Python] Patch #232 Fix property access using directors
2014-10-06: wsfulton
[Python] Fixes when using -builtin and std::vector/std::list wrappers to allow deletion
of single elements, such as 'del vec[0]'.
2014-09-30: oliverb
[Javascript] Merge patch #216 by Richie765 - Added support for many versions of v8 javascript.
2014-09-30: oliverb
[Javascript] Merge patch #195 by zittix - Fixed JSClassRef declaration not using the static one.
2014-09-30: ianlancetaylor
[Go] In configure script, require Go 1.1 or later.
2014-09-30: wsfulton
[Python] Patch #207 - Fix No module error with -relativeimport when using single
header file import.
2014-09-27: wsfulton
Patch #208 - Initialise newly created array when using array_functions in the
carrays.i library (C++ usage).
2014-09-27: wsfulton
[Ruby] Patch #187 - Fix crash on shutdown of the Ruby interpreter if more than one
module was loaded at a time when data is being shared between modules.
2014-09-27: wsfulton
[Java] Patch #168 - Fix leak in Java director string handling after the Java
upcall when called from a native thread.
2014-09-25: ianlancetaylor
[Go] Adjust generated code to work with upcoming Go 1.4
release.
2014-09-23: wsfulton
[Python] Add patch from Thomas Maslach to fix crash in wrappers when using -threads in
the STL iterators (SwigPyIterator destructor).
2014-09-17: wsfulton
[C#] Merge patch #229 from contre - Add bool array types to arrays_csharp.i
2014-09-12: olly
[PHP] Add support for specifying any PHP interfaces a wrapped class
implements, e.g.: %typemap("phpinterfaces") MyIterator "Iterator"
2014-09-11: olly
[PHP] Fix throwing a PHP exception through C++ from a subclassed
director method - PHP NULL gets returned by the subclassed method
in this case, so the directorout typemap needs to allow that (at
least if an exception is active).
2014-09-09: ianlancetaylor
[Go] Add goargout typemap.
2014-09-09: olly
[PHP] Fix segmentation faults with directors in PHP >= 5.4, and
reenable runme tests for director_basic testcase. Fix from
pavel-charvat in issue#164.
2014-09-05: ianlancetaylor
[Go] Add imtype, goin, goout, godirectorin, and
godirectorout typemaps, to support writing Go code to
convert between types.
2014-09-02: olly
[Python] Fix regression in indentation of python code produced with
-modern, introduced by changes in #188. Reported by fabiencastan
in #218.
2014-09-01: olly
Issue an error for unknown SWIG preprocessor directives, rather
than quietly ignoring them. Reported by jrhelsey in issue#217.
*** POTENTIAL INCOMPATIBILITY ***
2014-08-15: talby
[Perl] Include guard fix for nested modules from Anthony Heading (SF Patch #350).
2014-08-04: wsfulton
[C#] Merge patch #200 from gpetrou - Changed CSharp license header to include auto-generated
tag so that StyleCop ignores the files.
2014-08-04: wsfulton
[Java] Merge patch #198 from Yuval Kashtan - Support for java.nio.ByteBuffer mapping to
unsigned char * in various.i in NIOBUFFER typemaps.
2014-07-14: ianlancetaylor
[Go] Change struct definition to use void *, not uint8, so
that the type is recorded as possibly containing
pointers. This ensures that the 1.3 garbage collector
does not collect pointers passed to C++ code.
2014-07-01: wsfulton
Fix SF Bug #1375 - Expansion of the $parentclassname special variable incorrectly contains
brackets in the expanded name.
Version 3.0.2 (4 Jun 2014)
==========================
2014-06-02: v-for-vandal
[Lua] Pull request #176:
If class has no __eq implemented, then default __eq is generated.
Default __eq compares actual pointers stored inside Lua userdata.
2014-06-02: vkalinin
Fix #183 - %extend and unnamed nested structs
2014-05-28: kwwette
Fix install failure when using an 'out of source' build using the shipped
tarball - regression introduced in swig-3.0.1.
2014-05-24: kwwette
[Octave] Remove deprecated -global/-noglobal command-line arguments
*** POTENTIAL INCOMPATIBILITY ***
Version 3.0.1 (27 May 2014)
===========================
2014-05-25: hfalcic
[Python] Python 3 byte string output: use errors="surrogateescape"
if available on the version of Python that's in use. This allows
obtaining the original byte string (and potentially trying a fallback
encoding) if the bytes can't be decoded as UTF-8.
Previously, a UnicodeDecodeError would be raised with no way to treat
the data as bytes or try another codec.
2014-05-18: vkalinin
Bug #175 - Restore %extend to work for unnamed nested structures by using a C
symbol comprising the outer structure name and unnamed variable instance name.
2014-05-15: kwwette
Add #166 - 'make check' now works out of source. This required the examples to build
out of source. The main languages have been tested - C#, Go, Guile, Java, Javascript,
Lua, Octave, Perl, PHP, Python, Ruby and Tcl.
2014-05-01: Oliver Buchtala
Javascript support added, see Javascript chapter in the documentation.
2014-05-01: olly
[PHP] The generated __isset() method now returns true for read-only properties.
2014-04-24: kwwette
[Go] Fix go ./configure parsing of gccgo --version, and
goruntime.swg typo in __GNUC_PATCHLEVEL__ (SF Bug #1298)
2014-04-24: kwwette
Fix {python|perl5|ruby|tcl}/java examples
In Lib/gcj/cni.i, for compatibility with newer gcj versions:
- remove JvAllocObject() which gcj no longer defines, from gcj Changelog:
2004-04-16 Bryce McKinlay <mckinlay@redhat.com>
* gcj/cni.h (JvAllocObject): Remove these obsolete,
undocumented CNI calls.
- change JvCreateJavaVM() argument from void* to JvVMInitArgs*, from gcj Changelog:
2005-02-23 Thomas Fitzsimmons <fitzsim@redhat.com>
PR libgcj/16923
...
(JvCreateJavaVM): Declare vm_args as JvVMInitArgs* rather than void*.
*** POTENTIAL INCOMPATIBILITY ***
2014-04-08: wsfulton
SF Bug #1366 - Remove duplicate declarations of strtoimax and strtoumax in inttypes.i
2014-04-08: wsfulton
[Java C#] Enums which have been ignored via %ignore and are subsequently
used are handled slightly differently. Type wrapper classes are now generated
which are effectively a wrapper of an empty enum. Previously in Java uncompilable
code was generated and in C# an int was used.
2014-04-04: wsfulton
Fix regression in 3.0.0 where legal code following an operator<< definition might
give a syntax error. SF Bug #1365.
2014-04-03: olly
[PHP] Fix wrapping director constructors with default parameters
with a ZTS-enabled build of PHP.
2014-04-02: olly
[PHP] Pass the ZTS context we already have to avoid needing to
call TSRMLS_FETCH, which is relatively expensive.
2014-04-02: olly
[PHP] Pass ZTS context through to t_output_helper() so it works
with a ZTS-enabled build of PHP. Reported by Pierre Labastie in
github PR#155.
2014-03-28: wsfulton
[Java C# D Go] Fixes for C enums used in an API and the definition of the enum
has not been parsed. For D, this fixes a segfault in SWIG. The other languages
now produce code that compiles, although the definition of the enum is needed
in order to use the enum properly from the target language.
2014-03-23: v-for-vandal
[Lua] Fix for usage of snprintf in Lua runtime which Visual Studio does not have.
Version 3.0.0 (16 Mar 2014)
===========================
2014-03-16: wsfulton
C++11 support initially developed as C++0x support by Matevz Jekovec as a Google Summer of Code
project has been further extended. The C++11 support is comprehensive, but by no means complete
or without limitations. Full details for each new feature in C++11 is covered in the
CPlusPlus11.html chapter in the documentation which is included in SWIG and also available
online at https://www.swig.org/Doc3.0/CPlusPlus11.html.
2014-03-14: v-for-vandal
[Lua] Numerous Lua improvements:
1. %nspace support has been added. Namespaces are mapped to tables in the module, with the same
name as the C++ namespace.
2. Inheritance is now handled differently. Each class metatable keeps a list of class bases instead
of merging all members of all bases into the derived class.
3. The new metatables result in differences in accessing class members. For example:
%module example
struct Test {
enum { TEST1 = 10, TEST2 = 20 };
static const int ICONST = 12;
};
Now this can be used as follows:
print(example.Test.TEST1)
print(example.Test.ICONST)
The old way was:
print(example.Test_TEST1)
print(example.Test_ICONST)
4. The special class metatable member ".constructor" was removed. Now SWIG generates the proxy
function by itself and assigns it directly to the class table "__call" method.
5. eLua should also now support inheritance.
6. 'const' subtable in eLua is considered deprecated.
Changes in behaviour:
a. You can no longer assign to non-existing class members in classes without a __setitem__ method.
It will cause a Lua error.
b. You can no longer iterate over a module table and copy everything into the global namespace.
Actually, this was never the case, but it is now explicitly prohibited.
c. Now changing a base class will immediately affect all derived classes.
d. There might be some issues with inheritance. Although the bases iteration scheme is the same
as was used for merging base classes into derived one, some unknown issues may arise.
The old metatable behaviour can be restored by using the -no-old-metatable-bindings option.
*** POTENTIAL INCOMPATIBILITY ***
2014-03-06: wsfulton
[Python] Change in default behaviour wrapping C++ bool. Only a Python True or False
will now work for C++ bool parameters. This fixes overloading bool with other types.
Python 2.3 minimum is now required for wrapping bool.
When wrapping:
const char* overloaded(bool value) { return "bool"; }
const char* overloaded(int value) { return "int"; }
Previous behaviour:
>>> overloaded(False)
'int'
>>> overloaded(True)
'int'
>>> overloaded(0)
'int'
Now we get the expected behaviour:
>>> overloaded(False)
'bool'
>>> overloaded(0)
'int'
The consequence is when wrapping bool in non-overloaded functions:
const char* boolfunction(bool value) { return value ? "true" : "false"; }
The previous behaviour was very Pythonic:
>>> boolfunction("")
'false'
>>> boolfunction("hi")
'true'
>>> boolfunction(12.34)
'true'
>>> boolfunction(0)
'false'
>>> boolfunction(1)
'true'
Now the new behaviour more along the lines of C++ due to stricter type checking. The
above calls result in an exception and need to be explicitly converted into a bool as
follows:
>>> boolfunction(0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: in method 'boolfunction', argument 1 of type 'bool'
>>> boolfunction(bool(0))
'false'
The old behaviour can be resurrected by passing the -DSWIG_PYTHON_LEGACY_BOOL command line
parameter when executing SWIG. Typemaps can of course be written to customise the behaviour
for specific parameters.
*** POTENTIAL INCOMPATIBILITY ***
2014-03-06: wsfulton
Fix SF Bug #1363 - Problem with method overloading when some methods are added by %extend
and others are real methods and using template default parameters with smart pointers.
This is noticeable as a regression since 2.0.12 when using the default smart pointer
handling for some languages when the smart pointer wraps std::map and other STL containers.
2014-03-02: wsfulton
[Python] SF Patch #346 from Jens Krueger. Correct exception thrown attempting to
access a non-existent C/C++ global variable on the 'cvar' object. The exception thrown
used to be a NameError. However, as this access is via a primary, an AttributeError
is more correct and so the exception thrown now is an AttributeError. Reference:
http://docs.python.org/2/reference/expressions.html#attribute-references
*** POTENTIAL INCOMPATIBILITY ***
2014-03-01: wsfulton
[Python] Patch #143 Fix type shown when using type() to include the module and package
name when using -builtin.
2014-03-01: wsfulton
[Python] SF patch #347 Fix missing argument count checking with -modern.
Fixes regression introduced when builtin changes were introduced in SWIG-2.0.3.
2014-02-21: wsfulton
[PHP] Fix warning suppression using %warnfilter for PHP reserved class names.
2014-02-19: olly
[Lua] Add keyword warnings for Lua keywords and Basic Functions.
2014-02-19: olly
-Wallkw now includes keywords for all languages with keyword
warnings (previously Go and R were missing).
2014-02-19: olly
[PHP] Update the lists of PHP keywords with new ones from PHP 5.4
and newer (and some missing ones from 5.3). Reserved PHP constants
names are now checked against enum values and constants, instead
of against function and method names. Built-in PHP function names
no longer match methods added by %extend. Functions and methods
named '__sleep', '__wakeup', 'not', 'parent', or 'virtual' are no
longer needlessly renamed.
2014-02-15: wsfulton
Fix the %$ismember %rename predicates to also apply to members added via %extend.
Add %$isextendmember for %rename of members added via %extend. This can be used to
distinguish between normal class/struct members and %extend members. For example
'%$ismember, %$not %$isextendmember' will now identify just class/struct members.
*** POTENTIAL INCOMPATIBILITY ***
2014-02-16: hfalcic
[Python] Patch #137 - fix crashes/exceptions in exception handling in Python 3.3
2014-02-15: wsfulton
[Java] Add support for the cdata library.
2014-02-08: vkalinin
Nested class support added. This primarily allows SWIG to properly parse nested
classes and keep the nested class information in the parse tree. Java and C#
have utilised this information wrapping the C++ nested classes as Java/C#
nested classes. The remaining target languages ignore nested classes as in
previous versions. Help is needed by users of these remaining languages to
design how C++ nested classes can be best wrapped. Please talk to us on the
swig-devel mailing list if you think you can help.
Previously, there was limited nested class support. Nested classes were treated
as opaque pointers. However, the "nestedworkaround" feature provided a way to
wrap a nested class as if it was a global class. This feature no longer exists
and is replaced by the new "flatnested" feature. This effectively does the same
thing with less manual code to be written. Please see the 'Nested classes'
section in the documentation in SWIGPlus.html if you were previously using this
feature.
SWIG now parses the contents of nested classes where previously it did not. You
may find that you will need to make adjustments to your interface file as
effectively extra code is being wrapped.
*** POTENTIAL INCOMPATIBILITY ***
2014-02-06: gjanssens
[Guile] Patch #133. Make scm to string conversion work with non-ascii strings.
Guile 2 has a completely rewritten string implementation. SWIG made some assumptions
that are no longer valid as to the internals of guile's string representation.
2014-01-30: wsfulton
[C#] Add new swigtype_inout.i library containing SWIGTYPE *& OUTPUT typemaps.
Example usage wrapping:
void f(XXX *& x) { x = new XXX(111); }
would be:
XXX x = null;
f(out x);
// use x
x.Dispose(); // manually clear memory or otherwise leave out and leave it to the garbage collector
2014-01-21: ianlancetaylor
[Go] Add %go_import directive.
2014-01-21: ianlancetaylor
[Go] Add support for Go 1.3, not yet released.
2014-01-20: wsfulton
Director exceptions (Swig::DirectorException) now derive from std::exception
and hence provide the what() method. In Python and Ruby, this replaces the now
deprecated DirectorException::getMessage() method.
2014-01-14: diorcety
Patch #112 - Fix symbol resolution involving scopes that have multiple levels
of typedefs - fixes some template resolutions as well as some typemap searches.
2014-01-11: wsfulton
Fix and document the naturalvar feature override behaviour - the naturalvar
feature attached to a variable name has precedence over the naturalvar
feature attached to the variable's type. The overriding was not working
when turning the feature off on the variable's name.
Fix so that any use of the naturalvar feature will override the global
setting. Previously when set globally by -naturalvar or %module(naturalvar=1),
use of the naturalvar feature was not always honoured.
2014-01-06: ianlancetaylor
[Go] Fix bug that broke using directors from a thread not
created by Go.
2013-12-24: ptomulik
[Python] SF Bug #1297
Resolve several issues related to python imports.
For example, it's now possible to import modules having the same module
names, but belonging in different packages.
From the user's viewpoint, this patch gives a little bit more control on
import statements generated by SWIG. The user may choose to use relative
or absolute imports.
Some details:
- we (still) generate import statements in the form 'import a.b.c' which
corresponds to absolute imports in python3 and (the only available)
ambiguous one in python2.
- added -relativeimport option to use explicit relative import syntax
(python3),
The "Python Packages" section in the documentation discusses how to work
with importing packages including the new -relativeimport command line option.
2013-12-23: vadz
[Octave, Perl, Python, R, Ruby, Tcl] Change the length of strings created from fixed-size char
buffers in C code.
This is a potential backwards compatibility break: a "char buf[5]" containing "ho\0la" was
returned as a string of length 5 before, but is returned as a string of length 2 now. Also,
it was possible to assign a (non-NUL-terminated) string "hello" to such a buffer before but
now this fails and only "helo" can fit.
Apply "char FIXSIZE[ANY]" typemaps to explicitly choose the old behaviour.
*** POTENTIAL INCOMPATIBILITY ***
2013-12-23: talby
[Perl] Add support for directors.
2013-12-18: ianlancetaylor
[Go] Don't require that Go environment variables be set
when running examples or testsuite when using Go 1 or
later.
2013-12-17: ianlancetaylor
[Go] Remove -longsize option (for backward compatibility,
ignore it if seen).
2013-12-17: ianlancetaylor
[Go] Add -go-pkgpath option.
2013-12-16: ianlancetaylor
[Go] Update for Go 1.2 release. Add support for linking
SWIG code directly into executable, rather than using a
shared library.
2013-12-13: ianlancetaylor
[Go] Add SWIG source file name as comments in generated
files. This can be used by Go documentation tools.
2013-12-12: jleveque
[Lua] Fix typo (wchar instead of wchar_t) which made wchar.i
for Lua useless.
2013-12-12: vmiklos
[PHP] PHP's peculiar call-time pass-by-reference feature was
deprecated in PHP 5.3 and removed in PHP 5.4, so update the REF
typemaps in phppointers.i to specify pass-by-reference in the
function definition. Examples/php/pointer has been updated
accordingly.
2013-12-12: olly
[PHP] The usage of $input in PHP directorout typemaps has been
changed to be consistent with other languages. The typemaps
provided by SWIG have been updated accordingly, but if you
have written your own directorout typemaps, you'll need to
update $input to &$input (or make equivalent changes).
*** POTENTIAL INCOMPATIBILITY ***
2013-11-27: vadz
[C#, Java, Python] Add std_auto_ptr.i defining typemaps for returning std::auto_ptr<>.
2013-11-09: wsfulton
[C#] Apply patch #79 from Brant Kyser
- Remove using directives from the generated C# code and fully qualify the use of all .NET
framework types in order to minimize potential name collisions from input files defining
types, namespace, etc with the same name as .NET framework members.
- Globally qualify the use of .NET framework types in the System namespace
- Remove .NET 1.1 support, .NET 2 is the minimum for the C# module
This is a potential backwards compatibility break if code has been added relying on these using
statements that used to be generated:
using System;
using System.Runtime.InteropServices;
The quick fix to add these back in is to add the -DSWIG2_CSHARP command line option when
executing SWIG. See CSharp.html documentation for more info.
*** POTENTIAL INCOMPATIBILITY ***
2013-11-05: wsfulton
[Java] Fix some corner cases for the $packagepath/$javaclassname special variable substitution.
2013-11-05: wsfulton
[Java] Apply patch #91 from Marvin Greenberg - Add director:except feature for improved
exception handling in director methods for Java.
2013-10-15: vadz
Allow using \l, \L, \u, \U and \E in the substitution part of %(regex:/pattern/subst/)
inside %rename to change the case of the text being replaced.
2013-10-12: wsfulton
[CFFI] Apply #96 - superclass not lispify
2013-10-12: wsfulton
Merge in C++11 support from the gsoc2009-matevz branch where Matevz Jekovec first
started the C++0x additions. Documentation of the C++11 features supported is in a
new Chapter of the documentation, "SWIG and C++11" in Doc/Manual/CPlusPlus11.html.
2013-10-04: wsfulton
Fix %naturalvar not having any affect on templated classes instantiated with an
enum as the template parameter type. Problem reported by Vadim Zeitlin.
2013-09-20: wsfulton
[Java] Fix a memory leak for the java char **STRING_ARRAY typemaps.
Version 2.0.12 (9 Feb 2014)
===========================
2014-01-16: wsfulton
[PHP] Fix compilation error in ZTS mode (64 bit windows) due to incorrect placement
of TSRMLS_FETCH() in SWIG_Php_GetModule() as reported by Mark Dawson-Butterworth.
2014-01-13: kwwette
[Octave] update support to Octave version 3.8.0
- Octave 3.8.0 no longer defines OCTAVE_API_VERSION_NUMBER, but 3.8.1
will define OCTAVE_{MAJOR,MINOR,PATCH}_VERSION instead: see
http://hg.savannah.gnu.org/hgweb/octave/rev/b6b6e0dc700e
So we now use a new macro SWIG_OCTAVE_PREREQ(major,minor,patch) to
enable features requiring Octave version major.minor.patch or later.
For Octave versions prior to 3.8.1, we reconstruct values for
OCTAVE_{MAJOR,MINOR,PATCH}_VERSION based on OCTAVE_API_VERSION_NUMBER,
extracted from Octave's ChangeLogs. An additional hack is needed to
distinguish between Octave <= 3.2.x and 3.8.0, neither of which define
OCTAVE_API_VERSION_NUMBER.
- Octave 3.8.0 deprecates symbol_table::varref(), so remove its use
for this and future versions of Octave.
- Octave 3.8.0 removes octave_value::is_real_nd_array(), used in
octave_swig_type::dims(). Its use is not required here, so remove it.
- Retested against Octave versions 3.0.5, 3.2.4, 3.4.3, 3.6.4, and 3.8.0.
- Updated Octave documentation with tested Octave versions, and added a
warning against using versions <= 3.x.x, which are no longer tested.
2013-12-22: wsfulton
C++11 support for new versions of erase and insert in the STL containers.
The erase and insert methods in the containers use const_iterator instead
of iterator in C++11. There are times when the methods wrapped must match
the parameters exactly. Specifically when full type information for
template types is missing or SWIG fails to look up the type correctly,
for example:
%include <std_vector.i>
typedef float Real;
%template(RealVector) std::vector<Real>;
SWIG does not find std::vector<Real>::iterator because %template using
typedefs does not always work and so SWIG doesn't know if the type is
copyable and so uses SwigValueWrapper<iterator> which does
not support conversion to another type (const_iterator). This resulted
in compilation errors when using the C++11 version of the containers.
Closes #73
2013-10-17: wsfulton
[R] Fix SF #1340 - Visual Studio compile error in C++ wrappers due to #include <exception>
within extern "C" block.
2013-10-17: wsfulton
[Python] Fix SF #1345 - Missing #include <stddef.h> for offsetof when using -builtin.
2013-10-12: wsfulton
[Lua] Apply #92 - missing return statements for SWIG_Lua_add_namespace_details()
and SWIG_Lua_namespace_register().
Version 2.0.11 (15 Sep 2013)
============================
2013-09-15: wsfulton
[R] Fix attempt to free a non-heap object in OUTPUT typemaps for:
unsigned short *OUTPUT
unsigned long *OUTPUT
signed long long *OUTPUT
char *OUTPUT
signed char*OUTPUT
unsigned char*OUTPUT
2013-09-12: wsfulton
[Lua] Pull Git patch #62.
1) Static members and static functions inside class can be accessed as
ModuleName.ClassName.FunctionName (MemberName respectively). Old way such as
ModuleName.ClassName_FunctionName still works.
2) Same goes for enums inside classes: ModuleName.ClassName.EnumValue1 etc.
2013-09-12: wsfulton
[UTL] Infinity is now by default an acceptable value for type 'float'. This fix makes
the handling of type 'float' and 'double' the same. The implementation requires the
C99 isfinite() macro, or otherwise some platform dependent equivalents, to be available.
Users requiring the old behaviour of not accepting infinity, can define a 'check' typemap
wherever a float is used, such as:
%typemap(check,fragment="<float.h>") float, const float & %{
if ($1 < -FLT_MAX || $1 > FLT_MAX) {
SWIG_exception_fail(SWIG_TypeError, "Overflow in type float");
}
%}
*** POTENTIAL INCOMPATIBILITY ***
2013-08-30: wsfulton
[Lua] Pull Git patch #81: Include Lua error locus in SWIG error messages.
This is standard information in Lua error messages, and makes it much
easier to find bugs.
2013-08-29: wsfulton
Pull Git patch #75: Handle UTF-8 files with BOM at beginning of file. Was giving an
'Illegal token' syntax error.
2013-08-29: wsfulton
[C#] Pull Git patch #77: Allow exporting std::map using non-default comparison function.
2013-08-28: wsfulton
[Python] %implicitconv is improved for overloaded functions. Like in C++, the methods
with the actual types are considered before trying implicit conversions. Example:
%implicitconv A;
struct A {
A(int i);
};
class CCC {
public:
int xx(int i) { return 11; }
int xx(const A& i) { return 22; }
};
The following python code:
CCC().xx(-1)
will now return 11 instead of 22 - the implicit conversion is not done.
2013-08-23: olly
[Python] Fix clang++ warning in generated wrapper code.
2013-08-16: wsfulton
[Python] %implicitconv will now accept None where the implicit conversion takes a C/C++ pointer.
Problem highlighted by Bo Peng. Closes SF patch #230.
2013-08-07: wsfulton
[Python] SF Patch #326 from Kris Thielemans - Remove SwigPyObject_print and SwigPyObject_str and
make the generated wrapper use the default python implementations, which will fall back to repr
(for -builtin option).
Advantages:
- it avoids the swig user having to jump through hoops to get print to work as expected when
redefining repr/str slots.
- typing the name of a variable on the python prompt now prints the result of a (possibly redefined)
repr, without the swig user having to do any extra work.
- when redefining repr, the swig user doesn't necessarily have to redefine str as it will call the
redefined repr
- the behaviour is exactly the same as without the -builtin option while requiring no extra work
by the user (aside from adding the %feature("python:slot...) statements of course)
Disadvantage:
- default str() will give different (but clearer?) output on swigged classes
2013-07-30: wsfulton
[Python, Ruby] Fix #64 #65: Missing code in std::multimap wrappers. Previously an instantiation
of a std::map was erroneously required in addition to an instantiation of std::multimap with the
same template parameters to prevent compilation errors for the wrappers of a std::multimap.
2013-07-14: joequant
[R] Change types file to allow for SEXP return values
2013-07-05: wsfulton
[Python] Add %pythonbegin directive which works like %pythoncode, except the specified code is
added at the beginning of the generated .py file. This is primarily needed for importing from
__future__ statements required to be at the very beginning of the file. Example:
%pythonbegin %{
from __future__ import print_function
print("Loading", "Whizz", "Bang", sep=' ... ')
%}
2013-07-01: wsfulton
[Python] Apply SF patch #340 - Uninitialized variable fix in SWIG_Python_NonDynamicSetAttr
when using -builtin.
2013-07-01: wsfulton
[Python, Ruby, Ocaml] Apply SF patch #341 - fix a const_cast in generated code that was generating
a <:: digraph when using the unary scope operator (::) (global scope) in a template type.
2013-07-01: wsfulton
[Python] Add SF patch #342 from Christian Delbaere to fix some director classes crashing on
object deletion when using -builtin. Fixes SF bug #1301.
2013-06-11: wsfulton
[Python] Add SWIG_PYTHON_INTERPRETER_NO_DEBUG macro which can be defined to use the Release version
of the Python interpreter in Debug builds of the wrappers. The Visual Studio .dsp example
files have been modified to use this so that Debug builds will now work without having
to install or build a Debug build of the interpreter.
2013-06-07: wsfulton
[Ruby] Git issue #52. Fix regression with missing rb_complex_new function for Ruby
versions prior to 1.9 using std::complex wrappers if just using std::complex as an output type.
Also fix the Complex helper functions external visibility (to static by default).
2013-06-04: olly
[PHP] Fix SWIG_ZTS_ConvertResourcePtr() not to dereference NULL
if the type lookup fails.
Version 2.0.10 (27 May 2013)
============================
2013-05-25: wsfulton
[Python] Fix Python 3 inconsistency when negative numbers are passed
where a parameter expects an unsigned C type. An OverFlow error is
now consistently thrown instead of a TypeError.
2013-05-25: Artem Serebriyskiy
SVN Patch ticket #338 - fixes to %attribute macros for template usage
with %arg.
2013-05-19: wsfulton
Fix ccache-swig internal error bug due to premature file cleanup.
Fixes SF bug 1319 which shows up as a failure in the ccache tests on
Debian 64 bit Wheezy, possibly because ENABLE_ZLIB is defined.
This is a corner case which will be hit when the maximum number of files
in the cache is set to be quite low (-F option), resulting in a cache miss.
2013-05-09: kwwette
[Octave] Fix bugs in Octave module loading:
- fix a memory leak in setting of global variables
- install functions only once, to speed up module loads
2013-04-28: gjanssens
[Guile] Updates in guile module:
- Add support for guile 2.0
- Drop support for guile 1.6
- Drop support for generating wrappers using guile's gh interface.
All generated wrappers will use the scm interface from now on.
- Deprecate -gh and -scm options. They are no longer needed.
A warning will be issued when these options are still used.
- Fix all tests and examples to have a successful travis test
2013-04-18: wsfulton
Apply Patch #36 from Jesus Lopez to add support for $descriptor() special variable macro expansion
in fragments. For example:
%fragment("nameDescriptor", "header")
%{
static const char *nameDescriptor = "$descriptor(Name)";
%}
which will generate into the wrapper if the fragment is used:
static const char *nameDescriptor = "SWIGTYPE_Name";
2013-04-18: wsfulton
Fix SF Bug #428 - Syntax error when preprocessor macros are defined inside of enum lists, such as:
typedef enum {
eZero = 0
#define ONE 1
} EFoo;
The macros are silently ignored.
2013-04-17: wsfulton
[C#] Pull patch #34 from BrantKyser to fix smart pointers in conjunction with directors.
2013-04-15: kwwette
[Octave] Fix bugs in output of cleanup code.
- Cleanup code is now written also after the "fail:" label, so it will be called if
a SWIG_exception is raised by the wrapping function, consistent with other modules.
- Octave module now also recognises the "$cleanup" special variable, if needed.
2013-04-08: kwwette
Add -MP option to SWIG for generating phony targets for all dependencies.
- Prevents make from complaining if header files have been deleted before
the dependency file has been updated.
- Modelled on similar option in GCC.
2013-04-09: olly
[PHP] Add missing directorin typemap for char* and char[] which
fixes director_string testcase failure.
2013-04-05: wsfulton
[Ruby] SF Bug #1292 - Runtime fixes for Proc changes in ruby-1.9 when using STL
wrappers that override the default predicate, such as:
%template(Map) std::map<swig::LANGUAGE_OBJ, swig::LANGUAGE_OBJ, swig::BinaryPredicate<> >;
2013-04-05: wsfulton
[Ruby] SF Bug #1159 - Correctly check rb_respond_to call return values to fix some
further 1.9 problems with functors and use of Complex wrappers.
2013-04-02: wsfulton
[Ruby] Runtime fixes for std::complex wrappers for ruby-1.9 - new native Ruby complex numbers are used.
2013-03-30: wsfulton
[Ruby] Fix seg fault when using STL containers of generic Ruby types, GC_VALUE or LANGUAGE_OBJECT,
on exit of the Ruby interpreter. More frequently observed in ruby-1.9.
2013-03-29: wsfulton
[Ruby] Fix delete_if (reject!) for the STL container wrappers which previously would
sometimes seg fault or not work.
2013-03-25: wsfulton
[Python] Fix some undefined behaviour deleting slices in the STL containers.
2013-03-19: wsfulton
[C#, Java, D] Fix seg fault in SWIG using directors when class and virtual method names are
the same except being in different namespaces when the %nspace feature is not being used.
2013-02-19: kwwette
Fix bug in SWIG's handling of qualified (e.g. const) variables of array type. Given the typedef
a(7).q(volatile).double myarray // typedef volatile double[7] myarray;
the type
q(const).myarray // const myarray
becomes
a(7).q(const volatile).double // const volatile double[7]
Previously, SwigType_typedef_resolve() produces the type
q(const).a(7).q(volatile).double // non-sensical type
which would never match %typemap declarations, whose types were parsed correctly.
Add typemap_array_qualifiers.i to the test suite which checks for the correct behaviour.
2013-02-18: wsfulton
Deprecate typedef names used as constructor and destructor names in %extend. The real
class/struct name should be used.
typedef struct tagEStruct {
int ivar;
} EStruct;
%extend tagEStruct {
EStruct() // illegal name, should be tagEStruct()
{
EStruct *s = new EStruct();
s->ivar = ivar0;
return s;
}
~EStruct() // illegal name, should be ~tagEStruct()
{
delete $self;
}
}
For now these trigger a warning:
extend_constructor_destructor.i:107: Warning 522: Use of an illegal constructor name 'EStruct' in
%extend is deprecated, the constructor name should be 'tagEStruct'.
extend_constructor_destructor.i:111: Warning 523: Use of an illegal destructor name 'EStruct' in
%extend is deprecated, the destructor name should be 'tagEStruct'.
These %extend destructor and constructor names were valid up to swig-2.0.4, however swig-2.0.5 ignored
them altogether for C code as reported in SF bug #1306. The old behaviour of using them has been
restored for now, but is officially deprecated. This does not apply to anonymously defined typedef
classes/structs such as:
typedef struct {...} X;
2013-02-17: kwwette
When generating functions provided by %extend, use "(void)" for no-argument functions
instead of "()". This prevents warnings when compiling with "gcc -Wstrict-prototypes".
2013-02-17: kwwette
[Octave] Minor fix to autodoc generation: get the right type for functions returning structs.
2013-02-15: wsfulton
Deprecate typedef names used in %extend that are not the real class/struct name. For example:
typedef struct StructBName {
int myint;
} StructB;
%extend StructB {
void method() {}
}
will now trigger a warning:
swig_extend.i:19: Warning 326: Deprecated %extend name used - the struct name StructBName
should be used instead of the typedef name StructB.
This is only partially working anyway (the %extend only worked if placed after the class
definition).
2013-02-09: wsfulton
[CFFI] Apply patch #22 - Fix missing package before &body
2013-01-29: wsfulton
[Java] Ensure 'javapackage' typemap is used as it stopped working from version 2.0.5.
2013-01-28: wsfulton
[Python] Apply patch SF #334 - Fix default value conversions "TRUE"->True, "FALSE"->False.
2013-01-28: wsfulton
[Java] Apply patch SF #335 - Truly ignore constructors in directors with %ignore.
2013-01-18: Brant Kyser
[Java] Patch #15 - Allow the use of the nspace feature without the -package commandline option.
This works as long and the new jniclasspackage pragma is used to place the JNI intermediate class
into a package and the nspace feature is used to place all exposed types into a package.
2013-01-15: wsfulton
Fix Visual Studio examples to work when SWIG is unzipped into a directory containing spaces.
2013-01-15: wsfulton
[C#] Fix cstype typemap lookup for member variables so that a fully qualified variable name
matches. For example:
%typemap(cstype) bool MVar::mvar "MyBool"
struct MVar {
bool mvar;
};
2013-01-11: Brant Kyser
[Java, C#, D] SF Bug #1299 - Fix generated names for when %nspace is used on
classes with the same name in two different namespaces.
2013-01-11: Vladimir Kalinin
[C#] Add support for csdirectorin 'pre', 'post' and 'terminator' attributes.
2013-01-08: olly
[PHP] Fix to work with a ZTS build of PHP (broken in 2.0.7).
2013-01-07: olly
Fix bashism in configure, introduced in 2.0.9.
2013-01-06: wsfulton
Pull patch #4 from ptomulik to fix SF Bug #1296 - Fix incorrect warning for virtual destructors
in templates, such as:
Warning 521: Illegal destructor name B< A >::~B(). Ignored.
2013-01-05: wsfulton
[Python] Pull patch #3 from ptomulik to fix SF Bug #1295 - standard exceptions as
classes using the SWIG_STD_EXCEPTIONS_AS_CLASSES macro.
2013-01-04: wsfulton
[Java] Pull patch #2 from BrantKyser to fix SF Bug #1283 - fix smart pointers in conjuction
with directors.
2013-01-03: wsfulton
[Java] Pull patch #1 from BrantKyser to fix SF Bug #1278 - fix directors and nspace feature when
multilevel namespaces are used.
Version 2.0.9 (16 December 2012)
================================
2012-12-16: wsfulton
Fix garbage line number / empty file name reporting for some missing
'}' or ')' error messages.
2012-12-15: kkaempf
[Ruby] Apply patch 3530444, Class#methods and Class#constants returns array of
symbols in Ruby 1.9+
2012-12-14: kkaempf
[Ruby] Apply patch 3530439 and finally replace all occurrences of the STR2CSTR() macro
with StringValuePtr(). STR2CSTR was deprecated since years and got removed in Ruby 1.9
2012-12-14: kkaempf
[Ruby] Applied patches #3530442 and 3530443 to adapt compile and runtime include
paths to match Ruby 1.9+
2012-12-14: wsfulton
[CFFI] Fix #3161614 - Some string constants are incorrect
2012-12-13: wsfulton
[CFFI] Fix #3529690 - Fix incorrect constant names.
2012-12-12: drjoe
[R] add fix to finalizer that was missed earlier
2012-12-11: wsfulton
[Python] Apply patch #3590522 - fully qualified package paths for Python 3 even if a module is in the
same package.
2012-12-08: wsfulton
[Python] Bug #3563647 - PyInt_FromSize_t unavailable prior to Python 2.5 for unsigned int types.
2012-12-08: wsfulton
[Perl] Fix bug #3571361 - C++ comment in C wrappers.
2012-12-07: wsfulton
[C#] Apply patch #3571029 which adds missing director support for const unsigned long long &.
2012-11-28: kwwette
[Octave] Simplified module loading: now just the syntax
$ example;
is accepted, which loads functions globally but constants and variables relative to the current scope.
This make module loading behaviour reliably consistent, and reduces problems when loading modules which
depend on other modules which may not have been previously loaded.
2012-11-27: wsfulton
[cffi] Fix junk output when wrapping single character literal constants.
2012-11-17: wsfulton
[Tcl, Modula3] Add missing support for -outdir.
2012-11-17: wsfulton
Fix segfaults when using filename paths greater than 1024 characters in length.
2012-11-14: wsfulton
[ccache-swig] Apply patch #3586392 from Frederik Deweerdt to fix some error cases - incorrectly using
memory after it has been deleted.
2012-11-09: vzeitlin
[Python] Fix overflow when passing values greater than LONG_MAX from Python 3 for parameters with unsigned long C type.
2012-11-09: wsfulton
Fix some feature matching issues for implicit destructors and implicit constructors and implicit
copy constructors added with %copyctor. Previously a feature for these had to be fully qualified
in order to match. Now the following will also match:
%feature("xyz") ~XXX();
struct XXX {};
2012-11-09: wsfulton
Further consistency in named output typemap lookups for implicit constructors and destructors and
implicit copy constructors added with %copyctor. Previously only the fully qualified name was being
used, now the unqualified name will also be used. For example, previously:
example.i:38: Searching for a suitable 'out' typemap for: void Space::More::~More
Looking for: void Space::More::~More
Looking for: void
Now the unqualified name is also used:
example.i:38: Searching for a suitable 'out' typemap for: void Space::More::~More
Looking for: void Space::More::~More
Looking for: void ~More
Looking for: void
2012-11-02: wsfulton
Fix some subtle named output typemap lookup misses, the fully qualified name was not always being
used for variables, for example:
struct Glob {
int MyVar;
};
Previously the search rules (as shown by -debug-tmsearch) for the getter wrapper were:
example.i:44: Searching for a suitable 'out' typemap for: int MyVar
Looking for: int MyVar
Looking for: int
Now the scope is named correctly:
example.i:44: Searching for a suitable 'out' typemap for: int Glob::MyVar
Looking for: int Glob::MyVar
Looking for: int MyVar
Looking for: int
2012-10-26: wsfulton
Fix director typemap searching so that a typemap specified with a name will be correctly matched. Previously
the name was ignored during the typemap search. Applies to the following list of typemaps:
directorout, csdirectorout, cstype, imtype, ctype, ddirectorout, dtype, gotype, jtype, jni, javadirectorout.
2012-10-11: wsfulton
Most of the special variables available for use in %exception are now also available for expansion in
%extend blocks. These are: $name $symname $overname $decl $fulldecl $parentclassname $parentclasssymname, see docs
on "Class extension" in SWIGPlus.html. Patch based on submission from Kris Thielemans.
2012-10-10: wsfulton
Additional new special variables in %exception are expanded as follows:
$parentclassname - The parent class name (if any) for a method.
$parentclasssymname - The target language parent class name (if any) for a method.
2012-10-08: iant
[Go] Generating Go code now requires using the -intgosize option to
indicate the size of the 'int' type in Go. This is because the
size of the type is changing from Go 1.0 to Go 1.1 for x86_64.
2012-09-14: wsfulton
Add new warning if the empty template instantiation is used as a base class, for example:
template <typename T> class Base {};
%template() Base<int>;
class Derived : public Base<int> {};
gives the following warning instead of silently ignoring the base:
cpp_inherit.i:52: Warning 401: Base class 'Base< int >' has no name as it is an empty template instantiated with '%template()'. Ignored.
cpp_inherit.i:51: Warning 401: The %template directive must be written before 'Base< int >' is used as a base class and be declared with a name.
2012-09-11: wsfulton
[Java] Fix #3535304 - Direct use of a weak global reference in directors
sometimes causing seg faults especially on Android.
2012-09-06: wsfulton
[Java] Fix (char *STRING, size_t LENGTH) typemaps to accept NULL string.
2012-08-26: drjoe
[R] make ExternalReference slot ref to contain reference
2012-08-26: drjoe
[R] fix Examples/Makefile to use C in $(CC) rather than $(CXX)
Version 2.0.8 (20 August 2012)
==============================
2012-08-15: wsfulton
[Perl] Add size_type, value_type, const_reference to the STL containers.
2012-08-15: wsfulton
[Python] Add discard and add methods to std::set wrappers so that pyabc.i can be used ensuring
MutableSet is a valid abstract base class for std::set. As reported by Alexey Sokolov.
Similarly for std::multiset.
2012-08-15: wsfulton
[Python] Fix #3541744 - Missing PyInt_FromSize_t calls for Python 3.
2012-08-13: wsfulton
[Java] Patch from David Baum to add the assumeoverride feature for Java directors to
improve performance when all overridden methods can be assumed to be overridden.
2012-08-05: wsfulton
[Python] #3530021 Fix unused variable warning.
2012-08-05: wsfulton
[C#] Fix #3536360 - Invalid code sometimes being generated for director methods
with many arguments.
2012-08-05: wsfulton
[Perl] #3545877 - Don't undefine bool if defined by C99 stdbool.h - problem using
Perl 5.16 and later.
2012-08-04: wsfulton
Remove incorrect warning (314) about target language keywords which were triggered
by using declarations and using directives. For example 'string' is a keyword in C#:
namespace std { class string; }
using std::string;
2012-07-21: wsfulton
Fix display of pointers in various places on 64 bit systems - only 32 bits were being shown.
2012-07-21: wsfulton
Fix gdb debugger functions 'swigprint' and 'locswigprint' to display to the gdb output window
rather than stdout. This fixes display problems in gdbtui and the ensures the output
appears where expected in other gdb based debuggers such as Eclipse CDT.
2012-07-20: kwwette
[Octave] segfault-on-exit prevention hack now preserves exit status, and uses C99 _Exit().
2012-07-02: wsfulton
Fix Debian bug http://bugs.debian.org/672035, typemap copy failure - regression introduced
in swig-2.0.5:
%include<stl.i>
using std::pair;
%template(StrPair) pair<std::string, std::string>;
2012-07-02: wsfulton
Fix using declarations combined with using directives with forward class declarations so that
types are correctly found in scope for templates. Example:
namespace Outer2 {
namespace Space2 {
template<typename T> class Thing2;
}
}
using namespace Outer2;
using Space2::Thing2;
template<typename T> class Thing2 {};
// STILL BROKEN void useit2(Thing2<int> t) {}
void useit2a(Outer2::Space2::Thing2<int> t) {}
void useit2b(::Outer2::Space2::Thing2<int> t) {}
void useit2c(Space2::Thing2<int> t) {}
namespace Outer2 {
void useit2d(Space2::Thing2<int> t) {}
}
%template(Thing2Int) Thing2<int>;
2012-06-30: wsfulton
Fix template namespace problems for symbols declared with a forward class declarations, such as:
namespace Space1 {
namespace Space2 {
template<typename T> struct YYY;
}
template<typename T> struct Space2::YYY {
T yyy(T h) {
return h;
}
};
void testYYY1(Space1::Space2::YYY<int> yy) {}
void testYYY2(Space2::YYY<int> yy) {}
void testYYY3(::Space1::Space2::YYY<int> yy) {}
}
%template(YYYInt) Space1::Space2::YYY<int>;
2012-06-30: wsfulton
Fix namespace problems for symbols declared with a forward class declarations, such as:
namespace Space1 {
namespace Space2 {
struct XXX;
struct YYY;
}
struct Space2::YYY {};
struct Space1::Space2::XXX {};
void testXXX2(Space2::XXX xx) {}
void testYYY2(Space2::YYY yy) {}
}
where xx and yy were not recognised as the proxy classes XXX and YYY.
2012-06-30: wsfulton
Fix using declarations combined with using directives with forward class declarations so that
types are correctly found in scope.
namespace Outer2 {
namespace Space2 {
class Thing2;
}
}
using namespace Outer2;
using Space2::Thing2;
class Thing2 {};
// None of the methods below correctly used the Thing2 proxy class
void useit2(Thing2 t) {}
void useit2a(Outer2::Space2::Thing2 t) {}
void useit2b(::Outer2::Space2::Thing2 t) {}
void useit2c(Space2::Thing2 t) {}
namespace Outer2 {
void useit2d(Space2::Thing2 t) {}
}
2012-06-25: wsfulton
Fix using declarations combined with using directives so that types are correctly found in scope.
Example:
namespace Outer2 {
namespace Space2 {
class Thing2 {};
}
}
using namespace Outer2; // using directive
using Space2::Thing2; // using declaration
void useit2(Thing2 t) {}
Similarly for templated classes.
2012-05-29: wsfulton
Fix #3529601 - seg fault when a protected method has the "director"
feature but the parent class does not. Also fix similar problems with
the allprotected feature.
2012-05-28: wsfulton
Fix seg fault when attempting to warn about an illegal destructor - #3530055, 3530078 and #3530118.
Version 2.0.7 (26 May 2012)
===========================
2012-05-26: wsfulton
std::string typemap modifications so they can be used with %apply for other string
classes.
2012-05-25: wsfulton
[Lua] Fixes for -external-runtime to work again.
2012-05-22: szager
[python] Disambiguate SWIG_From_unsigned_SS_int and SWIG_From_unsigned_SS_long.
2012-05-18: olly
[PHP] Fix getters for template members. (SF#3428833, SF#3528035)
2012-05-14: wsfulton
Fix some language's std::map wrappers to recognise difference_type, size_type, key_type
and mapped_type.
2012-05-14: kwwette (signed off by xavier98)
[Octave] Prevent Octave from seg-faulting at exit when SWIG
modules are loaded, due to bugs in Octave's cleanup code:
* Wrapping functions now declared with Octave DEFUN_DLD macro,
and loaded through Octave's dynamic module loader
* Global variables of swigref type are now assigned a new()
copy of the swigref class, to prevent double-free errors
* SWIG module at-exit cleanup function now created in Octave
through eval(), so not dependent on loaded .oct library
* For Octave versions 3.1.* to 3.3.*, register C-level at-exit
function which terminates Octave immediately (with correct
status code) without performing memory cleanup. This function
can be controlled with macros in Lib/octave/octruntime.swg
[Octave] New syntax for determing whether SWIG module should be
loaded globally or non-globally. To load module "example" globally,
type the module name
$ example;
as before; to load module non-globally, assign it to a variable:
$ example = example;
or
$ ex = example;
for a shorter (local) module name. -global/-noglobal command-line
options and module command line are deprecated. Added usage info
to module, so typing
$ help example
or incorrect usage should display proper usage, with examples.
*** POTENTIAL INCOMPATIBILITY ***
2012-05-12: olly
[PHP] Fix memory leak in code generated for a callback. Patch from
SF bug #3510806.
2012-05-12: olly
[PHP] Avoid using zend_error_noreturn() as it doesn't work with all
builds of PHP (SF bug #3166423). Instead we now wrap it in a
SWIG_FAIL() function which we annotate as "noreturn" for GCC to
avoids warnings. This also reduces the size of the compiled
wrapper (e.g. the stripped size is reduced by 6% for Xapian's PHP
bindings).
2012-05-11: wsfulton
[Java] SF patch #3522855 Fix unintended uninitialised memory access in OUTPUT typemaps.
2012-05-11: wsfulton
[Java] SF patch #3522674 Fix possible uninitialised memory access in char **STRING_OUT
typemap.
2012-05-11: wsfulton
[Java] SF patch #3522611 Fix uninitialised size regression in char **STRING_ARRAY
introduced in swig-2.0.6.
2012-05-11: wsfulton
SF bug #3525050 - Fix regression introduced in swig-2.0.5 whereby defining one typemap
method such as an 'out' typemap may hide another typemap method such as an 'in' typemap -
only occurs when the type is a template type where the template parameters are the same
via a typedef.
2012-05-10: olly
[PHP] Fix the constant typemaps for SWIGTYPE, etc - previously
these used the wrong name for renamed constants. Add
autodoc_runme.php to the testsuite as a regression test for this.
2012-05-02: ianlancetaylor
[Go] Remove compatibility support for gccgo 4.6. Using
SWIG with gccgo will now require gccgo 4.7. Using SWIG
with the more commonly used gc compiler is unaffected.
2012-05-01: wsfulton
Fix generated code for C forward enum declarations in some languages.
Version 2.0.6 (30 April 2012)
=============================
2012-04-25: wsfulton
[Lua] Fix uninitialised variable in SWIGTYPE **OUTPUT typemaps as reported by Jim Anderson.
2012-04-28: wsfulton
[Python] Fix compilation errors when wrapping STL containers on Mac OS X and possibly other systems.
2012-04-28: wsfulton
[Java] Patch 3521811 from Leo Davis - char **STRING_ARRAY typemaps fixed to handle
null pointers.
Version 2.0.5 (19 April 2012)
=============================
2012-04-14: wsfulton
[Lua] Apply patch #3517435 from Miles Bader - prefer to use Lua_pushglobaltable
2012-04-14: wsfulton
[Ruby] Apply patch #3517769 from Robin Stocker to fix compile error on MacRuby using RSTRING_PTR.
2012-04-13: wsfulton
Apply patch #3511009 from Leif Middelschulte for slightly optimised char * variable wrappers.
2012-04-13: wsfulton
[Lua] Apply #3219676 from Shane Liesegang which adds:
- support for %factory
- a __tostring method
- a __disown method
2012-04-13: wsfulton
[Xml] Apply #3513569 which adds a catchlist to the xml output.
2012-04-05: olly
[Lua] Add support for Lua 5.2 (patch SF#3514593 from Miles Bader)
2012-03-26: xavier98
[octave] Apply patch #3425993 from jgillis: add extra logic to the octave_swig_type::dims(void) method: it checks if the user has defined a __dims__ method and uses this in stead of returning (1,1)
[octave] Apply patch #3424833 from jgillis: make is_object return true for swig types
2012-03-24: wsfulton
[D] Apply #3502431 to fix duplicate symbols in multiple modules.
2012-03-21: wsfulton
Fix #3494791 - %$isglobal for %rename matching.
2012-03-20: wsfulton
Fix #3487706 and #3391906 - missing stddef.h include for ptrdiff_t when using %import
for STL containers and compiling with g++-4.6. An include of stddef.h is now only
generated when SWIG generates STL helper templates which require ptrdiff_t. If you
were previously relying on "#include <stddef.h>" always being generated when using a
%include of an STL header, you may now need to add this in manually.
2012-03-16: wsfulton
Apply patch #3392264 from Sebastien Bine to parse (unsigned) long long types in enum value assignment.
2012-03-16: wsfulton
Apply patch #3505530 from Karl Wette to allow custom allocators in STL string classes for the UTL languages.
2012-03-13: wsfulton
Apply patch #3468362 from Karl Wette to fix %include inside %define.
2012-03-13: wsfulton
[Python, Ruby, Octave, R] Fix #3475492 - iterating through std::vector wrappers of enumerations.
2012-02-27: xavier98 (patches from Karl Wette)
[Octave] Use -globals . to load global variables in module namespace
[Octave] Comment declaration of unimplemented function swig_register_director
[Octave] Fix OCTAVE_PATH in octave Makefiles
[Octave] Add support for std::list - fix li_std_containers_int test
[Octave] Fix imports test
2012-02-16: wsfulton
[Java] Make generated support functions in arrays_java.i static so that generated code
from multiple instances of SWIG can be compiled and linked together - problem reported by
Evan Krause.
2012-01-24: wsfulton
Fix crash with bad regex - bug #3474250.
2012-01-24: wsfulton
[Python] Add Python stepped slicing support to the STL wrappers (std::vector, std::list).
Assigning to a slice, reading a slice and deleting a slice with steps now work.
For example:
%template(vector_i) std::vector<int>
vi = vector_i(range(10))
print list(vi)
vi[1:4:2] = [111, 333]
print list(vi)
del vi[3:10:3]
print list(vi)
print list(vi[::-1])
gives (same behaviour as native Python sequences such as list):
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
[0, 111, 2, 333, 4, 5, 6, 7, 8, 9]
[0, 111, 2, 4, 5, 7, 8]
[8, 7, 5, 4, 2, 111, 0]
2012-01-23: klickverbot
[D] Correctly annotate function pointers with C linkage.
[D] Exception and Error have become blessed names; removed d_exception_name test case.
2012-01-20: wsfulton
[Python] Fix some indexing bugs in Python STL wrappers when the index is negative, eg:
%template(vector_i) std::vector<int>
iv=vector_i([0,1,2,3,4,5])
iv[-7:]
now returns [0, 1, 2, 3, 4, 5] instead of [5].
vv[7:9] = [22,33]
now returns [0, 1, 2, 3, 4, 5, 22, 33] instead of "index out range" error.
Also fix some segfaults when replacing ranges, eg when il is a std::list wrapper:
il[0:2] = [11]
2012-01-17: wsfulton
[Go] Fix forward class declaration within a class when used as a base.
2012-01-07: wsfulton
[C#] Add support for %nspace when using directors.
2012-01-06: wsfulton
[Java] Patch #3452560 from Brant Kyser - add support for %nspace when using directors.
2011-12-21: wsfulton
The 'directorin' typemap now accepts $1, $2 etc expansions instead of having to use workarounds -
$1_name, $2_name etc.
2011-12-20: wsfulton
[Java] Add (char *STRING, size_t LENGTH) director typemaps.
2011-12-20: wsfulton
[C#, Go, Java, D] Add support for the 'directorargout' typemap.
2011-12-20: wsfulton
[Ocaml, Octave, PHP, Python, Ruby] Correct special variables in 'directorargout' typemap.
This change will break any 'directorargout' typemaps you may have written. Please change:
$result to $1
$input to $result
Also fix the named 'directorargout' DIRECTOROUT typemaps for these languages which didn't
previously compile and add in $1, $2 etc expansion.
*** POTENTIAL INCOMPATIBILITY ***
2011-12-10: talby
[perl5] SWIG_error() now gets decorated with perl source file/line number.
[perl5] error handling now conforms to public XS api (fixes perl v5.14 issue).
2011-12-10: wsfulton
[Android/Java] Fix directors to compile on Android.
Added documentation and examples for Android.
2011-12-08: vadz
Bug fix: Handle methods renamed or ignored in the base class correctly in the derived classes
(they could be sometimes mysteriously not renamed or ignored there before).
2011-12-03: klickverbot
[D] Fix exception glue code for newer DMD 2 versions.
[D] Do not default to 32 bit glue code for DMD anymore.
[D] Use stdc.config.c_long/c_ulong to represent C long types.
2011-12-01: szager
[python] Fixed bug 3447426: memory leak in vector.__getitem__.
2011-11-30: wsfulton
[R] Remove C++ comments from generated C code.
2011-11-27: olly
[Python] Fix some warnings when compiling generated wrappers with
certain GCC warning options (Debian bug #650246).
2011-11-28: wsfulton
Fix #3433541 %typemap(in, numinputs=0) with 10+ arguments.
2011-11-28: olly
[Perl] Fix warnings when compiling generated wrappers with certain
GCC warning options (Debian bug #436711).
2011-11-28: olly
[PHP] Update keyword list to include keywords added in PHP releases up to 5.3.
2011-11-25: wsfulton
[C#] Provide an easy way to override the default visibility for the proxy class pointer
constructors and getCPtr() method. The visibility is 'internal' by default and if multiple
SWIG modules are being used and compiled into different assemblies, then they need to be
'public' in order to use the constructor or getCPtr() method from a different assembly.
Use the following macros to change the visibilities in the proxy and type wrapper class:
SWIG_CSBODY_PROXY(public, public, SWIGTYPE)
SWIG_CSBODY_TYPEWRAPPER(public, public, public, SWIGTYPE)
[Java] Provide an easy way to override the default visibility for the proxy class pointer
constructors and getCPtr() method. The visibility is 'protected' by default and if multiple
SWIG modules are being used and compiled into different packages, then they need to be
'public' in order to use the constructor or getCPtr() method from a different package.
Use the following macros to change the visibilities in the proxy and type wrapper class:
SWIG_JAVABODY_PROXY(public, public, SWIGTYPE)
SWIG_JAVABODY_TYPEWRAPPER(public, public, public, SWIGTYPE)
The default for Java has changed from public to protected for the proxy classes. Use the
SWIG_JAVABODY_PROXY macro above to restore to the previous visibilities.
*** POTENTIAL INCOMPATIBILITY ***
2011-11-22: szager
[python] Bug 3440044: #ifdef out SWIG_Python_NonDynamicSetAttr if -builtin
isn't being used, to avoid unnecessary binary incompatibilities between
python installations.
2011-11-17: wsfulton
Bug fix: Remove root directory from directory search list in Windows.
2011-11-13: wsfulton
[Ruby] Apply patch #3421876 from Robin Stocker to fix #3416818 - same class name in
different namespaces confusion when using multiple modules.
2011-11-11: wsfulton
Fix pcre-build.sh to work with non-compressed tarballs - problem reported by Adrian Blakely.
2011-11-03: wsfulton
Expand special variables in typemap warnings, eg:
%typemap(in, warning="1000:Test warning for 'in' typemap for $1_type $1_name") int "..."
2011-11-01: wsfulton
Fix named output typemaps not being used when the symbol uses a qualifier and contains
a number, eg:
%typemap(out) double ABC::m1 "..."
2011-10-24: talby
[perl5] SF bug #3423119 - overload dispatch stack corruption fix. Better, but more research
is needed on a stable path for tail calls in XS.
Also, fix for large long longs in 32 bit perl.
2011-10-13: xavier98
[octave] Allow Octave modules to be re-loaded after a "clear all".
2011-09-19: wsfulton
Fix regression introduced in swig-2.0.1 reported by Teemu Ikonone leading to uncompilable code
when using typedef and function pointer references, for example:
typedef int FN(const int &a, int b);
void *typedef_call1(FN *& precallback, FN * postcallback);
2011-09-14: wsfulton
[Lua] Patch #3408012 from Raman Gopalan - add support for embedded Lua (eLua)
including options for targeting Lua Tiny RAM (LTR).
2011-09-14: wsfulton
[C#] Add boost_intrusive_ptr.i library contribution from patch #3401571.
2011-09-13: wsfulton
Add warnings for badly named destructors, eg:
struct KStruct {
~NOT_KStruct() {}
};
cpp_extend_destructors.i:92: Warning 521: Illegal destructor name ~NOT_KStruct. Ignored.
2011-09-13: wsfulton
Fix %extend and destructors for templates. The destructor in %extend was not always wrapped,
for example:
%extend FooT {
~FooT() { delete $self; } // was not wrapped as expected
};
template<class T> class FooT {};
%template(FooTi) FooT<int>;
2011-09-13: wsfulton
Fix special variables such as "$decl" and "$fulldecl" in destructors to include the ~ character.
2011-09-10: talby
[perl5] SF bug #1481958 - Improve range checking for integer types.
Enhance li_typemaps_runme.pl
2011-09-08: wsfulton
Fix %extend on typedef classes in a namespace using the typedef name, for example:
namespace Space {
%extend CStruct {
...
}
typedef struct tagCStruct { ... } CStruct;
}
2011-08-31: xavier98
[octave] patches from Karl Wette: improvements to module loading behavior;
added example of friend operator to operator example; fixed octave panic/crash in 3.0.5;
documentation improvements
2011-08-30: szager
[python] Bug 3400486, fix error signalling for built-in constructors.
2011-08-26: wsfulton
[Go] Fix file/line number display for "gotype" when using typemap debugging options
-tmsearch and -tmused.
2011-08-26: wsfulton
[C#, D] Fix %callback which was generating uncompilable code.
2011-08-25: wsfulton
Fix constructors in named typedef class declarations as reported by Gregory Bronner:
typedef struct A {
A(){} // Constructor which was not accepted by SWIG
B(){} // NOT a constructor --illegal, but was accepted by SWIG
} B;
For C code, the fix now results in the use of 'struct A *' instead of just 'B *' in
the generated code when wrapping members in A, but ultimately this does not matter, as
they are the same thing.
2011-08-23: wsfulton
Fix %newobject when used in conjunction with %feature("ref") as reported by Jan Becker. The
code from the "ref" feature was not always being generated for the function specified by %newobject.
Documentation for "ref" and "unref" moved from Python to the C++ chapter.
2011-08-22: szager
[python] Fixed memory leak with --builtin option (bug 3385089).
2011-08-22: wsfulton
[Lua] SF patch #3394339 from Torsten Landschoff - new option -nomoduleglobal to disable installing
the module table into the global namespace. Require call also returns the module table instead
of a string.
2011-08-09: xavier98
Fix bug 3387394; Octave patches for 3.4.0 compatibility, etc. (from Karl Wette)
2011-08-04: wsfulton
Add in $symname expansion for director methods.
2011-07-29: olly
[PHP] Don't generate "return $r;" in cases where $r hasn't been set.
This was basically harmless, except it generated a PHP E_NOTICE if
the calling code had enabled them.
2011-07-26: wsfulton
Fix scoping of forward class declarations nested within a class (for C++). Previously the symbol
was incorrectly put into the outer namespace, eg
namespace std {
template<class Key, class T> struct map {
class iterator;
};
}
iterator was scoped as std::iterator, but now it is correctly std::map<Key, T>::iterator;
Also fixed is %template and template parameters that are a typedef when the template contains
default template parameters, eg:
namespace Std {
template<class Key, class T, class C = int> struct Map {
typedef Key key_type;
typedef T mapped_type;
};
}
typedef double DOUBLE;
%template(MM) Std::Map<int, DOUBLE>;
All symbols within Map will be resolved correctly, eg key_type and mapped_type no matter if the
wrapped code uses Std::Map<int, double> or std::Map<int, DOUBLE> or Std::Map<int, double, int>
Also fixes bug #3378145 - regression introduced in 2.0.4 - %template using traits.
2011-07-20 szager
[python] Fix closure for tp_call slot.
2011-07-16: wsfulton
[python] Fix director typemap using PyObject *.
2011-07-13: szager
[python] SF patch #3365908 - Add all template parameters to map support code in std_map.i
2011-07-13: szager
[python] Fix for bug 3324753: %rename member variables with -builtin.
2011-07-01: wsfulton
Fix some scope and symbol lookup problems when template default parameters are being
used with typedef. For example:
template<typename XX, typename TT = SomeType> struct Foo {
typedef XX X;
typedef TT T;
};
template<typename TT> struct UsesFoo {
void x(typename Foo<TT>::T, typename Foo<TT>::X);
};
Also fixes use of std::vector<int>::size_type for Python as reported by Aubrey Barnard.
2011-06-23: olly
[PHP] Fix director code to work when PHP is built with ZTS enabled,
which is the standard configuration on Microsoft Windows.
2011-06-21: mutandiz
[allegrocl]
- various small tweaks and bug fixes.
- Avoid name conflicts between smart pointer wrappers and the wrappers for
the actual class.
- Fix default typemaps for C bindings, which were incorrectly attempting to
call non-existent destructors on user-defined types.
- New feature, feature:aclmixins, for adding superclass to the foreign class
wrappers.
- Improve longlong typemaps.
2011-06-19: wsfulton
Fix incorrect typemaps being used for a symbol within a templated type, eg:
A<int>::value_type would incorrectly use a typemap for type A.
2011-06-18: olly
[Tcl] Fix variable declarations in middle of blocks which isn't
permitted in C90 (issue probably introduced in 2.0.3 by patch #3224663).
Reported by Paul Obermeier in SF#3288586.
2011-06-17: wsfulton
[Java] SF #3312505 - slightly easier to wrap char[] or char[ANY] with a Java byte[]
using arrays_java.i.
2011-06-13: wsfulton
[Ruby, Octave] SF #3310528 Autodoc fixes similar to those described below for Python.
2011-06-10: wsfulton
[Python] Few subtle bugfixes in autodoc documentation generation,
- Unnamed argument names fix for autodoc levels > 0.
- Display of template types fixed for autodoc levels > 1.
- Fix SF #3310528 - display of typedef structs for autodoc levels > 1.
- Add missing type for self for autodoc levels 1 and 3.
- autodoc levels 2 and 3 documented.
- Minor tweaks to autodoc style to conform with PEP8.
2011-05-30: olly
[PHP] Fix handling of directors when -prefix is used.
2011-05-24: olly
[PHP] Fix handling of methods of classes with a virtual base class (SF#3124665).
Version 2.0.4 (21 May 2011)
===========================
2011-05-19: wsfulton
[Guile] Patch #3191625 fixing overloading of integer types.
2011-05-19: wsfulton
[Perl] Patch #3260265 fixing overloading of non-primitive types and integers in
Perl 5.12 and later.
2011-05-19: wsfulton
[Ruby] Fix %import where one of the imported files %include one of the STL include
files such as std_vector.i.
2011-05-17: wsfulton
[Java] Apply #3289851 from Alan Harder to fix memory leak in directors when checking
for pending exceptions.
2011-05-17: wsfulton
[Tcl] Apply #3300072 from Christian Delbaere to fix multiple module loading not
always sharing variables across modules.
2011-05-16: xavier98
[octave] Fix an incompatibility with never versions of Octave. Case on Octave
API >= 40 to handle rename of Octave_map to octave_map.
[octave] Add support for y.__rop__(x) operators when x.__op__(y) doesn't exist.
[octave] Allow global operators to be defined by SWIG-wrapped functions.
[octave] Fix several bugs around module namespaces; add -global, -noglobal,
-globals <name> command line options to the module.
2011-05-14: wsfulton
%varargs when used with a numeric argument used to create an additional argument
which was intended to provide a guaranteed sentinel value. This never worked and now
the additional argument is not generated.
2011-05-13: wsfulton
[python] Additional fixes for python3.2 support.
2011-05-07: szager
[python] Fixed PyGetSetDescr for python3.2.
2011-05-05: wsfulton
[Lua, Python, Tcl] C/C++ prototypes shown in error message when calling an overloaded
method with incorrect arguments improved to show always show fully qualified name
and if a const method.
Also fixed other Lua error messages in generated code which weren't consistently
using the fully qualified C++ name - requested by Gedalia Pasternak.
2011-04-29: szager
Bug 2635919: Convenience method to convert std::map to a python dict.
2011-04-29: szager
[Python] Fixed bug 2811549: return non-const iterators from STL
methods begin(), end(), rbegin(), rend().
2011-04-25: szager
[Python] Fixed bug 1498929: Access to member fields in map elements
2011-04-23: klickverbot
[D] nspace: Correctly generate identifiers for base classes when
not in split proxy mode.
2011-04-13: szager
Fixed bug 3286333: infinite recursion with mutual 'using namespace' clauses.
2011-04-12: szager
Fixed bug 1163440: vararg typemaps.
2011-04-12: szager
Fixed bug #3285386: parse error from 'operator T*&()'. Added operator_pointer_ref
test case to demonstrate.
2011-04-11: szager
[Python] Fixed PyVarObject_HEAD_INIT to eliminate VC++ compiler errors about
static initialization of struct members with pointers.
2011-04-11: wsfulton
[Tcl] Apply patch #3284326 from Colin McDonald to fix some compiler warnings.
2011-04-11: szager
[Python] Fixed PyVarObject_HEAD_INIT to eliminate VC++ compiler errors about
static initialization of struct members with pointers.
2011-04-10: klickverbot
[D] Fixed wrapping of enums that are type char, for example:
enum { X = 'X'; } (this was already in 2.0.3 for C# and Java)
2011-04-10: klickverbot
[D] nspace: Fixed referencing types in the root namespace when
not in split proxy mode.
2011-04-09: szager
[Python] Applied patch #1932484: migrate PyCObject to PyCapsule.
2011-04-09: szager
[Python] Added preprocessor guards for python functions PyUnicode_AsWideChar and
PySlice_GetIndices, which changed signatures in python3.2.
2011-04-07: wsfulton
Fix wrapping of const array typedefs which were generating uncompilable code as
reported by Karl Wette.
2011-04-03: szager
[Python] Fixed the behavior of %pythonnondynamic to conform to the spec in Lib/pyuserdir.swg.
2011-04-03: szager
[Python] Merged in the szager-python-builtin branch, adding the -builtin feature
for python. The -builtin option may provide a significant performance gain
in python wrappers. For full details and limitations, refer to Doc/Manual/Python.html.
A small test suite designed to demonstrate the performance gain is in
Examples/python/performance.
2011-04-01: wsfulton
Add in missing wrappers for friend functions for some target languages, mostly
the non-scripting languages like Java and C#.
Version 2.0.3 (29 March 2011)
=============================
2011-03-29: wsfulton
[R] Apply patch #3239076 from Marie White fixing strings for R >= 2.7.0
2011-03-29: wsfulton
[Tcl] Apply patch #3248280 from Christian Delbaere which adds better error messages when
the incorrect number or type of arguments are passed to overloaded methods.
2011-03-29: wsfulton
[Tcl] Apply patch #3224663 from Christian Delbaere.
1. Fix when function returns a NULL value, a "NULL" command will be created in the Tcl interpreter
and calling this command will cause a segmentation fault.
2. Previous implementation searches for class methods using a linear search causing performance issues
in wrappers for classes with many member functions. The patch adds a method hash table to classes and
changes method name lookup to use the hash table instead of doing a linear search.
2011-03-26: wsfulton
[C#, Java] SF bug #3195112 - fix wrapping of enums that are type char, for example:
enum { X = 'X'; }
2011-03-21: vadz
Allow setting PCRE_CFLAGS and PCRE_LIBS during configuration to override the values returned by
pcre-config, e.g. to allow using a static version of PCRE library.
2011-03-17: wsfulton
[UTL] Add missing headers in generated STL wrappers to fix compilation with gcc-4.6.
2011-03-17: wsfulton
Fix regression introduced in swig-2.0.2 where filenames with spaces were not found
when used with %include and %import. Reported by Shane Liesegang.
2011-03-15: wsfulton
[UTL] Fix overloading when using const char[], problem reported by David Maxwell.
Similarly for char[ANY] and const char[ANY].
2011-03-15: wsfulton
[C#] Apply patch #3212624 fixing std::map Keys property.
2011-03-14: olly
[PHP] Fix handling of overloaded methods/functions where some
return void and others don't - whether this worked or not depended
on the order they were encountered in (SF#3208299).
2011-03-13: klickverbot
[D] Extended support for C++ namespaces (nspace feature).
2011-03-12: olly
[PHP] Fix sharing of type information between multiple SWIG-wrapped
modules (SF#3202463).
2011-03-09: wsfulton
[Python] Fix SF #3194294 - corner case bug when 'NULL' is used as the default value
for a primitive type parameter in a method declaration.
2011-03-07: olly
[PHP] Don't use zend_error_noreturn() for cases where the function
returns void - now this issue can only matter if you have a function
or method which is directed and returns non-void.
2011-03-06: olly
[PHP] Add casts to the typemaps for long long and unsigned long
long to avoid issues when they are used with shorter types via
%apply.
2011-03-02: wsfulton
Templated smart pointers overloaded with both const and non const operator-> generated uncompilable
code when the pointee was a class with either public member variables or static methods.
Regression in 2.0.x reported as working in 1.3.40 by xantares on swig-user mailing list.
Version 2.0.2 (20 February 2011)
================================
2011-02-19: wsfulton
[PHP] Add missing INPUT, OUTPUT and INOUT typemaps in the typemaps.i library
for primitive reference types as well as signed char * and bool *.
2011-02-19: olly
[PHP] Address bug in PHP on some platforms/architectures which
results in zend_error_noreturn() not being available using
SWIG_ZEND_ERROR_NORETURN which defaults to zend_error_noreturn but
can be overridden when building the module by passing
-DSWIG_ZEND_ERROR_NORETURN=zend_error to the compiler. This may
result in compiler warnings, but should at least allow a module
to be built on those platforms/architectures (SF#3166423).
2011-02-18: wsfulton
Fix #3184549 - vararg functions and function overloading when using the -fastdispatch option.
2011-02-18: olly
[PHP] An overloaded method which can return an object or a
primitive type no longer causes SWIG to segfault. Reported by Paul
Colby in SF#3168531.
2011-02-18: olly
[PHP] Fix invalid erase during iteration of std::map in generated
director code. Reported by Cory Bennett in SF#3175820.
2011-02-17: wsfulton
Preprocessing now warns if extra tokens appear after #else and #end.
2011-02-16: wsfulton
Fix #1653092 Preprocessor does not error out when #elif is missing an expression.
This and other cases of missing preprocessor expressions now result in an error.
2011-02-14: wsfulton
[Ocaml] Apply patch #3151788 from Joel Reymont. Brings Ocaml support up to date
(ver 3.11 and 3.12), including std::string.
2011-02-13: wsfulton
[Ruby] Apply patch #3176274 from James Masters - typecheck typemap for time_t.
2011-02-13: wsfulton
Apply patch #3171793 from szager - protected director methods failing when -fvirtual is used.
2011-02-13: wsfulton
Fix #1927852 - #include directives don't preprocess the file passed to it. The fix is for
#include with -importall or -includeall, %include and %import, for example:
#define FILENAME "abc.h"
%include FILENAME
2011-02-12: wsfulton
Fix #1940536, overactive preprocessor which was expanding defined(...) outside of #if and #elif
preprocessor directives.
2011-02-05: wsfulton
[MzScheme] SF #2942899 Add user supplied documentation to help getting started with MzScheme.
Update chapter name to MzScheme/Racket accounting for the rename of MzScheme to Racket.
2011-02-05: wsfulton
[C#] SF #3085906 - Possible fix running test-suite on Mac OS X.
2011-02-05: wsfulton
SF #3173367 Better information during configure about Boost prerequisite for running
the test-suite.
2011-02-05: wsfulton
SF #3127633 Fix infinite loop in recursive typedef resolution.
2011-02-04: wsfulton
[R] SF #3168676 Fix %rename not working for member variables and methods.
2011-02-04: wsfulton
[clisp] SF #3148200 Fix segfault parsing nested unions.
2011-02-01: wsfulton
[C#] Directors - a call to a method being defined in the base class, not
overridden in a subclass, but again overridden in a class derived from
the first subclass was not being dispatched correctly to the most derived class.
See director_alternating.i for an example.
2011-02-01: wsfulton
[C#, Java] Any 'using' statements in the protected section of a class were previously
ignored with director protected (dirprot) mode.
2011-01-30: wsfulton
Fix overloading with const pointer reference (SWIGTYPE *const&) parameters for a
number of scripting languages.
2011-01-17: wsfulton
New warning for smart pointers if only some of the classes in the inheritance
chain are marked as smart pointer, eg, %shared_ptr should be used for all classes
in an inheritance hierarchy, so this new warning highlights code where this is
not the case.
example.i:12: Warning 520: Base class 'A' of 'B' is not similarly marked as a smart pointer.
example.i:16: Warning 520: Derived class 'C' of 'B' is not similarly marked as a smart pointer.
2011-01-14: wsfulton
Added some missing multi-argument typemaps: (char *STRING, size_t LENGTH) and
(char *STRING, int LENGTH). Documentation for this updated. Java patch from
Volker Grabsch.
2011-01-11: iant
Require Go version 7077 or later.
2010-12-30: klickverbot
[C#, D, Java] Check for collision of parameter names with target
language keywords when generating the director glue code.
The situation in which the generated could would previously be
invalid is illustrated in the new 'director_keywords' test case.
2010-12-23: wsfulton
[C#] Fix $csinput special variable not being expanded for csvarin typemaps
when used for global variables. Reported by Vadim Zeitlin.
2010-12-14: wsfulton
Fix $basemangle expansion in array typemaps. For example if type is int *[3],
$basemangle expands to _p_int.
2010-12-07: iant
Check that we are using a sufficiently new version of the
6g or 8g Go compiler during configure time. If not, disable Go.
Minimum version is now 6707.
*** POTENTIAL INCOMPATIBILITY ***
2010-12-06: wsfulton
Fix #3127394 - use of network paths on Windows/MSys.
2010-11-18: klickverbot
[D] Added the D language module.
2010-11-12: vadz
Fix handling of multiple regex-using %renames attached to the same
declaration. For example, now
%rename("%(regex:/^Set(.*)/put\\1/)s") "";
%rename("%(regex:/^Get(.*)/get\\1/)s") "";
works as expected whereas before only the last anonymous rename was
taken into account.
2010-10-17: drjoe
[R] Fix failure in overloaded functions which was breaking
QuantLib-SWIG
2010-10-14: olly
[PHP] Allow compilation on non-conforming Microsoft C++ compilers
which don't accept: return function_returning_void();
Reported by Frank Vanden Berghen on the SWIG mailing list.
2010-10-12: wsfulton
Fix unary scope operator (::) (global scope) regression introduced in 2.0.0, reported by
Ben Walker. The mangled symbol names were incorrect, sometimes resulting in types being
incorrectly treated as opaque types.
Also fixes #2958781 and some other type problems due to better typedef resolution, eg
std::vector<T *>::value_type didn't resolve to T * when it should have. The mangled type
was incorrectly SWIGTYPE_std__vectorT_Test_p_std__allocatorT_Test_p_t_t__value_type and now
it is correctly SWIGTYPE_p_Test.
Version 2.0.1 (4 October 2010)
==============================
2010-10-03: wsfulton
Apply patch #3066958 from Mikael Johansson to fix default smart pointer
handling when the smart pointer contains both a const and non-const operator->.
2010-10-01: wsfulton
Add -pcreversion option to display PCRE version information.
2010-10-01: olly
[Ruby] Avoid segfault when a method node has no parentNode
(SF#3034054).
2010-10-01: olly
[Python] Allow reinitialisation to work with an embedded Python
interpreter (patch from Jim Carroll in SF#3075178).
2010-09-28: wsfulton
[C#] Apply patch from Tomas Dirvanauskas for std::map wrappers to avoid
throwing exceptions with normal usage of iterators.
2010-09-27: olly
[Python] Improve error message given when a parameter of the wrong
type is passed to an overloaded method (SF#3027355).
2010-09-25: wsfulton
Apply SF patch #3075150 - Java directors using static variables in
named namespace.
2010-09-24: wsfulton
More file and line error/warning reporting fixes where SWIG macros
are used within {} braces (where the preprocessor expands macros),
for example macros within %inline {...} and %fragment(...) {...}
and nested structs.
2010-09-18: wsfulton
More file and line error/warning reporting fixes for various inherited
class problems.
2010-09-15: wsfulton
A much improved debugging of SWIG source experience is now available and
documented in the "Debugging SWIG" section in the Doc/Devel/internals.html
file, including a swig.dbg support file for the gdb debugger.
2010-09-11: wsfulton
Fix incorrect line number reporting in errors/warnings when a macro
definition ends with '/' and it is not the end of a C comment.
2010-09-11: wsfulton
Fix incorrect line number reporting in errors/warnings after parsing
macro invocations with parameters given over more than one line.
2010-09-10: wsfulton
Remove extraneous extra line in preprocessed output after including files
which would sometimes lead to error/warning messages two lines after the
end of the file.
2010-09-10: wsfulton
Fix #2149523 - Incorrect line number reporting in errors after parsing macros
containing C++ comments.
2010-09-08: olly
[PHP] Fix handling of OUTPUT typemaps (Patch from Ryan in SF#3058394).
2010-09-03: wsfulton
Fix erroneous line numbers in error messages for macro expansions, for example,
the error message now points to instantiation of the macro, ie the last line here:
#define MACRO2(a, b)
#define MACRO1(NAME) MACRO2(NAME,2,3)
MACRO1(abc)
2010-09-02: wsfulton
Fix line numbers in error and warning messages for preprocessor messages within
%inline, for example:
%inline %{
#define FOOBAR 1
#define FOOBAR "hi"
%}
2010-09-02: wsfulton
Fix line numbers in error and warning messages which were cumulatively one
less than they should have been after parsing each %include/%import - bug
introduced in swig-1.3.32. Also fix line numbers in error and warning messages
when new line characters appear between the %include / %import statement and
the filename.
2010-08-30: wsfulton
Fix line number and file name reporting for some macro preprocessor warnings.
The line number of the macro argument has been corrected and the line number
of the start of the macro instead of one past the end of the macro is used.
Some examples:
file.h:11: Error: Illegal macro argument name '..'
file.h:19: Error: Macro 'DUPLICATE' redefined,
file.h:15: Error: previous definition of 'DUPLICATE'.
file.h:25: Error: Variable-length macro argument must be last parameter
file.h:32: Error: Illegal character in macro argument name
file.i:37: Error: Macro 'SIT' expects 2 arguments
2010-08-26: wsfulton
Fix __LINE__ and __FILE__ expansion reported by Camille Gillot. Mostly this
did not work at all. Also fixes SF #2822822.
2010-08-17: wsfulton
[Perl] Fix corner case marshalling of doubles - errno was not being correctly
set before calling strtod - patch from Justin Vallon - SF Bug #3038936.
2010-08-17: wsfulton
Fix make distclean when some of the more obscure languages are detected by
configure - fixes from Torsten Landschoff.
2010-07-28: wsfulton
Restore configuring out of source for the test-suite since it broke in 1.3.37.
As previously, if running 'make check-test-suite' out of source, it needs to be
done by invoking configure with a relative path. Invoking configure with an
absolute path will not work. Running the full 'make check' still needs to be
done in the source tree.
2010-07-16: wsfulton
Fix wrapping of function pointers and member function pointers when the function
returns by reference.
2010-07-13: vadz
Removed support for the old experimental "rxspencer" encoder and
"[not]rxsmatch" in %rename (see the 01/16/2006 entry). The new and
officially supported "regex" encoder and "[not]regexmatch" checks
should be used instead (see the two previous entries). Please
replace "%(rxspencer:[pat][subst])s" with "%(regex:/pat/subst/)s"
when upgrading. Notice that you will also need to replace the back-
references of form "@1" with the more standard "\\1" and may need to
adjust your regular expressions syntax as the new regex encoder uses
Perl-compatible syntax and not (extended) POSIX syntax as the old one.
*** POTENTIAL INCOMPATIBILITY ***
2010-07-13: vadz
Add "regexmatch", "regextarget" and "notregexmatch" which can be
used to apply %rename directives to the declarations matching the
specified regular expression only. The first two can be used
interchangeably, both of the %renames below do the same thing:
%rename("$ignore", regexmatch$name="Old$") "";
%rename("$ignore", regextarget=1) "Old$";
(namely ignore the declarations having "Old" suffix).
"notregexmatch" restricts the match to only the declarations which
do not match the regular expression, e.g. here is how to rename to
lower case versions all declarations except those consisting from
capital letters only:
%rename("$(lowercase)s", notregexmatch$name="^[A-Z]+$") "";
2010-07-13: vadz
Add the new "regex" encoder that can be used in %rename, e.g.
%rename("regex:/(\\w+)_(.*)/\\2/") "";
to remove any alphabetical prefix from all identifiers. The syntax
of the regular expressions is Perl-like and PCRE library
(http://www.pcre.org/) is used to implement this feature but notice
that backslashes need to be escaped as usual inside C strings.
Original patch from Torsten Landschoff.
2010-07-08: wsfulton
Fix #3024875 - shared_ptr of classes with non-public destructors. This also fixes
the "unref" feature when used on classes with non-public destructors.
2010-06-17: ianlancetaylor
[Go] Add the Go language module.
2010-06-10: wsfulton
[Lua] Fix SWIG_lua_isnilstring multiply defined when using multiple
modules and wrapping strings. Patch from 'Number Cruncher'.
2010-06-10: olly
[PHP] Fix directors to correctly call a method with has a
different name in PHP to C++ (we were always using the C++ name
in this case).
2010-06-03: wsfulton
Fix uncompilable code when %rename results in two enum items
with the same name. Reported by Vadim Zeitlin.
Version 2.0.0 (2 June 2010)
===========================
2010-06-02: wsfulton
[C#] Fix SWIG_STD_VECTOR_ENHANCED macro used in std::vector to work with
types containing commas, for example:
SWIG_STD_VECTOR_ENHANCED(std::pair< double, std::string >)
2010-06-01: wsfulton
Add in std_shared_ptr.i for wrapping std::shared_ptr. Requires the %shared_ptr
macro like in the boost_shared_ptr.i library. std::tr1::shared_ptr can also be
wrapped if the following macro is defined:
#define SWIG_SHARED_PTR_SUBNAMESPACE tr1
%include <std_shared_ptr.i>
shared_ptr is also documented in Library.html now.
2010-05-27: wsfulton
Add the ability for $typemap special variable macros to call other $typemap
special variable macros, for example:
%typemap(cstype) CC "CC"
%typemap(cstype) BB "$typemap(cstype, CC)"
%typemap(cstype) AA "$typemap(cstype, BB)"
void hah(AA aa);
This also fixes C# std::vector containers of shared_ptr and %shared_ptr.
Also added diagnostics for $typemap with -debug-tmsearch, for example, the
above displays additional diagnostic lines starting "Containing: ":
example.i:34: Searching for a suitable 'cstype' typemap for: AA aa
Looking for: AA aa
Looking for: AA
Using: %typemap(cstype) AA
Containing: $typemap(cstype, BB)
example.i:31: Searching for a suitable 'cstype' typemap for: BB
Looking for: BB
Using: %typemap(cstype) BB
Containing: $typemap(cstype, CC)
example.i:29: Searching for a suitable 'cstype' typemap for: CC
Looking for: CC
Using: %typemap(cstype) CC
2010-05-26: olly
Fix %attribute2ref not to produce a syntax error if the last
argument (AccessorMethod) is omitted. Patch from David Piepgras
in SF#2235756.
2010-05-26: olly
[PHP] When using %throws or %catches, SWIG-generated PHP5 wrappers
now throw PHP Exception objects instead of giving a PHP error of
type E_ERROR.
This change shouldn't cause incompatibility issues, since you can't
set an error handler for E_ERROR, so previously PHP would just exit
which also happens for unhandled exceptions. The benefit is you can
now catch them if you want to.
Fixes SF#2545578 and SF#2955522.
2010-05-25: olly
[PHP] Add missing directorin typemap for const std::string &.
Fixes SF#3006404 reported by t-Legiaw.
2010-05-23: wsfulton
[C#] Fix #2957375 - SWIGStringHelper and SWIGExceptionHelper not always being
initialized before use in .NET 4 as the classes were not marked beforefieldinit.
A static constructor has been added to the intermediary class like this:
%pragma(csharp) imclasscode=%{
static $imclassname() {
}
%}
If you had added your own custom static constructor to the intermediary class in
the same way as above, you will have to modify your approach to use static variable
initialization or define SWIG_CSHARP_NO_IMCLASS_STATIC_CONSTRUCTOR - See csharphead.swg.
*** POTENTIAL INCOMPATIBILITY ***
2010-05-23: wsfulton
Fix #2408232. Improve shared_ptr and intrusive_ptr wrappers for classes in an
inheritance hierarchy. No special treatment is needed for derived classes.
The proxy class also no longer needs to be specified, it is automatically
deduced. The following macros are deprecated:
SWIG_SHARED_PTR(PROXYCLASS, TYPE)
SWIG_SHARED_PTR_DERIVED(PROXYCLASS, BASECLASSTYPE, TYPE)
and have been replaced by
%shared_ptr(TYPE)
Similarly for intrusive_ptr wrappers, the following macro is deprecated:
SWIG_INTRUSIVE_PTR(PROXYCLASS, TYPE)
SWIG_INTRUSIVE_PTR_DERIVED(PROXYCLASS, BASECLASSTYPE, TYPE)
and have been replaced by
%intrusive_ptr(TYPE)
2010-05-21: olly
[PHP] Stop generating a bogus line of code in certain constructors.
This was mostly harmless, but caused a PHP notice to be issued, if
enabled (SF#2985684).
2010-05-18: wsfulton
[Java] Fix member pointers on 64 bit platforms.
2010-05-14: wsfulton
Fix wrapping of C++ enum boolean values reported by Torsten Landschoff:
typedef enum { PLAY = true, STOP = false } play_state;
2010-05-14: olly
[PHP] Fix wrapping of global variables which was producing
uncompilable code in some cases.
2010-05-12: drjoe
[R] Add two more changes from Wil Nolan. Get garbage
collection to work. Implement newfree
2010-05-09: drjoe
Fix bug reported by Wil Nolan change creation of string so
that R 2.7.0+ can use char hashes
2010-05-07: wsfulton
Apply patch #2955146 from Sergey Satskiy to fix expressions containing divide by
operator in constructor initialization lists.
2010-05-05: wsfulton
[R] Memory leak fix handling const std::string & inputs, reported by Will Nolan.
2010-05-01: wsfulton
Typemap matching enhancement for non-default typemaps. Previously all
qualifiers were stripped in one step, now they are stripped one at a time
starting with the left most qualifier. For example, int const*const
is first stripped to int *const then int *.
*** POTENTIAL INCOMPATIBILITY ***
2010-04-25: bhy
[Python] Fix #2985655 - broken constructor renaming.
2010-04-14: wsfulton
Typemap fragments are now official and documented in Typemaps.html.
2010-04-09: wsfulton
[Ruby] Fix #2048064 and #2408020.
Apply Ubuntu patch to fix Ruby and std::vector wrappers with -minherit.
https://bugs.launchpad.net/ubuntu/+source/swig1.3/+bug/522874
2010-04-09: wsfulton
[Mzscheme] Apply Ubuntu patch to fix std::map wrappers:
https://bugs.launchpad.net/ubuntu/+source/swig1.3/+bug/203876
2010-04-09: wsfulton
[Python] Apply patch #2952374 - fix directors and the -nortti option.
2010-04-09: wsfulton
[Lua] Fix #2887254 and #2946032 - SWIG_Lua_typename using wrong stack index.
2010-04-03: wsfulton
[Python] Fix exceptions being thrown with the -threads option based on patch from Arto Vuori.
Fixes bug #2818499.
2010-04-03: wsfulton
Fix Makefile targets: distclean and maintainer-clean
2010-04-02: wsfulton
[Lua] Fix char pointers, wchar_t pointers and char arrays so that nil can be passed as a
valid value. Bug reported by Gedalia Pasternak.
2010-04-01: wsfulton
Numerous subtle typemap matching rule fixes when using the default type. The typemap
matching rules are to take a type and find the best default typemap (SWIGTYPE, SWIGTYPE* etc),
then look for the next best match by reducing the chosen default type. The type deduction
now follows C++ class template partial specialization matching rules.
Below are the set of changes made showing the default type deduction
along with the old reduced type and the new version of the reduced type:
SWIGTYPE const &[ANY]
new: SWIGTYPE const &[]
old: SWIGTYPE (&)[ANY]
SWIGTYPE *const [ANY]
new: SWIGTYPE const [ANY]
old: SWIGTYPE *[ANY]
SWIGTYPE const *const [ANY]
new: SWIGTYPE *const [ANY]
old: SWIGTYPE const *[ANY]
SWIGTYPE const *const &
new: SWIGTYPE *const &
old: SWIGTYPE const *&
SWIGTYPE *const *
new: SWIGTYPE const *
old: SWIGTYPE **
SWIGTYPE *const &
new: SWIGTYPE const &
old: SWIGTYPE *&
Additionally, a const SWIGTYPE lookup is used now for any constant type. Some examples, where
T is some reduced type, eg int, struct Foo:
T const
new: SWIGTYPE const
old: SWIGTYPE
T *const
new: SWIGTYPE *const
old: SWIGTYPE *
T const[]
new: SWIGTYPE const[]
old: SWIGTYPE[]
enum T const
new: enum SWIGTYPE const
old: enum SWIGTYPE
T (*const )[]
new: SWIGTYPE (*const )[]
old: SWIGTYPE (*)[]
Reminder: the typemap matching rules can now be seen for any types being wrapped by using
either the -debug-tmsearch or -debug-tmused options.
In practice this leads to some subtle matching rule changes and the majority of users
won't notice any changes, except in the prime area of motivation for this change: Improve
STL containers of const pointers and passing const pointers by reference. This is fixed
because many of the STL containers use a type 'T const&' as parameters and when T is
a const pointer, for example, 'K const*', then the full type is 'K const*const&'. This
means that the 'SWIGTYPE *const&' typemaps now match when T is either a non-const or
const pointer. Furthermore, some target languages incorrectly had 'SWIGTYPE *&' typemaps
when these should have been 'SWIGTYPE *const&'. These have been corrected (Java, C#, Lua, PHP).
*** POTENTIAL INCOMPATIBILITY ***
2010-03-13: wsfulton
[Java] Some very old deprecated pragma warnings are now errors.
2010-03-13: wsfulton
Improve handling of file names and directories containing double/multiple path separators.
2010-03-10: mutandiz (Mikel Bancroft)
[allegrocl] Use fully qualified symbol name of cl::identity in emit_defun().
2010-03-06: wsfulton
[Java] The intermediary JNI class modifiers are now public by default meaning these
intermediary low level functions are now accessible by default from outside any package
used. The proxy class pointer constructor and getCPtr() methods are also now public.
These are needed in order for the nspace option to work without any other mods.
The previous default of protected access can be restored using:
SWIG_JAVABODY_METHODS(protected, protected, SWIGTYPE)
%pragma(java) jniclassclassmodifiers = "class"
2010-03-06: wsfulton
[C#] Added the nspace feature for C#. Documentation for the nspace feature is now available.
2010-03-04: wsfulton
Added the nspace feature. This adds some improved namespace support. Currently only Java
is supported for target languages, where C++ namespaces are automatically translated into
Java packages. The feature only applies to classes,struct,unions and enums declared within
a namespace. Methods and variables declared in namespaces still effectively have their
namespaces flattened. Example usage:
%feature(nspace) Outer::Inner1::Color;
%feature(nspace) Outer::Inner2::Color;
namespace Outer {
namespace Inner1 {
struct Color {
...
};
}
namespace Inner2 {
struct Color {
...
};
}
}
For Java, the -package option is also required when using the nspace feature. Say
we use -package com.myco, the two classes can then be accessed as follows from Java:
com.myco.Outer.Inner1.Color and com.myco.Outer.Inner2.Color.
2010-02-27: wsfulton
[Python] Remove -dirvtable from the optimizations included by -O as it this option
currently leads to memory leaks as reported by Johan Blake.
2010-02-27: wsfulton
License code changes: SWIG Source is GPL-v3 and library code license is now clearer
and is provided under a very permissive license. See https://www.swig.org/legal.html.
2010-02-13: wsfulton
[Ruby] A few fixes for compiling under ruby-1.9.x including patch from 'Nibble'.
2010-02-13: wsfulton
[Ruby] Apply patch from Patrick Bennett to fix RARRAY_LEN and RARRAY_PTR usage for Ruby 1.9.x
used in various STL wrappers.
2010-02-13: wsfulton
[C#, Java] Fix incorrect multiply defined symbol name error when an enum item
and class name have the same name, as reported by Nathan Krieger. Example:
class Vector {};
namespace Text {
enum Preference { Vector };
}
This also fixes other incorrect corner case target language symbol name clashes.
2010-02-11: wsfulton
Add the -debug-lsymbols option for displaying the target language layer symbols.
2010-02-09: wsfulton
Fix -MM and -MMD options on Windows. They were not omitting files in the SWIG library as
they should be.
2010-02-08: wsfulton
Fix #1807329 - When Makefile dependencies are being generated using the -M family of options
on Windows, the file paths have been corrected to use single backslashes rather than double
backslashes as path separators.
2010-02-06: wsfulton
Fix #2918902 - language specific files not being generated in correct directory on
Windows when using forward slashes for -o, for example:
swig -python -c++ -o subdirectory/theinterface_wrap.cpp subdirectory/theinterface.i
2010-02-05: wsfulton
Fix #2894405 - assertion when using -xmlout.
2010-01-28: wsfulton
Fix typemap matching bug when a templated type has a typemap both specialized and not
specialized. For example:
template<typename T> struct XX { ... };
%typemap(in) const XX & "..."
%typemap(in) const XX< int > & "..."
resulted in the 2nd typemap being applied for all T in XX< T >.
2010-01-22: wsfulton
Fix #2933129 - typemaps not being found when the unary scope operator (::) is used to denote
global scope, the typemap is now used in situations like this:
struct X {};
%typemap(in) const X & "..."
void m(const ::X &);
and this:
struct X {};
%typemap(in) const ::X & "..."
void m(const X &);
2010-01-20: wsfulton
Fix some unary scope operator (::) denoting global scope problems in the types generated
into the C++ layer. Previously the unary scope operator was dropped in the generated code
if the type had any sort of qualifier, for example when using pointers, references, like
::foo*, ::foo&, bar< ::foo* >.
2010-01-13: olly
[PHP] Add datetime to the list of PHP predefined classes (patch
from David Fletcher in SF#2931042).
2010-01-11: wsfulton
Slight change to warning, error and diagnostic reporting. The warning number is no
longer shown within brackets. This is to help default parsing of warning messages by
other tools, vim on Unix in particular.
Example original display using -Fstandard:
example.i:20: Warning(401): Nothing known about base class 'B'. Ignored.
New display:
example.i:20: Warning 401: Nothing known about base class 'B'. Ignored.
Also subtle fix to -Fmicrosoft format adding in missing space. Example original display:
example.i(20): Warning(401): Nothing known about base class 'Base'. Ignored.
New display:
example.i(20) : Warning 401: Nothing known about base class 'Base'. Ignored.
2010-01-10: wsfulton
Fix a few inconsistencies in reporting of file/line numberings including modifying
the overload warnings 509, 512, 516, 474, 475 to now be two line warnings.
2010-01-10: wsfulton
Modify -debug-tags output to use standard file name/line reporting so that editors
can easily navigate to the appropriate lines.
Was typically:
. top . include . include (/usr/share/swig/temp/trunk/Lib/swig.swg:312)
. top . include . include . include (/usr/share/swig/temp/trunk/Lib/swigwarnings.swg:39)
now:
/usr/share/swig/temp/trunk/Lib/swig.swg:312: . top . include . include
/usr/share/swig/temp/trunk/Lib/swigwarnings.swg:39: . top . include . include . include
2010-01-03: wsfulton
Fix missing file/line numbers for typemap warnings and in output from the
-debug-tmsearch/-debug-tmused options.
2010-01-03: wsfulton
Add typemaps used debugging option (-debug-tmused). When used each line displays
the typemap used for each type for which code is being generated including the file
and line number related to the type. This is effectively a condensed form of the
-debug-tmsearch option. Documented in Typemaps.html.
2009-12-23: wsfulton
Fix for %javaexception and directors so that all the appropriate throws clauses
are generated. Problem reported by Peter Greenwood.
2009-12-20: wsfulton
Add -debug-tmsearch option for debugging the typemap pattern matching rules.
Documented in Typemaps.html.
2009-12-12: wsfulton
[Octave] Remove the -api option and use the new OCTAVE_API_VERSION_NUMBER
macro provided in the octave headers for determining the api version instead.
2009-12-04: olly
[Ruby] Improve support for Ruby 1.9 under GCC. Addresses part of
SF#2859614.
2009-12-04: olly
Fix handling of modulo operator (%) in constant expressions
(SF#2818562).
2009-12-04: olly
[PHP] "empty" is a reserved word in PHP, so rename empty() method
on STL classes to "is_empty()" (previously this was automatically
renamed to "c_empty()").
*** POTENTIAL INCOMPATIBILITY ***
2009-12-03: olly
[PHP] Add typemaps for long long and unsigned long long, and for
pointer to method.
2009-12-02: olly
[PHP] Fix warning and rename of reserved class name to be case
insensitive.
2009-12-01: wsfulton
Revert support for %extend and memberin typemaps added in swig-1.3.39. The
memberin typemaps are ignored again for member variables within a %extend block.
Documentation inconsistency reported by Torsten Landschoff.
2009-11-29: wsfulton
[Java, C#] Fix generated quoting when using %javaconst(1)/%csconst(1) for
static const char member variables.
%javaconst(1) A;
%csconst(1) A;
struct X {
static const char A = 'A';
};
2009-11-26: wsfulton
[Java, C#] Fix %javaconst(1)/%csconst(1) for static const member variables to
use the actual constant value if it is specified, rather than the C++ code to
access the member.
%javaconst(1) EN;
%csconst(1) EN;
struct X {
static const int EN = 2;
};
2009-11-23: wsfulton
C++ nested typedef classes can now be handled too, for example:
struct Outer {
typedef Foo { } FooTypedef1, FooTypedef2;
};
2009-11-18: wsfulton
The wrappers for C nested structs are now generated in the same order as declared
in the parsed code.
2009-11-18: wsfulton
Fix #491476 - multiple declarations of nested structs, for example:
struct Outer {
struct {
int val;
} inner1, inner2, *inner3, inner4[1];
} outer;
2009-11-17: wsfulton
Fix parsing of enum declaration and initialization, for example:
enum ABC {
a,
b,
c
} A = a, *pC = &C, array[3] = {a, b, c};
2009-11-17: wsfulton
Fix parsing of struct declaration and initialization, for example:
struct S {
int x;
} instance = { 10 };
2009-11-15: wsfulton
Fix #1960977 - Syntax error parsing derived nested class declaration and member
variable instance.
2009-11-14: wsfulton
Fix #2310483 - function pointer typedef within extern "C" block.
2009-11-13: wsfulton
Fix usage of nested template classes within templated classes so that compilable code
is generated.
2009-11-13: olly
[php] Fix place where class prefix (as specified with -prefix)
wasn't being used. Patch from gverbruggen in SF#2892647.
2009-11-12: wsfulton
Fix usage of nested template classes so that compilable code is generated - the nested
template class is now treated like a normal nested classes, that is, as an opaque type
unless the nestedworkaround feature is used.
2009-11-12: wsfulton
Replace SWIGWARN_PARSE_NESTED_CLASS with SWIGWARN_PARSE_NAMED_NESTED_CLASS and
SWIGWARN_PARSE_UNNAMED_NESTED_CLASS for named and unnamed nested classes respectively.
Named nested class ignored warnings can now be suppressed by name using %warnfilter, eg:
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::Inner;
but clearly unnamed nested classes cannot and the global suppression is still required, eg:
#pragma SWIG nowarn=SWIGWARN_PARSE_UNNAMED_NESTED_CLASS
2009-11-11: wsfulton
Added the nestedworkaround feature as a way to use the full functionality of a nested class
(C++ mode only). It removes the nested class from SWIG's type information so it is as if SWIG
had never parsed the nested class. The documented nested class workarounds using a global
fake class stopped working when SWIG treated the nested class as an opaque pointer, and
this feature reverts this behaviour. The documentation has been updated with details of how
to use and implement it, see the "Nested classes" section in SWIGPlus.html.
2009-11-11: wsfulton
There were a number of C++ cases where nested classes/structs/unions were being handled
as if C code was being parsed which would oftentimes lead to uncompilable code as an
attempt was made to wrap the nested structs like it is documented for C code. Now all
nested structs/classes/unions are ignored in C++ mode, as was always documented. However,
there is an improvement as usage of nested structs/classes/unions is now always treated
as an opaque type by default, resulting in generated code that should always compile.
*** POTENTIAL INCOMPATIBILITY ***
2009-11-09: drjoe
Fix R for -fcompact and add std_map.i
2009-11-08: wsfulton
Fix inconsistency for nested structs/unions/classes. Uncompilable code was being
generated when inner struct and union declarations were used as types within the
inner struct. The inner struct/union is now treated as a forward declaration making the
behaviour the same as an inner class. (C++ code), eg:
struct Outer {
struct InnerStruct { int x; };
InnerStruct* getInnerStruct();
};
2009-11-08: wsfulton
Ignored nested class/struct warnings now display the name of the ignored class/struct.
2009-11-07: wsfulton
Bug #1514681 - Fix nested template classes within a namespace generated uncompilable
code and introduced strange side effects to other wrapper code especially code
after the nested template class. Note that nested template classes are still ignored.
2009-11-07: wsfulton
Add new debug options:
-debug-symtabs - Display symbol tables information
-debug-symbols - Display target language symbols in the symbol tables
-debug-csymbols - Display C symbols in the symbol tables
2009-11-03: wsfulton
Fix some usage of unary scope operator (::) denoting global scope, for example:
namespace AA { /* ... */ }
using namespace ::AA;
and bug #1816802 - SwigValueWrapper should be used:
struct CC {
CC(int); // no default constructor
};
::CC x();
and in template parameter specializations:
struct S {};
template <typename T> struct X { void a() {} };
template <> struct X<S> { void b() {} };
%template(MyTConcrete) X< ::S >;
plus probably some other corner case usage of ::.
2009-11-02: olly
[Python] Fix potential memory leak in initialisation code for the
generated module.
2009-10-23: wsfulton
Fix seg fault when using a named nested template instantiation using %template(name)
within a class. A warning that these are not supported is now issued plus processing
continues as if no name was given.
2009-10-20: wsfulton
[Python] Fix std::vector<const T*>. This would previously compile, but not run correctly.
2009-10-20: wsfulton
Fixed previously fairly poor template partial specialization and explicit
specialization support. Numerous bugs in this area have been fixed including:
- Template argument deduction implemented for template type arguments, eg this now
works:
template<typename T> class X {};
template<typename T> class X<T *> {};
%template(X1) X<const int *>; // Chooses T * specialization
and more complex cases with multiple parameters and a mix of template argument
deduction and explicitly specialised parameters, eg:
template <typename T1, typename T2> struct TwoParm { void a() {} };
template <typename T1> struct TwoParm<T1 *, int *> { void e() {} };
%template(E) TwoParm<int **, int *>;
Note that the primary template must now be in scope, like in C++, when
an explicit or partial specialization is instantiated with %template.
*** POTENTIAL INCOMPATIBILITY ***
2009-09-14: wsfulton
[C#] Add %csattributes for adding C# attributes to enum values, see docs for example.
2009-09-11: wsfulton
Fix memmove regression in cdata.i as reported by Adriaan Renting.
2009-09-07: wsfulton
Fix constant expressions containing <= or >=.
2009-09-02: wsfulton
The following operators in constant expressions now result in type bool for C++
wrappers and remain as type int for C wrappers, as per each standard:
&& || == != < > <= >= (Actually the last 4 are still broken). For example:
#define A 10
#define B 10
#define A_EQ_B A == B // now wrapped as type bool for C++
#define A_AND_B A && B // now wrapped as type bool for C++
2009-09-02: wsfulton
Fix #2845746. true and false are now recognised keywords (only when wrapping C++).
Constants such as the following are now wrapped (as type bool):
#define FOO true
#define BAR FOO && false
Version 1.3.40 (18 August 2009)
===============================
2009-08-17: olly
[Perl] Add "#undef do_exec" to our clean up of Perl global
namespace pollution.
2009-08-17: olly
[PHP] Fix to wrap a resource returned by __get() in a PHP object (SF#2549217).
2009-08-17: wsfulton
Fix #2797485 After doing a 'make clean', install fails if yodl2man or yodl2html
is not available.
2009-08-16: wsfulton
[Octave] Caught exceptions display the type of the C++ exception instead of the
generic "c++-side threw an exception" message.
2009-08-16: wsfulton
[Java] When %catches is used, fix so that any classes specified in the "throws"
attribute of the "throws" typemap are generated into the Java method's throws clause.
2009-08-16: wsfulton
[C#] Fix exception handling when %catches is used, reported by Juan Manuel Alvarez.
2009-08-15: wsfulton
Fix %template seg fault on some cases of overloading the templated method.
Bug reported by Jan Kupec.
2009-08-15: wsfulton
[Ruby] Add numerous missing wrapped methods for std::vector<bool> specialization
as reported by Youssef Jones.
2009-08-14: wsfulton
[Perl] Add SWIG_ConvertPtrAndOwn() method into the runtime for smart pointer
memory ownership control. shared_ptr support still to be added. Patch from
David Fletcher.
2009-08-14: olly
[PHP] PHP5 now wraps static member variables as documented.
2009-08-14: olly
[PHP] Update the PHP "class" example to work with PHP5 and use
modern wrapping features.
2009-08-13: wsfulton
[PHP] std::vector wrappers overhaul. They no longer require the
specialize_std_vector() macro. Added wrappers for capacity() and reserve().
2009-08-13: wsfulton
[PHP] Add const reference typemaps. const reference primitive types are
now passed by value rather than pointer like the other target languages.
Fixes SF#2524029.
2009-08-08: wsfulton
[Python] More user friendly AttributeError is raised when there are
no constructors generated for the proxy class in the event that the
class is abstract - the error message is now
"No constructor defined - class is abstract" whereas if there are no
public constructors for any other reason and the class is not abstract,
the message remains
"No constructor defined".
[tcl] Similarly for tcl when using -itcl.
2009-08-04: olly
[PHP] Fix generated code to work with PHP 5.3.
2009-08-04: vmiklos
[PHP] Various mathematical functions (which would conflict
with the built-in PHP ones) are now automatically handled by
adding a 'c_' prefix.
2009-08-03: wsfulton
[C#] The std::vector<T> implementation is improved and now uses $typemap such
that the proxy class for T no longer has to be specified in some macros
for correct C# compilation; the following macros are deprecated, where
CSTYPE was the C# type for the C++ class CTYPE:
SWIG_STD_VECTOR_SPECIALIZE_MINIMUM(CSTYPE, CTYPE)
usage should be removed altogether
SWIG_STD_VECTOR_SPECIALIZE(CSTYPE, CTYPE)
should be replaced with:
SWIG_STD_VECTOR_ENHANCED(CTYPE)
Some more details in csharp/std_vector.i
*** POTENTIAL INCOMPATIBILITY ***
2009-07-31: olly
[Python] Fix indentation so that we give a useful error if the
module can't be loaded. Patch from Gaetan Lehmann in SF#2829853.
2009-07-29: wsfulton
Add $typemap(method, typelist) special variable macro. This allows
the contents of a typemap to be inserted within another typemap.
Fully documented in Typemaps.html.
2009-07-29: vmiklos
[PHP] Static member variables are now prefixed with the
class name. This allows static member variables with the
same name in different classes.
2009-07-29: olly
[Python] Add missing locks to std::map wrappers. Patch from
Paul Hampson in SF#2813836.
2009-07-29: olly
[PHP] Fix memory leak in PHP OUTPUT typemaps. Reported by Hitoshi
Amano in SF#2826322.
2009-07-29: olly
[PHP] Fix memory leak in PHP resource destructor for classes
without a destructor and non-class types. Patch from Hitoshi Amano
in SF#2825303.
2009-07-28: olly
[PHP] Update warnings about clashes between identifiers and PHP
keywords and automatic renaming to work with the PHP5 class
wrappers. Fixes SF#1613679.
2009-07-28: vmiklos
[PHP] If a member function is not public but it has a base
which is public, then now a warning is issued and the member
function will be public, as PHP requires this.
2009-07-21: vmiklos
[PHP] Director support added.
2009-07-15: olly
[Perl] Don't specify Perl prototype "()" for a constructor with a
different name to the class, as such constructors can still take
parameters.
2009-07-12: xavier98
[Octave] Add support for Octave 3.2 API
2009-07-05: olly
[PHP] Update the list of PHP keywords - "cfunction" is no longer a
keyword in PHP5 and PHP 5.3 added "goto", "namespace", "__DIR__",
and "__NAMESPACE__".
2009-07-03: olly
[Tcl] To complement USE_TCL_STUBS, add support for USE_TK_STUBS
and SWIG_TCL_STUBS_VERSION. Document all three in the Tcl chapter
of the manual. Based on patch from SF#2810380 by Christian
Gollwitzer.
2009-07-02: vmiklos
[PHP] Added factory.i for PHP, see the li_factory testcase
for more info on how to use it.
2009-07-02: wsfulton
Fix -Wallkw option as reported by Solomon Gibbs.
2009-07-02: wsfulton
Fix syntax error when a nested struct contains a comment containing a * followed
eventually by a /. Regression from 1.3.37, reported by Solomon Gibbs.
2009-07-01: vmiklos
[PHP] Unknown properties are no longer ignored in proxy
classes.
2009-07-01: vmiklos
[PHP] Fixed %newobject behaviour, previously any method
marked with %newobject was handled as a constructor.
2009-06-30: olly
[Ruby] Undefine close and connect macros defined by Ruby API
headers as we don't need them and they can clash with C++ methods
being wrapped. Patch from Vit Ondruch in SF#2814430.
2009-06-26: olly
[Ruby] Fix to handle FIXNUM values greater than MAXINT passed for a
double parameter.
2009-06-24: wsfulton
Fix wrapping methods with default arguments and the compactdefaultargs feature
where a class is passed by value and is assigned a default value. The SwigValueWrapper
template workaround for a missing default constructor is no longer used as the code
generated does not call the default constructor.
2009-06-16: wsfulton
[Java,C#] Fix enum marshalling when %ignore is used on one of the enum items.
Incorrect enum values were being passed to the C++ layer or compilation errors resulted.
2009-06-02: talby
[Perl] Resolved reference.i overload support problem
identified by John Potowsky.
2009-05-26: wsfulton
[C#] Improved std::map wrappers based on patch from Yuval Baror. The C# proxy
now implements System.Collections.Generic.IDictionary<>.
These std:map wrappers have a non-backwards compatible overhaul to make them
like a .NET IDictionary. Some method names have changed as following:
set -> setitem (use this[] property now)
get -> getitem (use this[] property now)
has_key -> ContainsKey
del -> Remove
clear -> Clear
The following macros used for std::map wrappers are deprecated and will no longer work:
specialize_std_map_on_key
specialize_std_map_on_value
specialize_std_map_on_both
*** POTENTIAL INCOMPATIBILITY ***
2009-05-20: vmiklos
[PHP] Add the 'thisown' member to classes. The usage of it
is the same as the Python thisown one: it's 1 by default and
you can set it to 0 if you want to prevent freeing it. (For
example to prevent a double free.)
2009-05-14: bhy
[Python] Fix the wrong pointer value returned by SwigPyObject_repr().
2009-05-13: mutandiz (Mikel Bancroft)
[allegrocl] Minor tweak when wrapping in -nocwrap mode.
2009-05-11: wsfulton
[C#] Improved std::vector wrappers on the C# proxy side from Yuval Baror. These
implement IList<> instead of IEnumerable<> where possible.
2009-04-29: wsfulton
[Java, C#] Add the 'notderived' attribute to the javabase and csbase typemaps.
When this attribute is set, the typemap will not apply to classes that are derived
from a C++ base class, eg
%typemap(csbase, notderived="1") SWIGTYPE "CommonBase"
2009-04-29: olly
[Python] Don't attempt to acquire the GIL in situations where we
know that it will already be locked. This avoids some dead-locks
with mod_python (due to mod_python bugs which are apparently
unlikely to ever be fixed), and results in smaller wrappers which
run a little faster (in tests with Xapian on x86-64 Ubuntu 9.04,
the stripped wrapper library was 11% smaller and ran 2.7% faster).
2009-04-21: wsfulton
[C#] Fix #2753469 - bool &OUTPUT and bool *OUTPUT typemaps initialisation.
2009-04-09: wsfulton
Fix #2746858 - C macro expression using floating point numbers
2009-03-30: olly
[PHP] The default out typemap for char[ANY] now returns the string up to a
zero byte, or the end of the array if there is no zero byte. This
is the same as Python does, and seems more generally useful than
the previous behaviour of returning the whole contents of the array
including any zero bytes. If you want the old behaviour, you can provide
your own typemap to do this:
%typemap(out) char [ANY]
%{
RETVAL_STRINGL($1, $1_dim0, 1);
%}
Version 1.3.39 (21 March 2009)
==============================
2009-03-19: bhy
[Python] Fix the memory leak related to Python 3 unicode and C char* conversion,
which can be shown in the following example before this fix:
from li_cstring import *
i=0
while True:
i += 1
n = str(i)*10
test3(n)
This fix affected SWIG_AsCharPtrAndSize() so you cannot call this function with
a null alloc and non-null cptr argument in Python 3, otherwise a runtime error
will be raised.
2009-03-18: wsfulton
[C#] std::vector<T> wrapper improvements for .NET 2 and also providing the
necessary machinery to use the std::vector<T> wrappers with more advanced features such
as LINQ - the C# proxy class now derives from IEnumerable<>. The default is now to
generate code requiring .NET 2 as a minimum, although the C# code can be compiled
for .NET 1 by defining the SWIG_DOTNET_1 C# preprocessor constant. See the
std_vector.i file for more details.
*** POTENTIAL INCOMPATIBILITY ***
2009-03-12: wsfulton
[Ruby] Fix #2676738 SWIG generated symbol name clashes.
2009-03-01: bhy
[Python] Some fixes for Python 3.0.1 and higher support. In 3.0.1, the C API function
PyObject_Compare is removed, so PyObject_RichCompareBool is used for replacement.
Struct initilization of SwigPyObject and SwigPyObject_as_number changed to reflect
the drop of tp_compare and nb_long.
2009-03-01: bhy
[Python] Fix SF#2583160. Now the importer in Python shadow wrapper take care of the
case that module already imported at other place.
2009-02-28: bhy
[Python] Fix SF#2637352. Move struct declaration of SWIG_module in pyinit.swg before
the method calls, since some C compiler don't allow declaration in middle of function
body.
2009-02-21: wsfulton
[Allegrocl] Fix seg fault wrapping some constant variable (%constant) types.
2009-02-20: wsfulton
[CFFI] Fix seg faults when for %extend and using statements.
2009-02-20: wsfulton
Fix SF #2605955: -co option which broke in 1.3.37.
2009-02-20: wsfulton
New %insert("begin") section added. Also can be used as %begin. This is a new
code section reserved entirely for users and the code within the section is generated
at the top of the C/C++ wrapper file and so provides a means to put custom code
into the wrapper file before anything else that SWIG generates.
2009-02-17: wsfulton
'make clean-test-suite' will now run clean on ALL languages. Previously it only
ran the correctly configured languages. This way it is now possible to clean up
properly after running 'make partialcheck-test-suite'.
2009-02-14: wsfulton
Extend attribute library support for structs/classes and the accessor functions use
pass/return by value semantics. Two new macros are available and usage is identical
to %attribute. These are %attributeval for structs/classes and %attributestring for
string classes, like std::string. See attribute.swg for more details.
2009-02-13: wsfulton
Add support for %extend and memberin typemaps. Previously the memberin typemaps were
ignored for member variables within a %extend block.
2009-02-12: wsfulton
Remove unnecessary temporary variable when wrapping return values that are references.
Example of generated code for wrapping:
struct XYZ {
std::string& refReturn();
};
used to be:
std::string *result = 0 ;
...
{
std::string &_result_ref = (arg1)->refReturn();
result = (std::string *) &_result_ref;
}
Now it is:
std::string *result = 0 ;
...
result = (std::string *) &(arg1)->refReturn();
2009-02-08: bhy
Change the SIZE mapped by %pybuffer_mutable_binary and %pybuffer_binary in pybuffer.i from
the length of the buffer to the number of items in the buffer.
2009-02-08: wsfulton
Fix %feature not working for conversion operators, reported by Matt Sprague, for example:
%feature("cs:methodmodifiers") operator bool "protected";
2009-02-07: wsfulton
[MzScheme] Apply #2081967 configure changes for examples to build with recent PLT versions.
Also fixes Makefile errors building SWIG executable when mzscheme package is installed
(version 3.72 approx and later).
2009-02-04: talby
[Perl] Fix SF#2564192 reported by David Kolovratnk.
SWIG_AsCharPtrAndSize() now handles "get" magic.
Version 1.3.38 (31 January 2009)
================================
2009-01-31: bhy
[Python] Fix SF#2552488 reported by Gaetan Lehmann. Now %pythonprepend
and %pythonappend have correct indentation.
2009-01-31: bhy
[Python] Fix SF#2552048 reported by Gaetan Lehmann. The parameter list
of static member function in generated proxy code should not have the
'self' parameter.
2009-01-29: wsfulton
Fix regression introduced in 1.3.37 where the default output directory
for target language specific files (in the absence of -outdir) was no
longer the same directory as the generated c/c++ file.
2009-01-28: wsfulton
[Java, C#] Fix proxy class not being used when the global scope operator
was used for parameters passed by value. Reported by David Piepgrass.
2009-01-15: wsfulton
[Perl] Fix seg fault when running with -v option, reported by John Ky.
Version 1.3.37 (13 January 2009)
================================
2009-01-13: mgossage
[Lua] Added contract support for requiring that unsigned numbers are >=0
Rewrote much of Examples/Lua/embed3.
Added a lot to the Lua documentation.
2009-01-13: wsfulton
Fix compilation error when using directors on protected virtual overloaded
methods reported by Sam Hendley.
2009-01-12: drjoe
[R] Fixed handling of integer arrays
2009-01-10: drjoe
[R] Fix integer handling in r to deal correctly with signed
and unsigned issues
2009-01-10: wsfulton
Patch #1992756 from Colin McDonald - %contract not working for classes
in namespace
2009-01-05: olly
Mark SWIGPERL5, SWIGPHP5, and SWIGTCL8 as deprecated in the source
code and remove documentation of them.
2008-12-30: wsfulton
Bug #2430756. All the languages now define a macro in the generated C/C++
wrapper file indicating which language is being wrapped. The macro name is the
same as those defined when SWIG is run, eg SWIGJAVA, SWIGOCTAVE, SWIGCSHARP etc
and are listed in the "Conditional Compilation" section in the documentation.
2008-12-23: wsfulton
[Java] Fix #2153773 - %nojavaexception was clearing the exception feature
instead of disabling it. Clearing checked Java exceptions also didn't work.
The new %clearjavaexception can be used for clearing the exception feature.
2008-12-22: wsfulton
Fix #2432801 - Make SwigValueWrapper exception safe for when copy constructors
throw exceptions.
2008-12-21: wsfulton
Apply patch #2440046 which fixes possible seg faults for member and global
variable char arrays when the strings are larger than the string array size.
2008-12-20: wsfulton
The ccache compiler cache has been adapted to work with SWIG and
named ccache-swig. It now works with C/C++ compilers as well as SWIG
and can result in impressive speedups when used to recompile unchanged
code with either a C/C++ compiler or SWIG. Documentation is in CCache.html
or the installed ccache-swig man page.
2008-12-12: wsfulton
Apply patch from Kalyanov Dmitry which fixes parsing of nested structs
containing comments.
2008-12-12: wsfulton
Fix error message in some nested struct and %inline parsing error situations
such as unterminated strings and comments.
2008-12-07: olly
[PHP] Fix warnings when compiling generated wrapper with GCC 4.3.
2008-12-06: wsfulton
[PHP] Deprecate %pragma(php4). Please use %pragma(php) instead.
The following two warnings have been renamed:
WARN_PHP4_MULTIPLE_INHERITANCE -> WARN_PHP_MULTIPLE_INHERITANCE
WARN_PHP4_UNKNOWN_PRAGMA -> WARN_PHP_UNKNOWN_PRAGMA
*** POTENTIAL INCOMPATIBILITY ***
2008-12-04: bhy
[Python] Applied patch SF#2158938: all the SWIG symbol names started with Py
are changed, since they are inappropriate and discouraged in Python
documentation (from http://www.python.org/doc/2.5.2/api/includes.html):
"All user visible names defined by Python.h (except those defined by
the included standard headers) have one of the prefixes "Py" or "_Py".
Names beginning with "_Py" are for internal use by the Python implementation
and should not be used by extension writers. Structure member names do
not have a reserved prefix.
Important: user code should never define names that begin with "Py" or "_Py".
This confuses the reader, and jeopardizes the portability of the user
code to future Python versions, which may define additional names beginning
with one of these prefixes."
Here is a brief list of what changed:
PySwig* -> SwigPy*
PyObject_ptr -> SwigPtr_PyObject
PyObject_var -> SwigVar_PyObject
PySequence_Base, PySequence_Cont, PySequence_Ref ->
SwigPySequence_Base, SwigPySequence_Cont, SwigPySequence_Ref
PyMap* -> SwigPyMap*
We provided a pyname_compat.i for backward compatibility. Users whose code having
these symbols and do not want to change it could simply include this file
at front of your code. A better solution is to run the converting tool on
your code, which has been put in SWIG's SVN trunk (Tools/pyname_patch.py) and
you can download it here:
https://swig.svn.sourceforge.net/svnroot/swig/trunk/Tools/pyname_patch.py
*** POTENTIAL INCOMPATIBILITY ***
2008-12-02: wsfulton
[Python] Apply patch #2143727 from Serge Monkewitz to fix importing base classes
when the package option is specified in %module and that module is %import'ed.
2008-11-28: wsfulton
[UTL] Fix #2080497. Some incorrect acceptance of types in the STL, eg a double * element
passed into a vector<int *> constructor would be accepted, but the ensuing behaviour
was undefined. Now the type conversion correctly raises an exception.
2008-11-24: wsfulton
Add -outcurrentdir option. This sets the default output directory to the current
directory instead of the path specified by the input file. This option enables
behaviour similar to c/c++ compilers. Note that this controls the output directory,
but only in the absence of the -o and/or -outdir options.
2008-11-23: wsfulton
[ruby] Apply patch #2263850 to fix ruby/file.i ... rubyio.h filename change in
ruby 1.9.
2008-11-23: wsfulton
Apply patch #2319790 from Johan Hake to fix shared_ptr usage in std::tr1 namespace.
2008-11-21: wsfulton
The use of the include path to find the input file is now deprecated.
This makes the behaviour of SWIG the same as C/C++ compilers in preparation
for use with ccache.
2008-11-16: wsfulton
Fix -nopreprocess option to:
- correctly report file names in warning and error messages.
- use the original input filename that created the preprocessed output when
determining the C++ wrapper file name (in the absence of -o). Previously
the name of the input file containing the preprocessed output was used.
2008-11-11: wsfulton
[Java] Add patch #2152691 from MATSUURA Takanori which fixes compiles using the
Intel compiler
2008-11-01: wsfulton
Add patch #2128249 from Anatoly Techtonik which corrects the C/C++ proxy
class being reported for Python docstrings when %rename is used.
2008-11-01: wsfulton
Add the strip encoder patch from Anatoly Techtonik #2130016. This enables an
easy way to rename symbols by stripping a commonly used prefix in all the
function/struct names. It works in the same way as the other encoders, such as
title, lower, command etc outlined in CHANGES file dated 12/30/2005. Example
below will rename wxAnotherWidget to AnotherWidget and wxDoSomething to
DoSomething:
%rename("%(strip:[wx])s") "";
struct wxAnotherWidget {
void wxDoSomething();
};
2008-09-26: mutandiz
[allegrocl]
Lots of test-suite work.
- Fix ordering of wrapper output and %{ %} header output.
- Fix declarations of local vars in C wrappers.
- Fix declaration of defined constants in C wrappers.
- Fix declaration of EnumValues in C wrappers.
- add some const typemaps to allegrocl.swg
- add rename for operator bool() overloads.
2008-09-25: olly
[PHP5] Fill in typemaps for SWIGTYPE and void * (SF#2095186).
2008-09-22: mutandiz (Mikel Bancroft)
[allegrocl]
- Support wrapping of types whose definitions are not seen by
SWIG. They are treated as forward-referenced classes and if a
definition is not seen are treated as (* :void).
- Don't wrap the contents of unnamed namespaces.
- More code cleanup. Removed some extraneous warnings.
- start work on having the allegrocl mod pass the cpp test-suite.
2008-09-19: olly
[PHP5] Add typemaps for long long and unsigned long long.
2008-09-18: wsfulton
[C#] Added C# array typemaps provided by Antti Karanta.
The arrays provide a way to use MarshalAs(UnmanagedType.LPArray)
and pinning the array using 'fixed'. See arrays_csharp.i library file
for details.
2008-09-18: wsfulton
Document the optional module attribute in the %import directive,
see Modules.html. Add a warning for Python wrappers when the
module name for an imported base class is missing, requiring the
module attribute to be added to %import, eg
%import(module="FooModule") foo.h
2008-09-18: olly
[PHP5] Change the default input typemap for char * to turn PHP
Null into C NULL (previously it was converted to an empty string).
The new behaviour is consistent with how the corresponding output
typemap works (SF#2025719).
If you want to keep the old behaviour, add the following typemap
to your interface file (PHP's convert_to_string_ex() function does
the converting from PHP Null to an empty string):
%typemap(in) char * {
convert_to_string_ex($input);
$1 = Z_STRVAL_PP($input);
}
2008-09-18: olly
[PHP5] Fix extra code added to proxy class constructors in the case
where the only constructor takes no arguments.
2008-09-18: olly
[PHP5] Fix wrapping of a renamed enumerated value of an enum class
member (SF#2095273).
2008-09-17: mutandiz (Mikel Bancroft)
[allegrocl]
- Fix how forward reference typedefs are handled, so as not to conflict
with other legit typedefs.
- Don't (for now) perform an ffitype typemap lookup when trying to
when calling compose_foreign_type(). This is actually a useful thing
to do in certain cases, the test cases for which I can't currently
locate :/. It's breaking some wrapping behavior that is more commonly
seen, however. I'll readd in a more appropriate way when I can
recreate the needed test case, or a user complains (which means
they probably have a test case).
- document the -isolate command-line arg in the 'swig -help' output.
It was in the html docs, but not there.
- small amount of code cleanup, removed some unused code.
- some minor aesthetic changes.
2008-09-12: bhy
[Python] Python 3.0 support branch merged into SWIG trunk. Thanks to
Google Summer of Code 2008 for supporting this project! By default
SWIG will generate interface files compatible with both Python 2.x
and 3.0. And there's also some Python 3 new features that can be
enabled by passing a "-py3" command line option to SWIG. These
features are:
- Function annotation support
Also, the parameter list of proxy function will be generated,
even without the "-py3" option. However, the parameter list
will fallback to *args if the function (or method) is overloaded.
- Buffer interface support
- Abstract base class support
For details of Python 3 support and these features, please see the
"Python 3 Support" section in the "SWIG and Python" chapter of the SWIG
documentation.
The "-apply" command line option and support of generating codes
using apply() is removed. Since this is only required by very old
Python.
This merge also patched SWIG's parser to solve a bug. By this patch,
SWIG features able to be correctly applied on C++ conversion operator,
such like this:
%feature("shadow") *::operator bool %{ ... %}
2008-09-02: richardb
[Python] Commit patch #2089149: Director exception handling mangles
returned exception. Exceptions raised by Python code in directors
are now passed through to the caller without change. Also, remove
the ": " prefix which used to be added to other director exceptions
(eg, those due to incorrect return types).
2008-09-02: wsfulton
[Python] Commit patch #1988296 GCItem multiple module linking issue when using
directors.
2008-09-02: wsfulton
[C#] Support for 'using' and 'fixed' blocks in the 'csin' typemap is now
possible through the use of the pre attribute and the new terminator attribute, eg
%typemap(csin,
pre=" using (CDate temp$csinput = new CDate($csinput)) {",
terminator=" } // terminate temp$csinput using block",
) const CDate &
"$csclassname.getCPtr(temp$csinput)"
See CSharp.html for more info.
2008-09-01: wsfulton
[CFFI] Commit patch #2079381 submitted by Boris Smilga - constant exprs put into
no-eval context in DEFCENUM
2008-08-02: wuzzeb
[Chicken,Allegro] Commit Patch 2019314
Fixes a build error in chicken, and several build errors and other errors
in Allegro CL
2008-07-19: wsfulton
Fix building of Tcl examples/test-suite on Mac OS X reported by Gideon Simpson.
2008-07-17: wsfulton
Fix SF #2019156 Configuring with --without-octave or --without-alllang
did not disable octave.
2008-07-14: wsfulton
[Java, C#] Fix director typemaps for pointers so that NULL pointers are correctly
marshalled to C#/Java null in director methods.
2008-07-04: olly
[PHP] For std_vector.i and std_map.i, rename empty() to is_empty()
since "empty" is a PHP reserved word. Based on patch from Mark Klein
in SF#1943417.
2008-07-04: olly
[PHP] The deprecated command line option "-make" has been removed.
Searches on Google codesearch suggest that nobody is using it now
anyway.
2008-07-04: olly
[PHP] The SWIG cdata.i library module is now supported.
2008-07-03: olly
[PHP] The deprecated command line option "-phpfull" has been
removed. We recommend building your extension as a dynamically
loadable module.
2008-07-02: olly
[PHP4] Support for PHP4 has been removed. The PHP developers are
no longer making new PHP4 releases, and won't even be providing
patches for critical security issues after 2008-08-08.
2008-07-02: olly
[Python] Import the C extension differently for Python 2.6 and
later so that an implicit relative import doesn't produce a
deprecation warning for 2.6 and a failure for 2.7 and later.
Patch from Richard Boulton in SF#2008229, plus follow-up patches
from Richard and Haoyu Bai.
Version 1.3.36 (24 June 2008)
=============================
06/24/2008: wsfulton
Remove deprecated -c commandline option (runtime library generation).
06/24/2008: olly
[PHP] Fix assertion failure when handling %typemap(in,numinputs=0)
(testcase ignore_parameter).
06/24/2008: olly
[PHP] Fix segfault when wrapping a non-class function marked with
%newobject (testcase char_strings).
06/22/2008: wsfulton
[Java] Add a way to use AttachCurrentThreadAsDaemon instead of AttachCurrentThread
in director code. Define the SWIG_JAVA_ATTACH_CURRENT_THREAD_AS_DAEMON macro, see
Lib/java/director.swg.
06/21/2008: wsfulton
[Ruby] Fix crashing in the STL wrappers (reject! and delete_if methods)
06/19/2008: wsfulton
[Java, C#] C# and Java keywords will be renamed instead of just issuing a warning
and then generating uncompilable code. Warning 314 gives the new name when a
keyword is found.
06/19/2008: wsfulton
[R] Keyword handling added. R Keywords will be renamed as necessary.
Warning 314 gives the new name when a keyword is found.
06/17/2008: mgossage
[Lua] Added missing support for bool& and bool*. Added runtest for li_typemaps testcase.
(Bug #1938142)
06/07/2008: bhy
Added test case keyword_rename, then made the keyword renaming works properly
by fixing Swig_name_make() for a incomplete condition checking.
06/02/2008: wsfulton
[Java, C#] Fix enum wrappers when using -noproxy.
05/30/2008: bhy
Added std::wstring into Lib/typemaps/primtypes.swg, since it is also a primitive
type in SWIG - fixed SF #1976978.
05/29/2008: wsfulton
[Java, C#] Fix variable wrappers when using -noproxy.
05/29/2008: bhy
[Python] Fixed a typo of %#ifdef in Lib/python/pycontainer.swg, which is related
to -extranative SWIG option - SF #1971977.
05/20/2008: wsfulton
New partialcheck makefile targets for partial testing of the test-suite. These
just invoke SWIG, ie no compilation and no runtime testing. It can be faster
when developing by just doing a directory diff of the files SWIG generates
against those from a previous run. Example usage from the top level directory:
make partialcheck-test-suite
make partialcheck-java-test-suite
This change also encompasses more flexibility in running the test-suite, eg
it is possible to prefix the command line which runs any target language test
with a tool. See the RUNTOOL, COMPILETOOL and SWIGTOOL targets in the common.mk
file and makefiles in the test-suite directory. For example it is possible to
run the runtime tests through valgrind using:
make check RUNTOOL="valgrind --leak-check=full"
or invoke SWIG under valgrind using:
make check SWIGTOOL="valgrind --tool=memcheck"
05/19/2008: drjoe
[R] Fixed define that was breaking pre-2.7. Checked in
patch from Soren Sonnenburg that creates strings in
version independent way
05/15/2008: wsfulton
[Java] Fix variable name clash in directors - SF #1963316 reported by Tristan.
05/14/2008: wsfulton
Add an optimisation for functions that return objects by value, reducing
the number of copies of the object that are made. Implemented using an
optional attribute in the "out" typemap called "optimal". Details in
Typemaps.html.
05/11/2008: olly
[PHP] Check for %feature("notabstract") when generating PHP5 class
wrapper.
05/11/2008: wsfulton
Fix SF #1943608 - $self substitution in %contract, patch submitted by
Toon Verstraelen.
05/09/2008: olly
[PHP] Fix char * typemaps to work when applied to signed char * and
unsigned char * (uncovered by testcase apply_strings).
05/09/2008: wsfulton
Fix wrapping of char * member variables when using allprotected mode.
Bug reported by Warren Wang.
05/09/2008: olly
[PHP] Fix bad PHP code generated when wrapping an enum in a
namespace (uncovered by testcase arrays_scope).
05/09/2008: olly
[PHP] SWIG now runs the PHP testsuite using PHP5, not PHP4. PHP4
is essentially obsolete now, so we care much more about solid PHP5
support.
05/07/2008: wsfulton
STL fixes when using %import rather than %include and the Solaris Workshop
compiler and the Roguewave STL.
05/07/2008: wsfulton
Fix wrapping of overloaded protected methods when using allprotected mode.
Bug reported by Warren Wang.
05/03/2008: wsfulton
Commit patch #1956607 to add -MT support from Richard Boulton.
This patch mirrors the gcc -MT option which allows one to change the default
Makefile target being generated when generating makefiles with the -M family
of options. For example:
$ swig -java -MM -MT overriddenname -c++ example.i
overriddenname: \
example.i \
example.h
04/30/2008: mgossage
[Lua] Removed generation of _wrap_delete_XXXXX (wrappered destructor)
which was unused and causing warning with g++ -Wall.
Removed other unused warning in typemaps.i and other places.
Added Examples/lua/embed3, and run tests a few test cases.
04/24/2008: olly
[Python] Fix generated code for IBM's C++ compiler on AIX (patch
from Goeran Uddeborg in SF#1928048).
04/24/2008: olly
Rename BSIZE in Examples/test-suite/arrays_scope.i to BBSIZE to
avoid a clash with BSIZE defined by headers on AIX with Perl
(reported in SF#1928048).
04/20/2008: wsfulton
Add the ability to wrap all protected members when using directors.
Previously only the virtual methods were available to the target language.
Now all protected members, (static and non-static variables, non-virtual methods
and static methods) are wrapped when using the allprotected mode. The allprotected
mode is turned on in the module declaration:
%module(directors="1", allprotected="1") modulename
Version 1.3.35 (7 April 2008)
=============================
04/07/2008: wsfulton
[Lua] Add missing pointer reference typemaps
04/06/2008: wsfulton
Fix stack overflow when using typemap warning suppression, eg
%warnfilter(SWIGWARN_TYPEMAP_CHARLEAK_MSG)
04/05/2008: wsfulton
[Python] Fix shared_ptr typemaps so that %pythonnondynamic can be used. Also corrects
display of the proxy class type. Reported by Robert Lupton.
04/04/2008: olly
[Python] Add %newobject reference to python memory management subsection of manual
(patch from mdbeachy in SF#1894610).
03/27/2008: wsfulton
[Python] Fix shared_ptr typemaps where the pointer type is a templated type with
with more than one parameter. Reported by Robert Lupton.
03/27/2008: mgossage
[Lua] Added a typemap DISOWN for SWIGTYPE* and SWIGTYPE[], and support for %delobject feature.
Added Examples/lua/owner which demonstrates the use of the memory management.
03/26/2008: wsfulton
[Java] Apply patch #1844301 from Monty Taylor to suppress enum constructor
unused warnings.
03/26/2008: wsfulton
[Python] Apply patch #1924524 from Casey Raymondson which ensures the
"No constructor defined" message is displayed when attempting to call a
constructor on a class that doesn't have a constructor wrapper, eg if
the C++ class is abstract.
03/26/2008: wsfulton
[Python] Apply patch #1925702 from Casey Raymondson which removes warning 512
for std::vector wrappers.
03/26/2008: olly
[Python] Apply GCC 4.3 warnings patch from Philipp Thomas
(SF#1925122).
03/21/2008: wsfulton
[Python] Thread safety patch for STL iterators from Abhinandan Jain.
03/17/2008: mgossage
[Lua] Added %luacode feature to add source code into wrappers.
Updated documentation to document this.
Added Examples/lua/arrays to show its use (and typemaps)
03/17/2008: olly
Fix nonportable sed usage which failed on Mac OS X (and probably
other platforms). Fixes SF#1903612.
03/17/2008: olly
Fix memory leak in SWIG's parser (based on patch from Russell
Bryant in SF#1914023).
03/12/2008: wsfulton
Fix bug #1878285 - unnecessary cast for C struct creation wrappers.
03/12/2008: wsfulton
[Python] Remove debugging info when using shared_ptr support
03/06/2008: mgossage
[Lua] Updated documentation for Lua exceptions.
Added Examples/lua/exception and Examples/lua/embed2.
Small updates to the typemaps.
03/04/2008: wsfulton
[Java, C#] Add char *& typemaps.
03/04/2008: wsfulton
Fix occasional seg fault when attempting to report overloaded methods as being ignored.
02/29/2008: wsfulton
[Perl] Fix #1904537 Swig causes a Perl warning "x used only once" in Perl 5.10
reported by Ari Jolma
02/29/2008: wsfulton
[Python] Add shared_ptr varin/varout typemaps for wrapping global variables.
02/25/2008: wsfulton
Fix $wrapname to work in %exception (fixes some wrap:name assertions)
Version 1.3.34 (27 February 2008)
=================================
02/13/2008: wsfulton
[R] Fix wrapping of global function pointer variables.
02/13/2008: wsfulton
Add new special variables for use within %exception:
$wrapname - language specific wrapper name
$overname - if a method is overloaded this contains the extra mangling used on
the overloaded method
$decl - the fully qualified C/C++ declaration of the method being wrapped
without the return type
$fulldecl - the fully qualified C/C++ declaration of the method being wrapped
including the return type
02/12/2008: drjoe
[R] Now setting S4 flag in SWIG created objects. This
fixes R-SWIG for 2.6 and warning for 2.6 failure has been removed.
02/11/2008: mgossage
[Lua] Added a patch by Torsten Landschoff to fix the unary minus issue
Ran 'astyle --style=kr -2' across lua.cxx to neaten it up
02/10/2008: wsfulton
Bump SWIG_RUNTIME_VERSION to 4. This is because of the recently introduced API
change in the conversion functions, ie change in definition of swig_converter_func.
Anyone calling SWIG_TypeCast must pass in a valid value for the new additional
(third) parameter and then handle the newly created memory if the returned value
is set to SWIG_CAST_NEW_MEMORY else a memory leak will ensue.
02/09/2008: wsfulton
[Python] Experimental shared_ptr typemaps added. Usage is the same as the recently
added Java and C# shared_ptr typemaps. Two macros are available, although these
may well change in a future version:
For base classes or classes not in an inheritance chain:
SWIG_SHARED_PTR(PROXYCLASS, TYPE)
For derived classes:
SWIG_SHARED_PTR_DERIVED(PROXYCLASS, BASECLASSTYPE, TYPE)
The PROXYCLASS is the name of the proxy class, but is only required for Java/C#.
Example usage:
%include "boost_shared_ptr.i"
SWIG_SHARED_PTR(Klass, Space::Klass)
SWIG_SHARED_PTR_DERIVED(KlassDerived, Space::Klass, Space::KlassDerived)
namespace Space {
struct Klass { ... };
struct KlassDerived : Klass { ... };
}
Further details to follow in future documentation, but the following features
should be noted:
- Not restricted to boost::shared_ptr, eg std::tr1::shared_ptr can also be used.
- Available typemap groups:
(a) Typemaps for shared_ptr passed by value, reference, pointer and pointer
reference.
- (b) Typemaps for passing by raw value, raw pointer, raw reference, raw pointer
reference.
- The code being wrapped does not even have to use shared_ptr, SWIG can use
shared_ptr as the underlying storage mechanism instead of a raw pointer due to
the typemaps in group (b) above.
- No array support as shared_ptr does not support arrays.
- This works quite differently to the usual SWIG smart pointer support when
operator-> is parsed by SWIG:
- An additional smart pointer class is not generated reducing code bloat in
the wrappers.
- Using smart pointers and raw pointers can be mixed seamlessly.
- Missing constructors for the smart pointers is no longer a problem and so
separate factory type functions do not have to be written and wrapped.
- The implicit C++ shared_ptr< derived class > to shared_ptr< base class >
cast also works in the target language. This negates the necessity to write
an explicit helper cast function providing the upcast which would need
calling prior to passing a derived class to a method taking a shared_ptr to
a base class.
02/09/2008: wsfulton
[Python] Add support for overriding the class registration function via a new
"smartptr" feature. This is a very low level of customisation most users
would never need to know. The feature will typically be used for intrusive
smart pointers along with additional typemaps. Example usage of the feature:
%feature("smartptr", noblock=1) Foo { boost::shared_ptr< Foo > }
class Foo {};
The generated Foo_swigregister function will then register boost::shared < Foo >
(SWIGTYPE_p_boost__shared_ptrTFoo_t instead of SWIGTYPE_p_Foo) as the underlying
type for instantiations of Foo.
02/09/2008: wsfulton
Features now supports the optional 'noblock' attribute for all usage of %feature.
When specified, the { } braces are removed from the feature code. This is identical
in behaviour to usage of 'noblock' in typemaps and is used when the preprocessor
is required to operate on the code in the feature and the enclosing { } braces
are not required. Example:
#define FOO foo
%feature("smartptr", noblock="1") { FOO::bar }
The preprocessor then reduces this as if this had been used instead:
%feature("smartptr") "foo::bar"
02/01/2008: olly
[Python] Fix format string bug (SF#1882220).
01/31/2008: wsfulton
Additions to the %types directive. Now the conversion / casting code can be
overridden to some custom code in the %types directive, like so:
%types(fromtype = totype) %{
... code to convert fromtype to totype and return ...
%}
The special variable $from will be replaced by the name of the parameter of the
type being converted from. The code must return the totype cast to void *. Example:
class Time;
class Date;
Date &Time::dateFromTime();
%types(Time = Date) %{
Time *t = (Time *)$from;
Date &d = t->dateFromTime();
return (void *) &d;
%}
resulting in the conversion / casting code looking something like:
static void *_p_TimeTo_p_Date(void *x) {
Time *t = (Time *)x;
Date &d = t->dateFromTime();
return (void *) &d;
}
This is advanced usage, please use only if you understand the runtime type system.
01/30/2008: mgossage
Small update to documentation in Typemaps.html, to warn about use of local
variables in typemaps for multiple types.
01/25/2008: wsfulton
[Java] Fix bug reported by Kevin Mills in ARRAYSOFCLASSES typemaps where any
changes made to an array element passed from Java to C are not reflected back
into Java.
01/24/2008: mgossage
More updates to the configure script for detecting lua.
Also looks in /usr/include/lua*
Also changed typemaps.i not to check for NULL before freeing a pointer
01/21/2008: wsfulton
[Python] For STL containers, SWIG no longer attempts to convert from one
STL container to another, eg from std::vector<int> to std::vector<double>
or std::list<int> to std::vector<int> or even std::vector<Foo> to
std::vector<Bar> as it previously did. In fact SWIG no longer attempts to
convert any SWIG wrapped C++ proxy class that is also a Python sequence,
whereas previously it would. Any non-SWIG Python sequence will still be
accepted wherever an STL container is accepted. Overloaded methods using
containers should be faster.
01/18/2008: wsfulton
[C#] Add 'directorinattributes' and 'directoroutattributes' typemap attributes
for the imtype typemap. These should contain C# attributes which will
be generated into the C# director delegate methods.
01/18/2008: olly
Fix handling of byte value 255 in input files on platforms where
char is signed (it was getting mapped to EOF). Fixes SF#1518219.
01/16/2008: wsfulton
Fix template member variables wrapped by a smart pointer. Bug reported
by Robert Lupton.
01/14/2008: mgossage
Substantial changes to configure script for detecting lua.
Code can now link to liblua.a, liblua50.a or liblua51.a
It's also a lot neater now.
12/16/2007: wsfulton
[Perl] Backed out #1798728 - numbers can be passed to functions taking char *
12/16/2007: wsfulton
Fix #1832613 - Templates and some typedefs involving pointers or function pointers
12/12/2007: wsfulton
[Java] Fix #1632625 - Compilation errors on Visual C++ 6 when using directors.
12/12/2007: wsfulton
[Perl] Fix #1798728 - numbers can be passed to functions taking char *.
12/12/2007: wsfulton
Fix #1819847 %template with just one default template parameter
template<typename T = int> class Foo {...};
%template(FooDefault) Foo<>;
12/12/2007: mgossage
[Lua] Small correction on Lua.html
12/09/2007: wsfulton
Apply patch #1838248 from Monty Taylor for vpath builds of SWIG.
12/08/2007: wsfulton
[Lua] Fixes to remove gcc-4.2 warnings
12/06/2007: wsfulton
Fix #1734415 - template template parameters with default arguments such as:
template<typename t_item, template<typename> class t_alloc = pfc::alloc_fast >
class list_t : public list_impl_t<t_item,pfc::array_t<t_item,t_alloc> > { ... };
12/04/2007: mgossage
[lua] Fix a bug in the class hierachy code, where the methods were not propagated,
if the name ordering was in a certain order.
Added new example programs (dual, embed) and runtime tests for test-suite.
11/30/2007: wsfulton
Fix using statements using a base class method where the methods were overloaded.
Depending on the order of the using statements and method declarations, these
were previously generating uncompilable wrappers, eg:
struct Derived : Base {
virtual void funk();
using Base::funk;
};
Version 1.3.33 (November 23, 2007)
==================================
11/21/2007: mikel
[allegrocl] omit private slot type info in the classes/types
defined on the lisp side. Fix bug in mapping of C/++ types
to lisp types. Fix typo in modules generated defpackage form.
Have std::string *'s automatically marshalled between foreign
and lisp strings.
11/20/2007: olly
[Python] Fill in Python Dictionary functions list (patch from
Jelmer Vernooij posted to swig-devel).
11/20/2007: beazley
Fixed a bug in the C scanner related to backslash characters.
11/19/2007: wsfulton
[Perl] Fix broken compilation of C++ wrappers on some compilers.
11/16/2007: olly
[Python] Don't pass Py_ssize_t for a %d printf-like format as
that's undefined behaviour when sizeof(Py_ssize_t) != sizeof(int).
Version 1.3.32 (November 15, 2007)
==================================
11/14/2007: wsfulton
[R] Package name and dll name is now the same as the SWIG module
name. It used to be the module name with _wrap as a suffix. The package
and dll names can be modified using the -package and -dll commandline
options.
*** POTENTIAL INCOMPATIBILITY ***
11/11/2007: wsfulton
[R] Add support for Windows (Visual C++ 8 tested)
11/10/2007: olly
[php] Fix makefile generated by -make (SF#1633679). Update
documentation to mark "-make" as deprecated (none of the other
SWIG backends seem to offer such a feature, it can't realistically
generate a fully portable makefile, and the commands to build an
extension are easy enough to write for the user's preferred build
tool). Also recommend against the use of "-phpfull" (it's only
really useful when static linking, and a dynamically loadable
module is virtually always the better approach).
11/09/2007: olly
Fix --help output to note that `export SWIG_FEATURES' is required.
10/29/2007: wsfulton
[R] Fix seg fault on Windows
[R] Examples R scripts are now platform independent
10/30/2007: mgossage
[lua] fixed bug in template classes which cases template_default2
and template_specialization_defarg to fail.
Added several warning filters into the overload's test cases.
Added runtime tests for several codes.
You can now make check-lua-test-suite with no errors and only a few warnings.
10/30/2007: olly
[guile] Fix the configure test to put GUILELINK in LIBS not LDFLAGS
(SF#1822430).
10/30/2007: olly
[guile] Fix the guile examples on 64-bit platforms.
10/29/2007: wsfulton
[C#] Fix member pointers on 64 bit platforms.
10/28/2007: olly
[lua] Fix swig_lua_class instances to be static to allow multiple
SWIG wrappers to be compiled into the same executable statically.
Patch from Andreas Fredriksson (posted to the swig mailing list).
10/28/2007: olly
[lua] Fix Examples/lua to pass SRCS for C tests rather than CXXSRCS.
The code as it was happened to work on x86, but broke on x86_64 (and
probably any other platforms which require -fPIC).
10/28/2007: wsfulton
[Java, C#] New approach for fixing uninitialised variable usage on error in director
methods using the new templated initialisation function SwigValueInit().
10/28/2007: wsfulton
[Perl] Use more efficient SvPV_nolen(x) instead of SvPV(x,PL_na) if SvPV_nolen is
supported.
10/26/2007: wuzzeb
[Chicken] Fix global variables of class member function pointers.
Other minor fixes, so all tests in the chicken test suite now pass
10/25/2007: olly
Fix UTL typecheck macro for a function taking char[] or const
char[] (SF#1820132).
10/22/2007: mkoeppe
[Guile] Filter out -ansi -pedantic from CFLAGS while compiling test programs for Guile
in configure. This enables running the test suite for Guile if it is installed and
usable.
10/22/2007: mkoeppe
[Guile -scm] Fix testcases apply_signed_char and apply_strings
by adding explicit casts to the appropriate $ltype.
10/22/2007: wsfulton
[Java, C#] Fix uninitialised variable usage on error in director methods.
10/19/2007: wsfulton
[Java, C#] Bug #1794247 - fix generated code for derived classes when csbase or javabase
typemaps are used with the replace="1" attribute.
10/19/2007: wsfulton
[Python] Docs updated to suggest using distutils. Patch #1796681 from Christopher Barker.
10/19/2007: olly
[perl5] Clear errno before calls to strtol(), strtoul(), strtoll()
and strtoull() which we check errno after to avoid seeing a junk
value of errno if there isn't an error in the call.
10/16/2007: wsfulton
Deprecate %attribute_ref and replace with %attributeref. There is just an argument
order change in order to maintain consistency with %attribute, from:
%attribute_ref(Class, AttributeType, AccessorMethod, AttributeName)
to
%attributeref(Class, AttributeType, AttributeName, AccessorMethod)
10/16/2007: olly
[Tcl] Fix several occurrences of "warning: deprecated conversion
from string constant to 'char*'" from GCC 4.2 in generated C/C++
code.
10/16/2007: olly
[PHP] Fix many occurrences of "warning: deprecated conversion from
string constant to 'char*'" from GCC 4.2 in generated C/C++ code
when compiling with a new enough version of PHP 5 (tested with
PHP 5.2.3, but PHP 5.2.1 is probably the minimum requirement).
10/15/2007: wsfulton
Patch #1797133 from David Piepgrass fixes %attribute when the getter has the same name
as the attribute name and no longer generate non-functional setter for read-only attributes.
10/15/2007: olly
[Tcl] Prevent SWIG_Tcl_ConvertPtr from calling the unknown proc.
Add Examples/tcl/std_vector/ which this change fixes. Patch
is from "Cliff C" in SF#1809819.
10/12/2007: wsfulton
[Java] Add DetachCurrentThread back in for directors. See entry dated 08/11/2006 and
search for DetachCurrentThread on the mailing lists for details. The crashes on Solaris
seem to be only present in jdk-1.4.2 and lower (jdk-1.5.0 and jdk-1.6.0 are okay), so
anyone using directors should use a recent jdk on Solaris, or define (see director.swg)
SWIG_JAVA_NO_DETACH_CURRENT_THREAD to the C++ compiler to get old behaviour.
10/12/2007: wsfulton
[Java] Ensure the premature garbage collection prevention parameter (pgcpp) is generated
when there are C comments in the jtype and jstype typemaps.
10/12/2007: wuzzeb
Added a testsuite entry for Bug #1735931
10/09/2007: olly
Automatically rerun autogen.sh if configure.in is modified.
10/09/2007: olly
Enhance check-%-test-suite rule and friends to give a more helpful
error message if you try them for a language which doesn't exist
(e.g. "make check-php-test-suite" rather than the correct
"make check-php4-test-suite").
10/09/2007: olly
Add make rule to regenerate Makefile from Makefile.in if it has
changed.
10/09/2007: olly
[php] Fix long-standing memory leak in wrapped constructors and
wrapped functions/methods which return an object.
10/08/2007: olly
Fix Makefile.in to read check.list files correctly in a VPATH
build.
10/07/2007: wsfulton
[C#, Java] Experimental shared_ptr typemaps added
09/27/2007: mgossage
[lua] added more verbose error messages for incorrect typechecks.
Added a routine which checks the exact number of parameters passed to a function
(breaks operator_overloading for unary minus operator, currently disabled).
Reorganised the luatypemaps.swg to tidy it up.
Added a lot of %ignores on the operators not supported by lua.
Added support for constant member function pointers & runtest for member_pointer.i
Added first version of wchar.i
09/25/2007: wsfulton
[C#, Java] throws typemaps for std::wstring using C# patch #1799064 from David Piepgrass
09/24/2007: wsfulton
[Tcl] Apply #1771313 to fix bug #1650229 - fixes long long and unsigned long long
handling.
09/20/2007: olly
[Java] Eliminate some unnecessary uses of a temporary buffer
allocated using new[]. SF#1796609.
09/19/2007: wsfulton
[C#] The $csinput special variable can be used in the csvarin typemap where it is always
expanded to 'value'.
09/19/2007: wsfulton
[C#] Fix bug reported by Glenn A Watson and #1795260 where the cstype typemap used the 'ref'
keyword in the typemap body, it produced uncompilable C# properties (variable wrappers).
The type for the property now correctly comes from the 'out' attribute in the cstype typemap.
09/19/2007: wsfulton
[Java] Fix const std::wstring& typemaps
09/19/2007: wsfulton
[Java] Ensure the premature garbage collection prevention parameter (pgcpp) is generated
where a parameter is passed by pointer reference, eg in the std::vector wrappers. The pgcpp
is also generated now when user's custom typemaps use a proxy class in the jstype typemap
and a 'long' in the jtype typemap.
09/18/2007: olly
[php] Add typemaps for handling parameters of type std::string &
which are modified by the wrapped function.
09/17/2007: olly
[python] Split potentially long string literals to avoid hitting
MSVC's low fixed limit on string literal length - patch from
SF#1723770, also reported as SF#1630855.
09/17/2007: olly
[ocaml] Fix renaming of overloaded methods in the method_table -
my patch from SF#940399.
09/17/2007: olly
[python] Simpler code for SWIG_AsVal_bool() which fixes a "strict
aliasing" warning from GCC - patch from SF#1724581 by Andrew
Baumann.
09/17/2007: olly
[perl5] Use sv_setpvn() to set a scalar from a pointer and length
- patch from SF#174460 by "matsubaray".
09/17/2007: olly
When wrapping C++ code, generate code which uses
std::string::assign(PTR, LEN) rather than assigning
std::string(PTR, LEN). Using assign generates more efficient code
(tested with GCC 4.1.2).
09/07/2007: wsfulton
Fix %ignore on constructors which are not explicitly declared [SF #1777712]
09/05/2007: wuzzeb (John Lenz)
- Change r_ltype in typesys.c to store a hashtable instead of a single value.
several very subtle bugs were being caused by multiple ltypes being mapped
to a single mangled type, mostly when using typedefed template parameters.
Now, r_ltype stores a hashtable of possible ltypes, and when generating the
type table, all the ltypes are added into the swig_type_info structure.
08/31/2007: wsfulton
SF #1754967 from James Bigler.
- Fix bug in turning on warnings that were turned off by default. Eg 'swig -w+309' will now
turn on the normally suppressed warning 309.
- New -Wextra commandline option which enables the extra warning numbers:
202,309,403,512,321,322 (this is the list of warnings that have always been suppressed by
default). By specifying -Wextra, all warnings will be turned on, but unlike -Wall,
warnings can still be selectively turned on/off using %warnfilter,
#pragma SWIG nowarn or further -w commandline options, eg:
swig -Wextra -w309
will turn on all warnings except 309.
08/28/2007: wsfulton
- New debugging options, -debug-module <n> and -debug-top <n> to display the parse tree at
various stages, where <n> is a comma separated list of stages 1-4.For example, to
display top of parse tree at stages 1 and 3:
swig -debug-top 1,3
- Deprecate the following options which have equivalents below:
-dump_parse_module => -debug-module 1
-dump_module => -debug-module 4
-dump_parse_top => -debug-top 1
-dump_top => -debug-top 4
- Renamed some commandline options for naming consistency across all options:
-debug_template => -debug-template
-debug_typemap => -debug-typemap
-dump_classes => -debug-classes
-dump_tags => -debug-tags
-dump_typedef => -debug-typedef
-dump_memory => -debug-memory
08/25/2007: olly
[PHP5] Fix handling of double or float parameters with an integer
default value.
08/25/2007: olly
[PHP5] Generate __isset() methods for setters for PHP 5.1 and later.
08/20/2007: wsfulton
[Java C#] Fix director bug #1776651 reported by Stephane Routelous which occurred when
the director class name is the same as the start of some other symbols used within
the director class.
08/17/2007: wsfulton
Correct behaviour for templated methods used with %rename or %ignore and the empty
template declaration - %template(). A warning is issued if the method has not been
renamed.
08/16/2007: mutandiz (Mikel Bancroft)
[allegrocl] Name generated cl file based on input file rather than by
module name. It was possible to end up with a mypackage.cl and a test_wrap.c
when parsing a test.i input file. Confusing. Also, include external-format
templates for :fat and :fat-le automatically to avoid these being compiled
at runtime.
08/15/2007: efuzzyone
[cffi] Apply patch #1766076 from Leigh Smith adding support for newly introduced
in cffi :long-long and :unsigned-long-long.
08/10/2007: wsfulton
[Java] Add documentation patch #1743573 from Jeffrey Sorensen. It contains a neat
idea with respect to better memory management by the JVM of C++ allocated memory.
08/10/2007: wsfulton
[Perl] Apply patch #1771410 from Wade Brainerd to fix typedef XS(SwigPerlWrapper) in
perlrun.swg for ActiveState Perl build 822 and Perl 5.8.9 and 5.10 branches.
08/10/2007: wsfulton
[Lua] const enum reference typemaps fixed.
08/09/2007: wsfulton
[C#] Added missing support for C++ class member pointers.
08/09/2007: wsfulton
[C#, Java] Add support for $owner in the "out" typemaps like in the scripting
language modules. Note that $owner has always been supported in the "javaout" / "csout"
typemaps.
08/01/2007: wsfulton
Fix smart pointer handling for classes that have templated methods within the smart
pointer type. Problem reported by craigdo at ee.washington.edu.
07/31/2007: efuzzyone
[cffi] fixed memory access after being freed bug. thanks to Martin Percossi.
package name clos changed to cl. thanks to Ralf Mattes
07/24/2007: wsfulton
Parallel make support added for the examples and test-suite for developers who have
more than one CPU. Now parallel make can be used for checking in addition to building
the SWIG executable. Some typical checking examples:
make -j8 -k check
make -j4 check-java-test-suite
make -j2 check-java-examples
07/19/2007: mgossage
Fixed bug that stopped configure working on mingw (applied dos2unix to configure.in)
07/10/2007: mgossage
[lua] Extra compatibility with Lua 5.1 (updated SWIG_init, docs, examples, test suite)
Removed name clash for static link of multiple modules
07/05/2007: mgossage
[lua] Fix a bug in SWIG_ALLOC_ARRAY()
improved the error messages for incorrect arguments.
Changed the output of swig_type() to use the human readable form of the type,
rather than the raw swig type.
07/03/2007: wsfulton
[C#] Fix directors for some overloaded methods where the imtype resulted in identical
methods being generated in the C# director class, eg void foo(int *) and void foo(double *)
used to generated two of these:
private void SwigDirectorfoo(IntPtr p) { ... }
06/25/2007: wsfulton
[Java, C#] Some parameter name changes in std_vector.i allowing better targeting
of typemaps for method parameters (for memory management of containers of pointers).
06/07/2007: mutandiz (Mikel Bancroft)
[allegrocl]
fix foreign-type constructor to properly look for ffitype typemap
bindings. fix inout_typemaps.i for strings.
06/06/2007: olly
[Ruby]
Use whichever of "long" or "long long" is the same size as "void*"
to hold pointers as integers, rather than whichever matches off_t.
Fixes compilation on OS X and GCC warnings on platforms where
sizeof(void*) < sizeof(off_t) (SF patch #1731979).
06/06/2007: olly
[PHP5]
Fix handling of a particular case involving overloaded functions
with default parameters.
06/05/2007: mutandiz (Mikel Bancroft)
[allegrocl]
Fix case where we'd pass fully qualified identifiers
(i.e. NS1::NS2::FOO) to swig-insert-id. All namespaces
should be stripped.
Fix bug in TypedefHandler introduced by last fix.
06/05/2007: olly
Fix reporting of filenames in errors after %include (patch from
Leigh Smith in #1731040; also reported as #1699940).
05/31/2007: olly
[Python]
Fix "missing initialiser" warning when compiling generated C/C++
wrapper code with Python 2.5 with warnings enabled (patch from
bug#1727668 from Luke Moore).
05/29/2007: olly
[Python]
Split docstrings into separate string literals at each newline when
generating C/C++ wrapper code (the C/C++ compiler will just combine
them back into a single string literal). This avoids MSVC
complaining that the strings are too long (problem reported by
Bo Peng on the mailing list).
05/28/2007: olly
[Python]
Escape backslashes in docstrings.
05/26/2007: olly
[Python]
Fix autodoc generation of enums to be more consistent with how the
enums are wrapped - patch #1697226 from Josh Cherry.
05/26/2007: olly
[PHP5]
Fix wrapping of methods and functions which return a pointer to a
class (bug#1700788) and those which have overloaded forms returning
both classes and non-classes (bug#1712717, thanks to Simon
Berthiaume for the patch).
05/25/2007: wsfulton
Fixed %rename inconsistency in conversion operators as reported by Zhong Ren. The matching
is now done on the operator name in the same way as it is done for parameters. For example:
%rename(opABC) Space::ABC::operator ABC() const;
%rename(methodABC) Space::ABC::method(ABC a) const;
namespace Space {
class ABC {
public:
void method(ABC a) const {}
operator ABC() const { ABC a; return a; }
};
}
Note that qualifying the conversion operator previously may or may not have matched.
Now it definitely won't, so this will not match:
%rename(opABC) Space::ABC::operator Space::ABC() const;
in the same way that this does not match:
%rename(methodABC) Space::ABC::method(Space::ABC a) const;
The documentation has been improved with respect to %rename, namespaces and templates.
Conversion operators documentation too.
*** POTENTIAL INCOMPATIBILITY ***
05/16/2007: mutandiz
[allegrocl]
Fix bad generation of local var ltype's in functionWrapper().
Try to work better with the backward order in which swig
unrolls nested class definitions.
cleaned up a little unnecessary code/debug printf's.
Remove warning when replacing $ldestructor for ff:foreign-pointer
05/12/2007: olly
[Python]
swig -python -threads now generates C/C++ code which uses Python's
own threading abstraction (from pythread.h) rather than OS specific
code. The old code failed to compile on MS Windows. (See SF patch
tracker #1710341).
05/04/2007: gga
[Ruby]
Changed STL renames to be global renames. This fixes
STL functions not being renamed when autorename is on.
This is a not a totally perfect work-around, but better.
Someone really needs to fix the template renaming code.
(See bug #1545634)
05/04/2007 gga
[All]
Changed %rename("%(undercase)s") a little so that single
numbers at the end of a function are not undercased. That is:
getSomething -> get_something
get2D -> get_2d
get234 -> get_234
BUT:
asFloat2 -> as_float2
(Bug #1699714)
05/03/2007: gga
[Ruby]
Made __swigtype__ => @__swigtype__ so it can be accessed
from the scripting language (and follows Ruby's official
documentation, just in case).
Made tracking => @__trackings__ for same reason.
Currently storing ivars without the @ seems valid, but
the PickAxe says this is not correct, so just in case...
05/03/2007: gga
[Ruby]
Applied patch for -minherit bug and exception classes.
This issue should be revisited more closely, as Multiple
Inheritance in Ruby is still problematic.
(patch/bug #1604878)
05/03/2007: gga
[Ruby]
Overloaded functions in ruby will now report to the user
the possible prototypes when the user mistypes the number or
type of a parameter.
05/03/2007: gga
[Ruby]
Forgot to document the bug fixing of an old bug regarding
exceptions.
(bug #1458247)
05/03/2007: gga
[Ruby]
Fixed Ruby documentation to use the proper css styles for
each section. Added autodoc section to Ruby's docs to
document the features supported by Ruby in documenting its modules.
Made rdoc documentation spit out the full name of the class +
method name. Albeit this will make the current rdoc not recognize
the method, this is still needed to disambiguate between different
classes with similar methods (rdoc was created to document the
ruby source which only contains one class per c file, unlike swig)
I have patched rdoc to make it more friendly to swig. This
patch needs to be merged in the ruby std library now.
05/03/2007: gga
[Ruby]
Changed flag -feature to be -init_name to better reflect its
purpose and avoid confusion with -features.
05/03/2007: gga
[Ruby]
Improved autodoc generation.
Added autodoc .swg files to Ruby library for easily adding
documentation to common Ruby methods and STL methods.
Fixed autodoc documenting of getters and setters and module.
Made test suite always generate autodocs.
05/03/2007: gga
[Ruby]
Removed some warnings from STL and test suite.
05/02/2007: mgossage
[Lua] Fixed issues with C++ classes and hierachies across multiple
source files. Fixed imports test case & added run test.
Added Examples/imports.
Added typename for raw lua_State*
Added documentation on native functions.
05/02/2007: gga
[Ruby]
Docstrings are now supported.
%feature("autodoc") and %feature("docstring") are now
properly supported in Ruby. These features will generate
a _wrap.cxx file with rdoc comments in them.
05/02/2007: gga
[Ruby]
STL files have been upgraded to follow the new swig/python
Lib/std conventions.
This means std::vector, std::set, std::map, set::multimap,
std::multiset, std::deque and std::string are now properly
supported, including their iterators, support for containing
ruby objects (swig::GC_VALUE) and several other ruby
enhancements.
std::complex, std::ios, std::iostream, std::iostreambuf and
std::sstream are now also supported.
std::wstring, std::wios, std::wiostream, std::wiostreambuf
and std::wsstream are supported verbatim with no unicode
conversion.
std_vector.i now mimics the behavior of Ruby Arrays much more
closely, supporting slicing, shifting, unshifting,
multiple indexing and proper return values on assignment.
COMPATABILITY NOTE: this changes the older api a little bit in
that improper indexing would previously (incorrectly) raise
exceptions. Now, nil is returned instead, following ruby's
standard Array behavior.
05/02/2007: gga
[Ruby]
Changed the value of SWIG_TYPECHECK_BOOL to be 10000 (ie. higher
than that of all integers).
This is because Ruby allows typecasting
integers down to booleans which can make overloaded functions on
bools and integers to fail.
(bug# 1488142)
05/02/2007: gga
[Ruby]
Fixed a subtle bug in multiple argouts that could get triggered if
the user returned two or more arguments and the first one was an
array.
05/01/2007: gga
[Ruby]
Improved the documentation to document the new features
added, add directorin/out/argout typemaps, etc.
05/01/2007: gga
[Ruby]
Added %initstack and %ignorestack directives for director
functions. These allow you to control whether a director
function should re-init the Ruby stack.
This is sometimes needed for an embedded Ruby where the
director method is used as a C++ callback and not called
by the user from ruby code.
Explanation:
Ruby's GC needs to be aware of the running OS stack in order to
mark any VALUE (Ruby objects) it finds there to avoid collection
of them. This allows the ruby API to be very simple and allows
you to write code like "VALUE a = sth" anywhere without needing
to do things like refcounting like python.
By default, the start of the stack is set when ruby_init() is
called. If ruby is inited within main(), as it usually is the
case with the main ruby executable, ruby will be able to calculate
its stack properly. However, when this is not possible, as when
ruby is embedded as a plugin to an application where main is not
available, ruby_init() will be called in the wrong place, and
ruby will be incorrectly tracking the stack from the function
that called ruby_init() forwards only, which can lead to
all sorts of weird crashes or to ruby thinking it has run out of
stack space incorrectly.
To avoid this, director (callback) functions can now be tagged
to try to reset the ruby stack, which will solve the issues.
NOTE: ruby1.8.6 still contains a bug in it in that its function
to reset the stack will not always do so. This bug is triggered
very rarely, when ruby is called from two very distinct places
in memory, like a branch of main() and another dso. This bug
has now been reported to ruby-core and is pending further
investigation.
(bug #1700535 and patch #1702907)
04/30/2007: wsfulton
Fix #1707582 - Restore building from read-only source directories.
04/30/2007: gga
[Ruby]
Ruby will now report the parameter index properly on type
errors as well as the class and value of the incorrect
argument passed.
(feature request #1699670)
04/30/2007: gga
[Ruby]
Ruby no longer creates the free_Class function if the class
contains its own user defined free function (%freefunc).
(bug #1702882)
04/30/2007: gga
[Ruby]
Made directors raise a ruby exception for incorrect argout
returned values if RUBY_EMBEDDED is set, instead of throwing
an actual SwigDirector exception.
This will prevent crashes when ruby is embedded and unaware
of the SwigDirector exception.
04/30/2007: gga
[Ruby]
Removed the need for -DSWIGEXTERN.
Changed swig_ruby_trackings to be a static variable, but also
be kept within a hidden instance variable in the SWIG module.
This allows properly dealing with trackings across multiple
DSOs, which was previously broken.
(bug #1700535 and improvement to patch #1702907)
04/29/2007: gga
[Ruby] Fixed GC memory issues with trackings that could lead
to segfaults when dealing, mainly, with static variables.
(bug #1700535 and patch #1702907)
04/29/2007: gga
[Ruby]
Fixed String conversion using old ruby1.6 macros. Now
StringValuePtr() is used if available. This removes warnings
when converting strings with \0 in them.
(bug #1700535 and patch #1702907)
04/29/2007: gga
[Ruby]
Fixed the argout count in directors for Ruby. Previously,
ignored or "numinputs=0" typemaps would incorrectly not get
counted towards the argout count.
(bug/patch #1545585)
04/29/2007: gga
[Ruby]
Upgraded Ruby converter to recognize "numinputs=0". Previously,
only the old "ignore" flag was checked (which would currently
still work properly, but is deprecated).
04/29/2007: gga
[Ruby - but should be made generic]
%feature("numoutputs","0") added.
This feature allows you to ignore the output of a function so
that it is not added to a list of output values
( ie. argouts ).
This should also become a feature of %typemap(directorout)
as "numoutputs"=0, just like "numinputs"=0 exists.
%feature("directors"=1)
%include <typemaps.i>
%feature("numoutputs","0") { Class::member_function1 };
%typemap(out) MStatus { // some code, like check mstatus
// and raise exception if wrong };
%inline %{
typedef int MStatus;
class Class {
// one argument returned, but director out code added
// MStatus is discarded as a return (out) parameter.
virtual MStatus member_function1( int& OUTPUT );
// two arguments returned, director out code added
// MStatus is not discarded
virtual MStatus member_function2( int& OUTPUT );
};
%}
04/21/2007: olly
Fix parsing of float constants with an exponent (e.g. 1e-02f)
(bug #1699646).
04/20/2007: olly
[Python] Fix lack of generation of docstrings when -O is used.
Also, fix generation of docstrings containing a double quote
character. Patch from Richard Boulton in bug#1700146.
04/17/2007: wsfulton
[Java, C#] Support for adding in Java/C# code before and after the intermediary call,
specifically related to the marshalling of the proxy type to the intermediary type.
The javain/csin typemap now supports the 'pre' and 'post' attributes to achieve this.
The javain typemap also supports an optional 'pgcppname' attribute for premature garbage
collection prevention parameter naming and the csin typemap supports an optional 'cshin'
attribute for the parameter type used in a constructor helper generated when the type is used
in a constructor. Details in the Java.html and CSharp.html documentation.
04/16/2007: olly
Don't treat `restrict' as a reserved identifier in C++ mode
(bug#1685534).
04/16/2007: olly
[PHP5] Fix how zend_throw_exception() is called (bug #1700785).
04/10/2007: olly
Define SWIGTEMPLATEDISAMBIGUATOR to template for aCC (reported on
swig-user that this is needed).
04/04/2007: olly
[PHP5] If ZTS is enabled, release <module>_globals_id in MSHUTDOWN
to avoid PHP interpreter crash on shutdown. This solution was
suggested here: http://bugs.php.net/bug.php?id=40985
04/03/2007: olly
[PHP4] Add missing ZTS annotations to generated C++ wrapper code
to fix compilation failures when using ZTS enabled SWIG (Linux
distributions tend to disable ZTS, but notably the Windows build
uses it by default).
04/01/2007: efuzzyone
[CFFI] Patch #1684261: fixes handling of unsigned int literals, thanks Leigh Smith.
Also, improved documentation.
03/30/2007: olly
Avoid generating '<:' token when using SwigValueWrapper<> on a type
which starts with '::' (patch #1690948).
03/25/2007: wuzzeb (John Lenz)
[perl5] Add SWIG_fail to the SWIG_exception macro. Fixes a few problems reported
on the mailing list.
03/23/2007: wsfulton
String copying patch from Josh Cherry reducing memory consumption by about 25%.
03/21/2007: wsfulton
[Java] Apply patch #1631987 from Ulrik Peterson - bool INOUT typemaps
fail on big endian machines.
03/16/2007: wsfulton
Fix seg fault given dodgy C++ code: namespace abc::def { }
03/16/2007: wsfulton
[Java] Fixes so that ARRAYSOFCLASSES and ARRAYSOFENUMS in arrays_java.i can be applied
to pointer types.
03/03/2007: olly
[PHP5] When we know the literal numeric value for a constant, use
that to initialise the const member in the PHP wrapper class.
03/02/2007: olly
[PHP5] Fix PHP wrapper code generated for certain cases of
overloaded forms with default arguments.
02/26/2007: efuzzyone
[CFFI] Patch #1656395: fixed hex and octal values bug, thanks to Arthur Smyles.
02/22/2007: mgossage
[Lua] Fixed bug in typemaps which caused derived_byvalue and rname test cases to fail.
Updated derived_byvalue.i to explain how to find and fix the problem
01/25/2007: wsfulton
Fix #1538522 and #1338527, forward templated class declarations without a
name for the templated class parameters, such as:
template <typename, class> class X;
01/23/2007: mgossage
[Lua] Patch #1640862: <malloc.h> replaced by <stdlib.h>
Patch #1598063 Typo in typemaps.i
01/22/2007: mgossage
[Lua] Added a lua specific carrays.i which adds the operator[] support.
modified the main code to make it not emit all the class member functions & accessors
Note: C structs are created using new_XXX() while C++ classes use XXX() (should be standardised)
Updated test case: li_carrays
Updated the documentation.
01/12/2007: wsfulton
[Php] Add support for newfree typemaps (sometimes used by %newobject)
01/12/2007: beazley
New command line option -macroerrors. When supplied, this will force
the C scanner/parser to report proper location information for code contained
inside SWIG macros (defined with %define). By default, SWIG merely reports
errors on the line at which a macro is used. With this option, you
can expand the error back to its source---something which may simplify
debugging.
01/12/2007: beazley
[Internals] Major overhaul of C/C++ scanning implementation. For quite
some time, SWIG contained two completely independent C/C++ tokenizers--
the legacy scanner in CParse/cscanner.c and a general purpose scanner
in Swig/scanner.c. SWIG still has two scanning modules, but the C parser
scanner (CParse/cscanner.c) now relies upon the general purpose
scanner found in Swig/scanner.c. As a result, it is much smaller and
less complicated. This change also makes it possible to maintain all
of the low-level C tokenizing in one central location instead of two
places as before.
***POTENTIAL FLAKINESS***
This change may cause problems with accurate line number reporting
as well as error reporting more generally. I have tried to resolve this
as much as possible, but there might be some corner cases.
01/12/2007: mgossage
[Lua] Added typemap throws for std::string*, typemap for SWIGTYPE DYNAMIC,
changed the existing throws typemap to throw a string instead of making a copy of
the object (updating a few test cases to deal with the change).
fixed test case: dynamic_casts, exception_partial_info, li_std_string, size_t
01/03/2007: beazley
[Internals]. Use of swigkeys.c/.h variables is revoked. Please use
simple strings for attribute names.
12/30/2006: beazley
Internal API functions HashGetAttr() and HashCheckAttr() have been revoked.
Please use Getattr() to retrieve attributes. The function Checkattr() can
be used to check attributes. Note: These functions have been revoked
because they only added a marginal performance improvement at the expense
code clarity.
12/26/2006: mgossage
[Lua] Added more STL (more exceptions, map, size_t),
fixed test case: conversion_ns_template.
12/21/2006: mgossage
[Lua] Update to throw errors when setting immutables,
and allowing user addition of module variables.
12/20/2006: wsfulton
Fix typedef'd variable wrappers that use %naturalvar, eg, std::string.
12/14/2006: wsfulton
[C#] Add std::wstring and wchar_t typemaps
12/14/2006: olly
[php] Fix bug #1613673 (bad PHP5 code generated for getters and
setters).
12/02/2006: wsfulton, John Lenz, Dave Beazley
Move from cvs to Subversion for source control
11/30/2006: beazley
Cleaned up swigwarnings.swg file not to use nested macro
definitions.
11/12/2006: wsfulton
[Java, C#] Fix for %extend to work for static member variables.
Version 1.3.31 (November 20, 2006)
==================================
11/12/2006: Luigi Ballabio
[Python] Alternate fix for Python exceptions bug #1578346 (the previous one broke Python
properties in modern classes)
11/12/2006: wsfulton
-fakeversion commandline option now generates the fake version into the generated wrappers
as well as displaying it when the -version commandline option is used.
14/11/2006: mgossage
[lua] update to typemap for object by value, to make it c89 compliant
Version 1.3.30 (November 13, 2006)
==================================
11/12/2006: wsfulton
[java] Remove DetachCurrentThread patch from 08/11/2006 - it causes segfaults
on some systems.
11/12/2006: wsfulton
[python] Fix #1578346 - Python exceptions with -modern
11/10/2006: wsfulton
Fix #1593291 - Smart pointers and inheriting from templates
11/09/2006: wsfulton
Fix director operator pointer/reference casts - #1592173.
11/07/2006: wsfulton
Add $self special variable for %extend methods. Please use this instead of just 'self'
as the C++ 'this' pointer.
11/07/2006: mutandiz
[allegrocl]
allegrocl.swg: swig-defvar updated to allow specifying of
non-default foreign type (via :ftype keyword arg).
allegrocl.cxx: Specify proper access type for enum values.
11/03/2006: wsfulton
[Java/C#] Fix const std::string& return types for directors as reported by
Mark Donselzmann
10/29/2006: wsfulton
[Java] Remove DeleteLocalRef from end of director methods for now as it is causing a
seg fault when run on Solaris 8.
10/29/2006: wuzzeb (John Lenz)
[Guile] Patch from Chris Shoemaker to clean up some warnings in the generated code.
10/29/2006: wsfulton
[Java] Important fix to prevent early garbage collection of the Java proxy class
while it is being used in a native method. The finalizer could destroy the underlying
C++ object while it was being used. The problem occurs when the proxy class is no
longer strongly reachable after a native call. The problem seems to occur in
memory stress situations on some JVMs. It does not seem to occur on the
Sun client JVM up to jdk 1.5. However the 1.6 client jdk has a more aggressive garbage
collector and so the problem does occur. It does occur on the Sun server
JVMs (certainly 1.4 onwards). The fix entails passing the proxy class into the native
method in addition to the C++ pointer in the long parameter, as Java classes are not
collected when they are passed into JNI methods. The extra parameter can be suppressed
by setting the nopgcpp attribute in the jtype typemap to "1" or using the new -nopgcpp
commandline option.
See Java.html#java_pgcpp for further details on this topic.
10/24/2006: wsfulton
[C#] Fix smart pointer wrappers. The virtual/override/new keyword is not generated
for each method as the smart pointer class does not mirror the underlying pointer
class inheritance hierarchy. SF #1496535
10/24/2006: mgossage
[lua] added support for native methods & member function pointers.
fixed test cases arrays_dimensionless & cpp_basic. Added new example (functor).
tidied up a little of the code (around classHandler).
10/17/2006: wsfulton
[C#, Java] directorout typemap changes to fall in line with the other director
languages. $result is now used where $1 used to be used. Please change your typemaps
if you have a custom directorout typemap.
10/18/2006: wsfulton
Some fixes for applying the char array typemaps to unsigned char arrays.
10/17/2006: wsfulton
[C#, Java] Add in const size_t& and const std::size_t& typemaps.
10/15/2006: efuzzyone
[CFFI] Suppress generating defctype for enums, thanks to Arthur Smyles. Patch 1560983.
10/14/2006: wuzzeb (John Lenz)
[Chicken] Minor fix to make SWIG work with the (as yet unreleased) chicken 2.5
[Guile,Chicken] Fix SF Bug 1573892. Added an ext_test to the test suite to test
this bug, but this test can not really be made generic because the external code must
plug into the target language interpreter directly.
See Examples/test-suite/chicken/ext_test.i and ext_test_external.cxx
Added a %.externaltest to common.mk, and any interested language modules can
copy and slightly modify either the chicken or the guile ext_test.i
10/14/2006: mgossage
[Lua] added OUTPUT& for all number types, added a long long type
fixed several test cases.
update: changed typemaps to use SWIG_ConvertPtr rather than SWIG_MustGetPointer
started spliting lua.swg into smaller parts to make it neater
10/13/2006: wsfulton
[C#, Java] Marginally better support for multiple inheritance only in that you can
control what the base class is. This is done using the new 'replace' attribute in the
javabase/csbase typemap, eg in the following, 'Me' will be the base class,
no matter what Foo is really derived from in the C++ layer.
%typemap(javabase, replace="1") Foo "Me"
%typemap(csbase, replace="1") Foo "Me"
Previously it was not possible for the javabase/csbase typemaps to override the C++ base.
10/12/2006: wsfulton
[Java] Remove potential race condition on the proxy class' delete() method
(it is now a synchronized method, but is now customisable by changing the
methodmodifiers attribute in the javadestruct or javadestruct_derived typemap)
[C#] Remove potential race condition on the proxy class' Dispose() method,
similar to Java's delete() above.
*** POTENTIAL INCOMPATIBILITY ***
10/12/2006: wsfulton
[Ruby, Python] Remove redundant director code in %extend methods (%extend
methods cannot be director methods)
10/12/2006: wsfulton
[Ruby, Python] Fix #1505594 - director objects not returned as director objects
in %extend methods.
10/11/2006: wsfulton
[Java] Fix #1238798 - Directors using unsigned long long or any other type
marshalled across the JNI boundary using a Java class (where the jni typemap
contains jobject).
10/06/2006: wsfulton
Fix #1162194 - #include/%include within a structure
10/06/2006: wsfulton
Fix #1450661, string truncation in String_seek truncating Java/C# enums.
10/06/2006: mgossage
[Lua] Fix #1569587. The name is now correct.
10/04/2006: wsfulton
Director fixes for virtual conversion operators
10/04/2006: olly
[php] Fix #1569587 for PHP. Don't use sizeof() except with string
literals. Change some "//" comments to "/* */" for portability.
10/04/2006: mgossage
[Lua] Partial Fix #1569587. The type is now correct, but the name is still not correct.
10/03/2006: wsfulton
[Ruby] Fix #1527885 - Overloaded director virtual methods sometimes produced
uncompilable code when used with the director:except feature.
10/03/2006: wsfulton
Directors: Directors are output in the order in which they are declared in
the C++ class rather than in some pseudo-random order.
10/03/2006: mmatus
Fix #1486281 and #1471039.
10/03/2006: olly
[Perl] Fix for handling strings with zero bytes from Stephen Hutsal.
09/30/2006: efuzzyone
[CFFI] Bitfield support and vararg support due to Arthur Smyles.
C expression to Lisp conversion, thanks to Arthur Smyles for the initial
idea, it now supports conversion for a whole range of C expressions.
09/28/2006: wsfulton
Fix #1508327 - Overloaded methods are hidden when using -fvirtual optimisation.
Overloaded methods are no longer candidates for elimination - this mimics
C++ behaviour where all overloaded methods must be defined and implemented
in a derived class in order for them to be available.
09/25/2006: wsfulton
[Ruby, Python, Ocaml] Fix #1505591 Throwing exceptions in extended directors
09/25/2006: wsfulton
Fix #1056100 - virtual operators.
09/24/2006: olly
Don't accidentally create a "<:" token (which is the same as "[" in C++).
Fixes bug # 1521788.
09/23/2006: olly
[Ruby] Support building with recent versions of the Ruby 1.9
development branch. Fixes bug #1560092.
09/23/2006: olly
Templates can now be instantiated using negative numbers and
constant expressions, e.g.:
template<int q> class x {};
%template(x_minus1) x<-1>;
%template(x_1plus2) x<1+2>;
Also, constant expressions can now include comparisons (>, <, >=,
<=, !=, ==), modulus (%), and ternary conditionals (a ? b : c).
Fixes bugs #646275, #925555, #956282, #994301.
09/22/2006: wsfulton
Fix %ignore on director methods - Bugs #1546254, #1543533
09/20/2006: wsfulton
Fix %ignore on director constructors
09/20/2006: wsfulton
Fix seg faults and asserts when director methods are ignored (#1543533)
09/20/2006: wsfulton
Fix out of source builds - bug #1544718
09/20/2006: olly
Treat a nested class definition as a forward declaration rather
than ignoring it completely, so that we generate correct code for
passing opaque pointers to the nested class (fixes SF bug #909387).
09/20/2006: olly
*** POTENTIAL INCOMPATIBILITY ***
[php] Overload resolution now works. However to allow this, SWIG
generated wrappers no longer coerce PHP types (which reverts a change
made in 1.3.26). So for example, if a method takes a string, you
can no longer pass a number without explicitly converting it to a
string in PHP using: (string)x
09/18/2006: mgossage
[ALL] fix on swiginit.swg, has been reported to crash on several test cases
found and fixed problem in imports under python (mingw)
09/16/2006: wsfulton
[Python] Patch from Michal Marek for Python 2.5 to fix 64 bit array indexes on
64 bit machines.
09/13/2006: wsfulton
The explicitcall feature has been scrapped. This feature was introduced primarily
to solve recursive director method calls. Director upcall improvements made instead:
[Python, Ruby, Ocaml] The swig_up flag is no longer used. The required mutexes
wrapping this flag are also no longer needed. The recursive calls going from C++
to the target language and back again etc are now avoided by a subtlely different
approach. Instead of using the swig_up flag in each director method to indicate
whether the explicit C++ call to the appropriate base class method or a normal
polymorphic C++ call should be made, the new approach makes one of these calls
directly from the wrapper method.
[Java, C#] The recursive call problem when calling a C++ base class method from
Java/C# is now fixed. The implementation is slightly different to the other languages
as the detection as to whether the explicit call or a normal polymorphic call is made
in the Java/C# layer rather than in the C++ layer.
09/11/2006: mgossage
[ALL] updated swiginit.swg to allow multiple interpreters to use multiple
swig modules at once. This has been tested in Lua (mingw & linux),
perl5 & python (linux) only.
09/11/2006: mgossage
[lua] added support for passing function pointers as well as native lua object
into wrappered function.
Added example funcptr3 to demonstrate this feature
09/05/2006: olly
[php] Rename ErrorCode and ErrorMsg #define-s to SWIG_ErrorCode
and SWIG_ErrorMsg to avoid clashes with code the user might be
wrapping (patch from Darren Warner in SF bug #1466086). Any
user typemaps which use ErrorCode and/or ErrorMsg directly will
need adjusting - you can easily fix them to work with both old
and new SWIG by changing to use SWIG_ErrorMsg and adding:
#ifndef SWIG_ErrorMsg
#define SWIG_ErrorMsg() ErrorMsg()
#endif
08/29/2006: olly
[php] Move constant initialisation from RINIT to MINIT to fix a
warning when using Apache and mod_php. We only need to create
PHP constants once when we're first initialised, not for every HTTP
request.
08/21/2006: mgossage
[Lua]
Bugfix #1542466 added code to allow mapping Lua nil's <-> C/C++ NULL's
updated various typemaps to work correctly with the changes
added voidtest_runme.lua to show the features working
08/19/2006: wuzzeb (John Lenz)
[Guile] Add feature:constasvar to export constants as variables instead of functions
that return the constant value.
08/11/2006: wsfulton
[Java] DetachCurrentThread calls have been added so that natively created threads
no longer prevent the JVM from exiting. Bug reported by Thomas Dudziak and
Paul Noll.
08/10/2006: wsfulton
[C#] Fix director protected methods so they work
07/25/2006: mutandiz
[allegrocl]
more additions to std::string, some tweaks and small bug fixes
-nocwrap mode.
07/21/2006: mgossage
[Lua]
Bugfix #1526022 pdated std::string to support strings with '\0' inside them
updated typemaps.i to add support for pointer to pointers
07/19/2006: mutandiz
[allegrocl]
- Add std_string.i support.
- Add newobject patch submitted by mkoeppe (thanks!)
- Fix type name mismatch issue for nested type definitions.
specifically typedefs in templated class defns.
07/18/2006: mgossage
Bugfix #1522858
updated lua.cxx to support -external-runtime command
07/14/2006: wuzzeb (John Lenz)
Increment the SWIG_RUNTIME_VERSION to 3, because of the
addition of the owndata member in swig_type_info.
Reported by: Prabhu Ramachandran
07/05/2006: wsfulton
Search path fixes:
- Fix search path for library files to behave as documented in Library.html.
- Fix mingw/msys builds which did not find the SWIG library when installed.
- Windows builds also output the mingw/msys install location when running
swig -swiglib.
- The non-existent and undocumented config directory in the search path has
been removed.
07/05/2006: wsfulton
Fix $symname special variable expansion.
07/04/2006: wuzzeb (John Lenz)
[Chicken]
Add %feature("constasvar"), which instead of exporting a constant as a
scheme function, exports the constant as a scheme variable. Update the
documentation as well.
07/04/2006: wsfulton
[See entry of 09/13/2006 - explicitcall feature and documentation to it removed]
New explicitcall feature which generates additional wrappers for virtual methods
that call the method explicitly, not relying on polymorphism to make the method
call. The feature is a feature flag and is enabled like any other feature flag.
It also recognises an attribute, "suffix" for mangling the feature name, see
SWIGPlus.html#SWIGPlus_explicitcall documentation for more details.
[Java, C#]
The explicitcall feature is also a workaround for solving the recursive calls
problem when a director method makes a call to a base class method. See
Java.html#java_directors_explicitcall for updated documentation.
06/28/2006: joe (Joseph Wang)
[r] Initial support for R
06/20/2006: wuzzeb (John Lenz)
[Chicken]
Minor fixes to get apply_strings.i testsuite to pass
Remove integers_runme.scm from the testsuite, because SWIG and Chicken does
handle overflows.
06/19/2005: olly
[php] Add support for generating PHP5 class wrappers for C++
classes (use "swig -php5").
06/17/2006: olly
[php] Added some missing keywords to the PHP4 keyword list, and
fixed __LINE__ and __FILE__ which were in the wrong category.
Also added all the keywords new in PHP5, and added comments
noting the PHP4 keywords which aren't keywords in PHP5.
06/17/2006: olly
[php] Don't segfault if PHP Null is passed as this pointer (e.g.
Class_method(Null)) - give a PHP Error instead.
06/15/2006: mutandiz
[allegrocl]
Add initial support for std::list container class.
Fix a few bugs in helper functions.
05/13/2006: wsfulton
[Java] Replace JNIEXPORT with SWIGEXPORT, thereby enabling the possibility
of using gcc -fvisibility=hidden for potentially smaller faster loading wrappers.
05/13/2006: wsfulton
Fix for Makefiles for autoconf-2.60 beta
05/13/2006: wsfulton
Vladimir Menshakov patch for compiling wrappers with python-2.5 alpha.
05/12/2006: wsfulton
Fix buffer overflow error when using large %feature(docstring) reported
by Joseph Winston.
05/12/2006: wsfulton
[Perl] Operator overload fix from Daniel Moore.
05/25/2006: mutandiz
[allegrocl]
Fix bug in generation of CLOS type declarations for unions
and equivalent types.
05/24/2006: mutandiz
[allegrocl]
Don't require a full class definition to generate a CLOS wrapper.
05/20/2006: olly
[php] GCC Visibility support now works with PHP.
05/19/2006: olly
[php] Removed support for -dlname (use -module instead). Fixed
naming of PHP extension module to be consistent with PHP
conventions (no "php_" prefix on Unix; on PHP >= 4.3.0, handle Unix
platforms which use something other than ".so" as the extension.)
05/13/2006: wsfulton
[C#] Director support added
05/07/2006: olly
[php] Don't segfault if PHP Null is passed where a C++ reference
is wanted.
05/05/2006: olly
[php] Fix wrappers generated for global 'char' variables to not
include a terminating zero byte in the PHP string.
05/03/2006: wsfulton
Modify typemaps so that char * can be applied to unsigned char * or signed char *
types and visa versa.
05/03/2006: efuzzyone
[cffi]Thanks to Luke J Crook for this idea.
- a struct/enum/union is replaced with :pointer only if
that slot is actually a pointer to that type. So,:
struct a_struct { int x; } and
struct b_struct { a_struct struct_1; };
will be converted as:
(cffi:defcstruct b_struct
(struct_1 a_struct))
- Other minor fixes in lispifying names.
05/02/2006: wsfulton
Fix possible redefinition of _CRT_SECURE_NO_DEPRECATE for VC++.
04/14/2006: efuzzyone
[cffi]
Thanks to Thomas Weidner for the patch.
- when feature export is set (export 'foo) is
generated for every symbol
- when feature inline is set (declaim (inline foo)) is
generated before every function definition
- when feature intern_function is set
#.(value-of-intern-function "name" "nodeType" package)
is emitted instead of the plain symbol. A sample swig-lispify
is provided.
- every symbol is prefixed by it's package.
04/13/2006: efuzzyone
[cffi]
Fixed the generation of wrappers for global variables.
Added the option [no]swig-lisp which turns on/off generation
of code for swig helper lisp macro, functions, etc.
Version 1.3.29 (March 21, 2006)
===============================
04/05/2006: mutandiz
[allegrocl]
Fix output typemap of char so it produces a character instead
of an integer. Also adds input/output typemaps for 'char *'.
add command-line argument -isolate to generate an interface
file that won't interfere with other SWIG generated files that
may be used in the same application.
03/20/2005: mutandiz
[allegrocl]
More tweaks to INPUT/OUTPUT typemaps for bool.
Fix constantWrapper for char and string literals.
find-definition keybindings should work in ELI/SLIME.
Output (in-package <module-name>) to lisp wrapper
instead of (in-package #.*swig-module-name*).
slight rework of multiple return values.
doc updates.
03/17/2005: mutandiz
[allegrocl]
mangle names of constants generated via constantWrapper.
When using OUTPUT typemaps and the function has a non-void
return value, it should be first in the values-list, followed
by the OUTPUT mapped values.
Fix bug with boolean parameters, which needed to be
passed in as int values, rather than T or NIL.
03/15/2006: mutandiz
[allegrocl]
Generate wrappers for constants when in C++ or -cwrap mode.
Make -cwrap the default, since it is most correct. Users
can use the -nocwrap option to avoid the creation of a .cxx
file when interfacing to C code.
When in -nocwrap mode, improve the handling of converting
infix literals to prefix notation for lisp. This is very
basic and not likely to be improved upon since this only
applies to the -nocwrap case. Literals we can't figure out
will result in a warning and be included in the generated
code.
validIdentifier now more closely approximates what may be
a legal common lisp symbol.
Fix typemap error in allegrocl.swg
03/12/2006: mutandiz
[allegrocl]
fix up INPUT/OUTPUT typemaps for bool.
Generate c++ style wrapper functions for struct/union members
when -cwrap option specified.
03/10/2006: mutandiz
[allegrocl]
Fix bug in C wrapper generation introduced by last allegrocl
commit.
03/10/2006: wsfulton
[Java]
Commit #1447337 - Delete LocalRefs at the end of director methods to fix potential leak
03/10/2006: wsfulton
Fix #1444949 - configure does not honor --program-prefix.
Removed non-standard configure option --with-release-suffix. Fix the autoconf standard
options --program-prefix and --program-suffix which were being shown in the help,
but were being ignored. Use --program-suffix instead of --with-release-suffix now.
03/10/2006: wsfulton
[Java]
Fix #1446319 with patch from andreasth - more than one wstring parameter in director methods
03/07/2006: mkoeppe
[Guile]
Fix for module names containing a "-" in non-"shadow" mode.
Patch from Aaron VanDevender (#1441474).
03/04/2006: mmatus
- Add -O to the main program, which now enables -fastdispatch
[Python]
- Add the -fastinit option to enable faster __init__
methods. Setting 'this' as 'self.this.append(this)' in the python
code confuses PyLucene. Now the initialization is done in the
the C++ side, as reported by Andi and Robin.
- Add the -fastquery option to enable faster SWIG_TypeQuery via a
python dict cache, as proposed by Andi Vajda
- Avoid to call PyObject_GetAttr inside SWIG_Python_GetSwigThis,
since this confuses PyLucene, as reported by Andi Vajda.
03/02/2006: wsfulton
[Java]
Removed extra (void *) cast when casting pointers to and from jlong as this
was suppressing gcc's "dereferencing type-punned pointer will break strict-aliasing rules"
warning. This warning could be ignored in versions of gcc prior to 4.0, but now the
warning is useful as gcc -O2 and higher optimisation levels includes -fstrict-aliasing which
generates code that doesn't work with these casts. The assignment is simply never made.
Please use -fno-strict-aliasing to both suppress the warning and fix the bad assembly
code generated. Note that the warning is only generated by the C compiler, but not
the C++ compiler, yet the C++ compiler will also generate broken code. Alternatively use
-Wno-strict-aliasing to suppress the warning for gcc-3.x. The typemaps affected
are the "in" and "out" typemaps in java.swg and arrays_java.swg. Users ought to fix
their own typemaps to do the same. Note that removal of the void * cast simply prevents
suppression of the warning for the C compiler and nothing else. Typical change:
From:
%typemap(in) SWIGTYPE * %{ $1 = *($&1_ltype)(void *)&$input; %}
To:
%typemap(in) SWIGTYPE * %{ $1 = *($&1_ltype)&$input; %}
From:
%typemap(out) SWIGTYPE * %{ *($&1_ltype)(void *)&$result = $1; %}
To:
%typemap(out) SWIGTYPE * %{ *($&1_ltype)&$result = $1; %}
03/02/2006: mkoeppe
[Guile -scm]
Add typemaps for "long long"; whether the generated code compiles, however, depends
on the version and configuration of Guile.
03/02/2006: wsfulton
[C#]
Add support for inner exceptions. If any of the delegates are called which construct
a pending exception and there is already a pending exception, it will create the new
exception with the pending exception as an inner exception.
03/02/2006: wsfulton
[Php]
Added support for Php5 exceptions if compiling against Php5 (patch from Olly Betts).
03/01/2006: mmatus
Use the GCC visibility attribute in SWIGEXPORT.
Now you can compile (with gcc 3.4 or later) using
CFLAGS="-fvisibility=hidden".
Check the difference for the 'std_containers.i' python
test case:
Sizes:
3305432 _std_containers.so
2383992 _std_containers.so.hidden
Exported symbols (nm -D <file>.so | wc -l):
6146 _std_containers.so
174 _std_containers.so.hidden
Execution times:
real 0m0.050s user 0m0.039s sys 0m0.005s _std_containers.so
real 0m0.039s user 0m0.026s sys 0m0.007s _std_containers.so.hidden
Read http://gcc.gnu.org/wiki/Visibility for more details.
02/27/2006: mutandiz
[allegrocl]
Add support for INPUT, OUTPUT, and INOUT typemaps.
For OUTPUT variables, the lisp wrapper returns multiple
values.
02/26/2006: mmatus
[Ruby] add argcargv.i library file.
Use it as follow:
%include argcargv.i
%apply (int ARGC, char **ARGV) { (size_t argc, const char **argv) }
%inline {
int mainApp(size_t argc, const char **argv)
{
return argc;
}
}
then in the ruby side:
args = ["asdf", "asdf2"]
n = mainApp(args);
This is the similar to the python version Lib/python/argcargv.i
02/24/2006: mgossage
Small update Lua documents on troubleshooting problems
02/22/2006: mmatus
Fix all the errors reported for 1.3.28.
- fix bug #1158178
- fix bug #1060789
- fix bug #1263457
- fix 'const char*&' typemap in the UTL, reported by Geoff Hutchison
- fixes for python 2.1 and the runtime library
- fix copyctor + template bug #1432125
- fix [ 1432152 ] %rename friend operators in namespace
- fix gcc warning reported by R. Bernstein
- avoid assert when finding a recursive scope inheritance,
emit a warning in the worst case, reported by Nitro
- fix premature object deletion reported by Paul in tcl3d
- fix warning reported by Nitro in VC7
- more fixes for old Solaris compiler
- fix for python 2.3 and gc_refs issue reported by Luigi
- fix fastproxy for methods using kwargs
- fix overload + protected member issue reported by Colin McDonald
- fix seterrormsg as reported by Colin McDonald
- fix directors, now the test-suite runs again using -directors
- fix for friend operator and Visual studio and bug 1432152
- fix bug #1435090
- fix using + %extend as reported by William
- fix bug #1094964
- fix for Py_NotImplemented as reported by Olly and Amaury
- fix nested namespace issue reported by Charlie
and also:
- allow director protected members by default
- delete extra new lines in swigmacros[UTL]
- cosmetic for generated python code
- add the factory.i library for UTL
- add swigregister proxy method and move __repr__ to a
single global module [python]
02/22/2006: mmatus
When using directors, now swig will emit all the virtual
protected methods by default.
In previous releases, you needed to use the 'dirprot'
option to achieve the same.
If you want, you can disable the new default behaviour,
use the 'nodirprot' option:
swig -nodirprot ...
and/or the %nodirector feature for specific methods, i.e.:
%nodirector Foo::bar;
struct Foo {
virtual ~Foo();
protected:
virtual void bar();
};
As before, pure abstract protected members are allways
emitted, independent of the 'dirprot/nodirprot' options.
02/22/2006: mmatus
Add the factory.i library for languages using the UTL (python,tcl,ruby,perl).
factory.i implements a more natural wrap for factory methods.
For example, if you have:
---- geometry.h --------
struct Geometry {
enum GeomType{
POINT,
CIRCLE
};
virtual ~Geometry() {}
virtual int draw() = 0;
//
// Factory method for all the Geometry objects
//
static Geometry *create(GeomType i);
};
struct Point : Geometry {
int draw() { return 1; }
double width() { return 1.0; }
};
struct Circle : Geometry {
int draw() { return 2; }
double radius() { return 1.5; }
};
//
// Factory method for all the Geometry objects
//
Geometry *Geometry::create(GeomType type) {
switch (type) {
case POINT: return new Point();
case CIRCLE: return new Circle();
default: return 0;
}
}
---- geometry.h --------
You can use the %factory with the Geometry::create method as follows:
%newobject Geometry::create;
%factory(Geometry *Geometry::create, Point, Circle);
%include "geometry.h"
and Geometry::create will return a 'Point' or 'Circle' instance
instead of the plain 'Geometry' type. For example, in python:
circle = Geometry.create(Geometry.CIRCLE)
r = circle.radius()
where 'circle' now is a Circle proxy instance.
02/17/2006: mkoeppe
[MzScheme] Typemaps for all integral types now accept the full range of integral
values, and they signal an error when a value outside the valid range is passed.
[Guile] Typemaps for all integral types now signal an error when a value outside
the valid range is passed.
02/13/2006: mgossage
[Documents] updated the extending documents to give a skeleton swigging code
with a few typemaps.
[Lua] added an extra typemap for void* [in], so a function which requires a void*
can take any kind of pointer
Version 1.3.28 (February 12, 2006)
==================================
02/11/2006: mmatus
Fix many issues with line counting and error reports.
02/11/2006: mmatus
[Python] Better static data member support, if you have
struct Foo {
static int bar;
};
then now is valid to access the static data member, ie:
f = Foo()
f.bar = 3
just as in C++.
02/11/2006: wsfulton
[Perl]
Fixed code generation to work again with old versions of Perl
(5.004 and later tested)
02/04/2006: mmatus
[Python] Add the %extend_smart_pointer() directive to extend
SWIG smart pointer support in python.
For example, if you have a smart pointer as:
template <class Type> class RCPtr {
public:
...
RCPtr(Type *p);
Type * operator->() const;
...
};
you use the %extend_smart_pointer directive as:
%extend_smart_pointer(RCPtr<A>);
%template(RCPtr_A) RCPtr<A>;
then, if you have something like:
RCPtr<A> make_ptr();
int foo(A *);
you can do the following:
a = make_ptr();
b = foo(a);
ie, swig will accept a RCPtr<A> object where a 'A *' is
expected.
Also, when using vectors
%extend_smart_pointer(RCPtr<A>);
%template(RCPtr_A) RCPtr<A>;
%template(vector_A) std::vector<RCPtr<A> >;
you can type
a = A();
v = vector_A(2)
v[0] = a
ie, an 'A *' object is accepted, via implicit conversion,
where a RCPtr<A> object is expected. Additionally
x = v[0]
returns (and sets 'x' as) a copy of v[0], making reference
counting possible and consistent.
%extend_smart_pointer is just a collections of new/old
tricks, including %typemaps and the new %implicitconv
directive.
02/02/2006: mgossage
bugfix #1356577, changed double=>lua_number in a few places.
added the std::pair wrapping
01/30/2006: wsfulton
std::string and std::wstring member variables and global variables now use
%naturalvar by default, meaning they will now be wrapped as expected in all languages.
Previously these were wrapped as a pointer rather than a target language string.
It is no longer necessary to add the following workaround to wrap these as strings:
%apply const std::string & { std::string *}
*** POTENTIAL INCOMPATIBILITY ***
01/28/2006: mkoeppe
[Guile -scm]
Add typemaps for handling of member function pointers.
01/24/2006: mmatus
- Better support for the %naturalvar directive, now it
works with the scripting languages as well as
Java/C#.
Now, it can also be applied to class types:
%naturalvar std::string;
%include <std_string.i>
that will tell swig to use the 'natural' wrapping
mechanism to all std::string global and member
variables.
- Add support for the %allowexcept feature along the
scripting languages, which allows the %exception feature
to be applied to the variable access methods. Also, add
the %exceptionvar directive to specify a distintic
exception mechanism only for variables.
- Add more docs for the %delobject directive to mark a method as a
destructor, 'disowning' the first argument. For example:
%newobject create_foo;
%delobject destroy_foo;
Foo *create_foo() { return new Foo(); }
void destroy_foo(Foo *foo) { delete foo; }
or in a member method as:
%delobject Foo::destroy;
class Foo {
public:
void destroy() { delete this;}
private:
~Foo();
};
01/24/2006: mgossage
[Lua]
- Removed the type swig_lua_command_info & replace with luaL_reg
(which then broke the code), fixed this
- added an additional cast in the typemaps for enum's
due to the issue that VC.Net will not allow casting of
a double to an enum directly. Therefore cast to int then to enum
(thanks to Jason Rego for this observation)
01/16/2006: mmatus (Change disabled... will be back in CVS soon)
Add initial support for regexp via the external library
RxSpencer. SWIG doesn't require this library to compile
and/or run. But if you specify --with-rxspencer, and the
library is found during installation, then swig will use
it in three places:
- In %renames rules, via the new rxsmatch rules, for example:
%rename("%(lowercase)",rxsmatch$name="GSL_.*") "";
%rename("%(lowercase)",rxsmatch$nodeType="enum GSL_.*") "";
rxsmatch is similar to the match rule, it just uses
the RxSpencer regexp library to decide if there is a
match with the provided regexp. As with the match
rule, you can also use the negate rule notrxsmatch.
- In the %rename target name via the rxstarget option, for example:
%rename("%(lowercase)",rxstarget=1) "GSL_.*";
where the target name "GSL.*" is now understood as a
regexp to be matched.
- In the new encoder "rxspencer", which looks like:
%(rxspencer:[regexp][replace])s
where "regexp" is the regular expression and "replace"
is a string used as a replacement, where the @0,@1,...,@9
pseudo arguments are used to represent the
corresponding matching items in the reg expression.
For example:
%(rxspencer:[GSL.*][@0])s <- Hello ->
%(rxspencer:[GSL.*][@0])s <- GSLHello -> GSLHello
%(rxspencer:[GSL(.*)][@1])s <- GSLHello -> Hello
%(rxspencer:[GSL(.*)][gsl@1])s <- GSLHello -> gslHello
Another example could be:
%rename("%(lowercase)s",sourcefmt="%(rxspencer:[GSL_(.*)][@1])s",%$isfunction) "";
which take out the prefix "GSL_" and returns all the
function names in lower cases, as following:
void GSL_Hello(); -> hello();
void GSL_Hi(); -> hi();
const int GSL_MAX; -> GSL_MAX; // no change, is not a function
We use the RxSpencer as an initial test bed to
implemention while we decide which library will be
finally added to swig.
You can obtain the RxSpencer library from
http://arglist.com/regex (Unix)
or
http://gnuwin32.sourceforge.net/packages.html (Windows)
Once installed, use "man rxspencer" to get more info
about the regexp format, or just google rxspencer.
Since now you can enable the rxsmatch rules (see above),
the simple or '|' support for the match rules
(01/12/2006: mmatus) is disabled. Still, if you have
problems with the rxspencer library, you can re-enable
the simple 'match or' support using
-DSWIG_USE_SIMPLE_MATCHOR.
01/16/2006: mmatus
Change the %rename predicates to use the prefix '%$', as in:
%rename("%(utitle)s",%$isfunction,%$ismember) "";
to avoid clashes with other swig macros/directives.
01/14/2006: cfisavage
[Ruby]
Added support for Ruby bang! methods via a new %bang feature.
Bang methods end in exclamation points and indicate that the
object being processed will be modified in-place as
opposed to being copied.
01/12/2006: cfisavage
[Ruby]
Updated the Ruby module to automatically convert
method names to lower_case_with_underscores using the
new %rename functionality.
01/12/2006: mmatus
- Add aliases for 'case' encoders used with %rename/%namewarn
%(uppercase)s hello_world -> HELLO_WORLD
%(lowercase)s HelloWorld -> helloworld
%(camelcase)s hello_world -> HelloWorld
%(undercase)s HelloWorld -> hello_world
01/12/2006: mmatus
- Add the -dump_parse_module and -dump_parse_top options,
which are similar to -dump_module and -dump_top, but they
dump the node trees just after parsing, showing only the
attributes visible at the parsing stage, and not the added
later in typemap.cxx, allocate.cxx, lang.cxx or elsewhere.
Besides debugging porpuses, these options are very useful
if you plan to use %rename in an "advance way", since it
shows only and all the node's attributes you can use
inside the match rules.
01/12/2006: mmatus
- Add predicates to %rename, so, you don't need to
remember, for example, how to match a member function.
Now it is easy, for example to use the 'utitle' encoder
in all the member methods, you type:
%rename("%(utitle)s",%isfunction,%ismember) "";
or to ignore all the enumitems in a given class:
%rename("$ignore", %isenumitem, %classname="MyClass") "";
Available predicates are (see swig.swg):
%isenum
%isenumitem
%isaccess
%isclass
%isextend
%isextend
%isconstructor
%isdestructor
%isnamespace
%istemplate
%isconstant
%isunion
%isfunction
%isvariable
%isimmutable
%isstatic
%isfriend
%istypedef
%isvirtual
%isexplicit
%isextern
%ismember
%isglobal
%innamespace
%ispublic
%isprotected
%isprivate
%classname
These predicates correspond to specific 'match'
declarations, which sometimes are not as evident as the
predicates names.
- Add the or '|' operation in %rename match, for
example to capitalize all the constants (%constant or
const cdecl):
%rename("%(upper)s",match="cdecl|constant",%isimmutable) "";
01/12/2006: mgossage
- Partial fixed of errors under C89, bug #1356574
(converted C++ style comments to C style)
- Added patches from neomantra@users.sf.net #1379988 and #1388343
missing a 'return' statement for error conditions
also updated the %init block bug #1356586
01/10/2006: mmatus
- Add the 'utitle' encoder, as an example of how to add
your own encoder. I added the encoder method in misc.c
but developers can add others, the same way, inside any
target language.
Well, 'utitle' is the reverse of 'ctitle', ie:
%rename("%(ctitle)s") camel_case; -> CamelCase;
%rename("%(utitle)s") CamelCase; -> camel_case;
01/10/2006: cfisavage
[Ruby]
Updated Ruby Exception handling. Classes that are specified in throws clauses,
or are marked as %exceptionclass, are now inherited from rb_eRuntimeError.
This allows instances of these classes to be returned to Ruby as exceptions.
Thus if a C++ method throws an instance of MyException, the calling Ruby
method will get back a MyException object. To see an example,
look at ruby/examples/exception_class.
01/10/2006: mmatus
- Add the %catches directive, which complements the %exception
directive in a more automatic way. For example, if you have
int foo() throw(E1);
swig generates the proper try/catch code to dispatch E1.
But if you have:
int barfoo(int i) {
if (i == 1) {
throw E1();
} else {
throw E2();
}
return 0;
}
ie, where there is no explicit exception specification in the decl, you
end up doing:
%exception barfoo {
try {
$action
} catch(E1) { ... }
} catch(E2) { ... }
}
which is very tedious. Well, the %catches directive defines
the list of exceptions to catch, and from swig:
%catches(E1,E2) barfoo(int i);
int barfoo(int i);
is equivalent to
int barfoo(int i) throw(E1,E2);
Note, however, that the %catches list doesn't have to
correspond to the C++ exception specification. For example, if you
have:
struct E {};
struct E1 : E {};
struct E2 : E {};
int barfoo(int i) throw(E1,E2);
you can define
%catches(E) barfoo(int i);
and swig will generate an action code equivalent to
try {
$action
} catch(E &_e) {
<raise _e>;
}
Of course, you still have to satisfy the C++ restrictions,
and the catches list must be compatible (not the same)
as the original list of types in the exception specification.
Also, you can now specify that you want to catch the
unknown exception '...', for example:
%catches(E1,E2,...) barfoo(int);
In any case, the %catches directive will emit the
code to convert into the target language error/exception
using the 'throws' typemap.
For the '...' case to work, you need to
write the proper typemap in your target language. In the
UTL, this looks like:
%typemap(throws) (...) {
SWIG_exception(SWIG_RuntimeError,"unknown exception");
}
01/09/2006: mutandiz
[Allegrocl]
Fixes a number of SEGVs primarily in the handling of
various anonymous types. Found in a pass through the
swig test-suite. Still more to do here, but this is a
good checkpoint.
Adds -cwrap and -nocwrap as an allegrocl specific
command-line argument. Controls generating of a C
wrapper file when wrapping C code. By default only a
lisp file is created for C code wrapping.
Doc updates for the command-line arguments and fixes as
pointed out on swig-devel
01/05/2006: wsfulton
[Java] Fix unsigned long long and const unsigned long long & typemaps
- Bug #1398394 with patch from Dries Decock
01/06/2006: mmatus
Add 'named' warning codes, now in addition to:
%warnfilter(813);
you can use
%warnfilter(SWIGWARN_JAVA_MULTIPLE_INHERITANCE);
just use the same code name found in Source/Include/swigwarn.h
plus the 'SWIG' prefix.
If a developer adds a new warning code, the Lib/swigwarn.swg file
will be generated when running the top level make.
01/05/2006: cfisavage
[Ruby]
Reimplemented object tracking for Ruby. The new implementation works
by expanding the swig_class structure for Ruby by adding a trackObjects
field. This field can be set/unset via %trackobjects as explained
in the Ruby documentation. The new implementation is more robust
and takes less code to implement.
01/05/2006: wsfulton
Fix for %extend and static const integral types, eg:
class Foo {
public:
%extend {
static const int bar = 42;
}
};
12/30/2005: mmatus
- Add info for old and new debug options:
-dump_top - Print information of the entire node tree, including system nodes
-dump_module - Print information of the module node tree, avoiding system nodes
-dump_classes - Print information about the classes found in the interface
-dump_typedef - Print information about the types and typedefs found in the interface
-dump_tags - Print information about the tags found in the interface
-debug_typemap - Print information for debugging typemaps
-debug_template - Print information for debugging templates
- Add the fakeversion. If you have a project that uses
configure/setup.py, or another automatic building system
and requires a specific swig version, let say 1.3.22
you can use:
SWIG_FEATURES="-fakeversion 1.3.22"
or
swig -fakeversion 1.3.22
and then swig -version will report 1.3.22 instead of the
current version.
Typical use would be
SWIG_FEATURES="-fakeversion 1.3.22" ./configure
12/30/2005: mmatus
- Add option/format support to %rename and %namewarn.
Now %namewarn can force renaming, for example:
%namewarn("314: import is a keyword",rename="_%s") "import";
and rename can also support format forms:
%rename("swig_%s") import;
Now, since the format is processed via swig Printf, you
can use encoders as follows:
%rename("%(title)s") import; -> Import
%rename("%(upper)s") import; -> IMPORT
%rename("%(lower)s") Import; -> import
%rename("%(ctitle)s") camel_case; -> CamelCase
This will allow us to add more encoders, as the
expected one for regular expressions.
- Add the above 'ctitle' encoder, which does the camel case:
camel_case -> CamelCase
- Also, while we get the regexp support, add the 'command' encoder,
you can use it as follows
%rename("%(command:sed -e 's/\([a-z]\)/\U\\1/' <<< )s") import;
then swig will popen the command
"sed -e 's/\([a-z]\)/\U\\1/' <<< import"
see below for anonymous renames for better examples.
- The rename directive now also allows:
- simple match: only apply the rename if a type match
happen, for example
%rename(%(title)s,match="enumitem") hello;
enum Hello {
hi, hello -> hi, Hello
};
int hello() -> hello;
- extended match: only apply the rename if the 'extended attribute' match
occurred, for example:
// same as simple match
%rename(%(title)s,match$nodeType="enumitem") hello;
enum Hello {
hi, hello -> hi, Hello
};
Note that the symbol '$' is used to define the attribute name in
a 'recursive' way, for example:
// match only hello in 'enum Hello'
%rename(%(title)s,match$parentNode$type="enum Hello") hello;
enum Hello {
hi, hello -> hi, Hello // match
};
enum Hi {
hi, hello -> hi, hello // no match
};
here, for Hello::hi, the "parentNode" is "Hello", and its "type"
is "enum Hello".
- Anonymous renames: you can use 'anonymous' rename directives, for example:
// rename all the enum items in Hello
%rename(%(title)s,match$parentNode$type="enum Hello") "";
enum Hello {
hi, hello -> Hi, Hello // match both
};
enum Hi {
hi, hello -> hi, hello // no match
};
// rename all the enum items
%rename(%(title)s,match$nodeType="enumitem") "";
// rename all the items in given command (sloooow, but...)
%rename(%(command:<my external cmd>)s) "";
Anonymous renames with commands can be very powerful, since you
can 'outsource' all the renaming mechanism (or part of it) to an
external program:
// Uppercase all (and only) the names that start with 'i'
%rename("%(command:awk '/^i/{print toupper($1)}' <<<)s") "";
int imported() -> IMPORTED;
int hello() -> hello
Note that if the 'command' encoder returns an empty string, swig
understands that no rename is necessary.
Also note that %rename 'passes' the matched name. For example, in
this case
namespace ns1 {
int foo();
}
namespace ns2 {
int bar();
}
the external program only receives "foo" and "bar". If needed,
however, you can request the 'fullname'
%rename("%(command:awk 'awk '/ns1::/{l=split($1,a,"::"); print toupper(a[l])}'' <<<)s",fullname=1) "";
ns1::foo -> FOO
ns2::bar -> bar
- Mixing encoders and matching: of course, you can do mix commands
and match fields, for example:
%rename("%(<my encoder for fncs>)",match="cdecl") "";
%rename("%(<my encoder for enums>)",match="enumitem") "";
%rename("%(<my encoder for enums inside a class>)",match="enumitem",
match$parentNode$parentNode$nodeType="class") "";
Use "swig -dump_parse_module" to see the attribute names you can use to
match a specific case.
- 'sourcefmt' and 'targetfmt': sometimes you need to
process the 'source' name before comparing, for example
%namewarn("314: empty is a keyword",sourcefmt="%(lower)s") "empty";
then if you have
int Empty(); // "Empty" is the source
you will get the keyword warning since 'Empty' will be
lower cased, via the sourcefmt="%(lower)s" option,
before been compared to the 'target' "empty".
There is an additional 'targetfmt' option to process the
'target' before comparing.
- complementing 'match': you can use 'notmatch', for example
%namewarn("314: empty is a keyword",sourcefmt="%(lower)s",notmatch="namespace") "empty";
here, the name warning will be applied to all the symbols except namespaces.
12/30/2005: mmatus
- Add initial support for gcj and Java -> <target language> mechanism.
See examples in:
Examples/python/java
Examples/ruby/java
Examples/tcl/java
to see how to use gcj+swig to export java classes into
python/ruby/tcl.
The idea is to put all the common code for gcj inside
Lib/gcj
and localize specific types such as jstring, as can be found
in
Lib/python/jstring.i
Lib/ruby/jstring.i
Lib/tcl/jstring.i
Using the UTL, this is very easy, and the perl version for
jstring.i will be next.
12/29/2005: mmatus
- Add the copyctor feature/directive/option to enable the automatic
generation of copy constructors. Use as in:
%copyctor A;
struct A {
};
then this will work
a1 = A();
a2 = A(a1);
Also, since it is a feature, if you just type
%copyctor;
that will enable the automatic generation for all the
classes. It is also equivalent to
swig -copyctor -c++ ...
Notes:
1.- The feature only works in C++ mode.
2.- The automatic creation of the copy constructor will
usually produce overloading. Hence, if the target
language doesn't support overloading, a special name
will be used (A_copy).
3.- For the overloading reasons above, it is probably not
a good idea to use the flag when, for example, you are
using keywords in Python.
4.- The copyctor automatic mechanism follows more or less
the same rules as the default constructor mechanism,
i.e., a copy constructor will not be added if the
class is abstract or if there is a pertinent non-public
copy ctor in the class or its hierarchy.
Hence, it might be necessary for you to complete the
class declaration with the proper non-public copy ctor
to avoid a wrong constructor addition.
- Fix features/rename for templates ctor/dtor and other
things around while adding the copyctor mechanism.
12/27/2005: mmatus
- Add the 'match' option to typemaps. Assume you have:
%typemap(in) SWIGTYPE * (int res) {..}
%typemap(freearg) SWIGTYPE * { if (res$argnum) ...}
then if you do
%typemap(in) A * {...}
swig will 'overload the 'in' typemap, but the 'freearg'
typemap will be also applied, even when this is wrong. The old
solutions is to write:
%typemap(in) A * {...}
%typemap(freeag) A * ""
overload 'freearg' with an empty definition.
The problem is, however, there is no way to know you need
to do that until you start getting broken C++ code, or
worse, broken runtime code.
The same applies to the infamous 'typecheck' typemap,
which always confuses people, since the first thing you do
is to just write the 'in' typemap.
The 'match' option solves the problem, and if instead you write:
%typemap(in) SWIGTYPE * (int res) {..}
%typemap(freearg,match="in") SWIGTYPE * { if (res$argnum) ...}
%typemap(typecheck,match="in",precedence...) SWIGTYPE * {...}
it will tell swig to apply the 'freearg/typecheck'
typemaps only if they 'match' the type of the 'in'
typemap. The same can be done with other typemaps as:
%typemap(directorout) SWIGTYPE * {...}
%typemap(directorfree,match="directorout") SWIGTYPE * {...}
12/27/2005: mmatus
- Add the 'naturalvar' option/mode/feature to treat member
variables in a more natural way, ie, similar to the global
variable behavior.
You can use it in a global way via the command line
swig -naturalvar ...
or the module mode option
%module(naturalvar=1)
both forms make swig treat all the member variables in the
same way it treats global variables.
Also, you can use it in a case by case approach for
specific member variables using the directive form:
%naturalvar Bar::s;
Then, in the following case for example:
std::string s;
struct Bar {
std::string s;
};
you can do:
b = Bar()
b.s ="hello"
cvar.s = "hello"
if (b.s != cvar.s):
raise RuntimeError
This is valid for all the languages, and the
implementation is based on forcing the use of the
const SWIGTYPE& (C++)/SWIGTYPE (C) typemaps for the
get/set methods instead of the SWIGTYPE * typemaps.
Hence, for 'naturalvar' to work, each target language
must implement 'typemap(in/out) const Type&' properly.
The 'naturalvar' option replaces or makes workarounds such as:
%apply const std::string & { std::string *}
unnecessary.
Note1: If your interface has other kinds of workarounds to
deal with the old 'unnatural' way to deal with member
variables (returning/expecting pointers), the
'naturalvar' option could break them.
Note2: the option has no effect on unnamed types, such
as unnamed nested unions.
12/27/2005: mmatus
- Add more 'expressive' result states for the typemap
libraries.
In the past, for scripting languages, you would do checking something like:
if (ConvertPtr(obj,&vptr,ty,flags) != -1) {
// success
} else {
// error
}
Now the result state can carry more information,
including:
- Error state: like the old -1/0, but with error codes from swigerrors.swg.
int res = ConvertPtr(obj,&vptr,ty,flags);
if (SWIG_IsOK(res)) {
// success code
} else {
SWIG_Error(res); // res carries the error code
}
- Cast rank: when returning a simple successful
conversion, you just return SWIG_OK, but if you need
to do a 'cast', you can add the casting rank, ie:
if (PyFloat_Check(obj)) {
value = PyFloat_AsDouble(obj);
return SWIG_OK;
} else if (PyInt_Check(obj)) {
value = (double) PyInt_AsLong(obj);
return SWIG_AddCast(SWIG_OK);
}
later, the casting rank is used to properly dispatch
the overloaded function, for example. This of course
requires your language to support and use the new
dispatch cast/rank mechanism (Now mainly supported in
perl and python, and easily expandable to ruby and tcl).
- [UTL] Add support for the new 'expressive' result states.
12/27/2005: mmatus
- Add support for the C++ implicit conversion mechanism, which
required some modifications in parser.y (to recognize
'explicit') and overload.cxx (to replace $implicitconv as
needed).
Still, real support in each target language requires each
target language to be modified. Python provides an example,
see below.
- Add support for native C++ implicit conversions, ie, if you
have
%implicitconv A;
struct A {
int ii;
A() {ii = 1;}
A(int) {ii = 2;}
A(double) {ii = 3;}
explicit A(char *s) {ii = 4;}
};
int get(const A& a) {return a.ii;}
you can call:
a = A()
ai = A(1)
ad = A(1.0)
as = A("hello")
# old forms
get(a) -> 1
get(ai) -> 2
get(ad) -> 3
get(as) -> 4
#implicit conversions
get(1) -> 2
get(1.0) -> 3
get("hello") -> Error, explicit constructor
Also, as in C++, now implicit conversions are supported in
variable assigments, and if you have:
A ga;
struct Bar {
A a;
};
you can do:
cvar.ga = A(1)
cvar.ga = 1
cvar.ga = 1.0
cvar.ga = A("hello")
cvar.ga = "hello" -> error, explicit constructor
b = Bar()
b.a = A("hello")
b.a = 1
b.a = 1.0
b.a = "hello" -> error, explicit constructor
Note that the last case, assigning a member var directly,
also requires the 'naturalvar' option.
This support now makes the old '%implicit' macro, which
was found in 'implicit.i' and it was fragile in many ways,
obsolete, and you should use the new '%implicitconv'
directive instead.
Note that we follow the C++ conventions, ie, in the
following the implicit conversion is allowed:
int get(A a) {return a.ii;}
int get(const A& a) {return a.ii;}
but not in these cases:
int get(A *a) {return a->ii;}
int get(A& a) {return a.ii;}
Also, it works for director methods that return a by value
result, ie, the following will work:
virtual A get_a() = 0;
def get_a(self):
return 1
but not in this case:
virtual const A& get_a() = 0;
virtual A& get_a() = 0;
virtual A* get_a() = 0;
Notes:
- the implicitconv mechanism is implemented by directly
calling/dispatching the python constructor, triggering a
call to the __init__method. Hence, if you expanded the
__init__ method, like in:
class A:
def __init__(self,args):
<swig code>
<my code here>
then 'my code' will also be executed.
- Since the %implicitconv directive is a SWIG feature, if you type:
%implicitconv;
that will enable implicit conversion for all the classes in
your module.
But if you are worried about performance, maybe that will be
too much, especially if you have overloaded methods, since
to resolve the dispatching problem, python will efectively
try to call all the implicit constructors as needed.
- For the same reason, it is highly recommended that you use
the new 'castmode' when mixing implicit conversion and
overloading.
- [python] The %implicit directive is declared obsolete, and
you should use %implicitconv instead. If you include
the implicit.i file, a warning will remind you of this.
Note: Since %implicit is fragile, just replacing it by
%implicitconv could lead to different behavior. Hence, we
don't automatically switch from to the other, and the user
must migrate to the new %implicitconv directive manually.
12/26/2005: wsfulton
[C#]
Modify std::vector wrappers to use std::vector::value_type as this is
closer to the real STL declarations for some methods, eg for push_back().
Fixes some compilation errors for some compilers eg when the templated
type is a pointer.
[Java]
std::vector improvements - a few more methods are wrapped and specializations are
no longer required. The specialize_std_vector macro is no longer needed (a
warning is issued if an attempt is made to use it).
12/26/2005: wsfulton
[Java, C#]
Add in pointer reference typemaps. This also enables one to easily wrap
std::vector<T> where T is a pointer.
12/24/2005: efuzzyone
[CFFI] The cffi module for SWIG:
- Fully supports C, but provides limited supports for C++, in
particular C++ support for templates and overloading needs to
be worked upon.
12/23/2005: mmatus
[python] Add the castmode that allows the python
type casting to occur.
For example, if you have 'int foo(int)', now
class Ai():
def __init__(self,x):
self.x = x
def __int__(self):
return self.x
foo(1) // Ok
foo(1.0) // Ok
foo(1.3) // Error
a = Ai(4)
foo(ai) // Ok
The castmode, which can be enabled either with the
'-castmode' option or the %module("castmode") option, uses
the new cast/rank dispatch mechanism. Hence, now if you
have 'int foo(int); int foo(double);', the following works
as expected:
foo(1) -> foo(int)
foo(1.0) -> foo(double)
ai = Ai(4)
foo(ai) -> foo(int)
Note1: the 'castmode' could disrupt some specialized
typemaps. In particular, the "implicit.i" library seems to
have problem with the castmode. But besides that one, the
entire test-suite compiles fine with and without the
castmode.
Note2: the cast mode can't be combined with the fast
dispatch mode, ie, the -fastdispatch option has no effect
when the cast mode is selected. The penalties, however,
are minimum since the cast dispatch code is already based
on the same fast dispatch mechanism.
See the file overload_dispatch_cast_runme.py file for
new cases and examples.
12/22/2005: mmatus
Add the cast and rank mechanism to dispatch overloading
functions. The UTF supports it now, but for each language
it must be decided how to implement and/or when to use it.
[perl] Now perl uses the new cast and rank dispatch
mechanism, which solves all the past problems known
in perl, such as the old '+ 1' problem:
int foo(int);
$n = 1
$n = $n + 1
$r = foo(n)
also works:
foo(1);
foo("1");
foo(1.0);
foo("1.0");
but fails
foo("l");
and when overloading foo(int) and foo(double);
foo(1) -> foo(int)
foo(1.0) -> foo(double)
foo("1") -> foo(int)
foo("1.0") -> foo(double)
foo("l") -> error
foo($n) -> foo(int) for good perl versions
foo($n) -> foo(double) for old bad perl versions
when overloading foo(int), foo(char*) and foo(double):
foo(1) -> foo(int)
foo(1.0) -> foo(double)
foo("1") -> foo(char*)
foo("1.0") -> foo(char*)
foo("l") -> foo(char*)
Note: In perl the old dispatch mechanism was broken,
so, we don't provide an option to enable the old one
since, again, it was really really broken.
See 'overload_simple_runme.pl' for more cases and tests.
PS: all the old known issues are declared resolved, any
new "problem" that could be discovered is declared,
a priori, as "features" of the new dispatch mechanism
(until we find another solution at least).
*** POTENTIAL INCOMPATIBILITY ***
As with the introduction of the UTF, some things could
now start to work as expected, and people used to deal or
workaround previous bugs related to the dispatch
mechanism, could see now a difference in perl behavior.
12/21/2005: mmatus
- The '-nodefault' flag (pragma and feature) now generates
a warning, and recommends to use the explicit
-nodefaultctor and -nodefaultdtor options.
The reason to split the 'nodefault' behavior is that, in
general, ignoring the default destructor generates memory
leaks in the target language. Hence, is too risky just to
disable both the default constructor and destructor
at the same time.
If you need to disable the default destructor, it is
also recommended you use the directive form:
%nodefaultdtor MyVerySpecialClass;
for specific classes, and always avoid using the global
-nodefault and -nodefaultdtor options.
12/21/2005: wsfulton
[Java, C#]
Fix incorrect code generation when the intermediary classname is changed
in the module directive from its default. For example:
%module(jniclassname="myimclassnewname") "mymodule" // Java
%module(imclassname="myimclassnewname") "mymodule" // C#
Add in new special variable $imclassname. See docs.
12/17/2005: mmatus
[Python]
- Add the -aliasobj0/-noaliasobj0 options to use with
-fastunpack and/or -O and old typemaps that use 'obj0'
directly.
So, if you compile your code using -O and get errors about
the undeclared 'obj0' variable, run again using
swig -O -aliasobj0 -python ....
For new typemaps, never use 'obj0' directly, if needed,
use the '$self' name that will be properly expanded to
'obj0' (nofastunpack) or 'swig_obj[0]' (fastunpack).
If you have no idea what I am talking about, better, that
means you have no typemap with this problem.
12/14/2005: mmatus
[Python]
- Add the -fastunpack/-nofastunpack options to enable/disable
the use of the internal UnpackTuple method, instead of
calling the one from the python C API.
The option -O now also implies -fastunpack.
12/11/2005: mmatus
[Python]
- Add the -proxydel/-noproxydel options to enable/disable
the generation of proxy/shadow __del__ methods, even
when now they are redundant, since they are empty.
However, old interfaces could rely on calling them.
The default behavior is to generate the __del__ methods
as in 1.3.27 or older swig versions.
The option -O now also implies -noproxydel.
12/10/2005: mmatus
[UTF]
- Fix unnecessary calls to SWIG_TypeQuery for 'char *'
and 'wchar_t *', problem found by Clay Culver while
profiling the PyOgre project.
[Python]
- Add the -dirvtable/-nodirvtable to enable/disable
a pseudo virtual table used for directors, avoiding
the need to resolve the python method at each call.
- Add the -safecstrings/-nosafecstrings options to
enable/disable the use of safe conversions from PyString
to char *. Python requires you to never change the internal
buffer directly, and hence 'safectrings' warranties that
but returning a copy of the internal python string buffer.
The default, as in previous releases, is to return a
pointer to the buffer (nosafecstrings), so, it is the user's
responsibility to avoid its modification.
- Add the -O option to enable all the optimization options
at once, initially equivalent to
-modern -fastdispatch -dirvtable -nosafecstrings -fvirtual
12/08/2005: mmatus
- Add the -fastdispatch option (fastdispatch feature). This
enables the "fast dispatch" mechanism for overloaded
methods provided by Salvador Fandi~no Garc'ia (#930586).
The resulting code is smaller and faster since less type
checking is performed. However, the error messages you
get when the overloading is not resolved could be
different from what the traditional method returns.
With the old method you always get an error such as
"No matching function for overloaded ..."
with the new method you can also get errors such as
"Type error in argument 1 of type ..."
See bug report #930586 for more details.
So, this optimization must be explicitly enabled by users.
The new mechanism can be used as:
swig -fastdispatch
or using the feature form
%feature("fastdispatch") method;
or
%fastdispatch method;
12/06/2005: mmatus
- Several memory and speed improvements, specially for
templates. Now swig is up to 20 faster than before for
large template interfaces, such as the std_containers.i
and template_matrix.i files in the python test-suite.
Memory footprint is also reduced in consideration of small
pcs/architectures.
- add commandline options -cpperraswarn and -nocpperraswarn" to force
the swig preprocessor to treat the #error directive as a #warning.
the pragmas
#pragma SWIG cpperraswarn=1
#pragma SWIG cpperraswarn=0
are equivalent to the command line options, respectively.
12/06/2005: mmatus
[Python] The generated code is now more portable, especially
for Windows. Following
http://www.python.org/doc/faq/windows.html
Py_None is never accessed as a structure, plus other
tricks mentioned there.
12/06/2005: mmatus
[Python] Added initial support for threads based in the
proposal by Joseph Winston.
The user interface is as follows:
1.- the module thread support is enable via the "threads" module
option, i.e.
%module("threads"=1)
2.- Equivalent to that, is the new '-threads' swig option
swig -threads -python ...
3.- You can partially disable thread support for a given
method using:
%feature("nothread") method;
or
%nothread method;
also, you can disable sections of the thread support,
for example
%feature("nothreadblock") method;
or
%nothreadblock method;
%feature("nothreadallow") method;
or
%nothreadallow method;
the first disables the C++/python thread protection, and the
second disables the python/C++ thread protection.
4.- The current thread support is based in the PyGIL
extension present in python version 2.3 or later, but
you can provide the thread code for older versions by
defining the macros in pythreads.swg.
If you get a working implementation for older versions,
please send us a patch.
For the curious about performance, here are some numbers
for the profiletest.i test, which is used to check the speed
of the wrapped code:
nothread 9.6s (no thread code)
nothreadblock 12.2s (only 'allow' code)
nothreadallow 13.6s (only 'block' code)
full thread 15.5s ('allow' + 'block' code)
i.e., full thread code decreases the wrapping performance by
around 60%. If that is important to your application, you
can tune each method using the different 'nothread',
'nothreadblock' or 'nothreadallow' features as
needed. Note that for some methods deactivating the
'thread block' or 'thread allow' code is not an option,
so, be careful.
11/26/2005: wsfulton
SWIG library files use system angle brackets everywhere for %include, eg
%include "std_common.i"
becomes
%include <std_common.i>
11/26/2005: wsfulton
[Java, C#]
Typesafe enums and proper enums have an extra constructor so that enum item values that
are initialised by another enum item value can be wrapped without having to use %javaconstvalue/
%csconstvalue for when using %javaconst(1)/%csconst(1). Suggestion by
Bob Marinier/Douglas Pearson.
For example:
typedef enum
{
xyz,
last = xyz
} repeat;
11/21/2005: mmatus
[ruby + python]
Fixes for directors + pointers. This is an ugly problem without an easy
solution. Before we identified this case as problematic:
virtual const MyClass& my_method();
but it turns out that all the cases where a pointer, array or
reference is returned, are problematic, even for
primitive types (as int, double, char*, etc).
To try to fix the issue, a new typemap was added,
'directorfree', which is used to 'free' the resources
allocated during the 'directorout' phase. At the same
time, a primitive garbage collector engine was added to
deal with orphaned addresses, when needed.
The situation is much better now, but still it is possible to have
memory exhaustation if recursion is used.
So, still you need to avoid returning pointers, arrays or
references when using director methods.
- Added stdint.i - typemaps for latest C99 integral types found in stdint.h.
11/14/2005: wsfulton
More types added to windows.i, eg UINT8, WORD, BYTE etc.
Including windows.i will also enable SWIG to parse the __declspec Microsoft
extension, eg __declspec(dllimport). Also other Windows calling conventions
such as __stdcall.
11/10/2005: wsfulton
New library file for Windows - windows.i. This file will contain useful type
information for users who include windows.h. Initial support is for the
non ISO integral types: __int8, __int16, __int32, __int64 and unsigned versions.
The unsigned versions previously could not be parsed by SWIG. SF #872013.
11/09/2005: wsfulton
[Java, C#] Portability warning for files which will overwrite each other on case
insensitive file systems such as FAT32/NTFS. This will occur, for example, when two
class names are the same barring case. The warning is issued on all platforms and
can be suppressed with the usual warning suppression techniques. SF bug #1084507.
11/09/2005: wsfulton
./configure --with-python --with-ruby --with-perl5 etc enable these languages,
ie the --with-xxxx options, where no path is specified, work the same as if
the option was not specified at all. Based on patches #1335042 #1329048 #1329047.
11/09/2005: dancy
[Allegrocl]
Add C++ support to the Allegrocl module. Further
enhances the C support as well. Some of the
features:
- MUCH better generation of foreign types based on
the C/C++ types for use in defining the FFI on
the lisp side. We don't pass everything as a (* :void)
any longer.
- Uses typemaps for better control of type conversions
and code generation in the generated lisp and c++ wrapper
code.
- CLOS wrapping of pointers returned from foreign space
makes it easier to differentiate pointers in user code.
The wrapping objects can be passed directly to FF calls.
- Defun wrapping of FF calls, allowing for more lispy
interface. Conversion, GCing, of lisp objects to
foreign objects can be done in the wrapping defun via
the use of typemaps.
- overload dispatching implemented on the lisp side
using generic functions.
- Templates and synonymous types supported.
11/07/2005: mmatus
[Python] Adding proper support for multi-inheritance in
the python side, ie, if you have two C++ wrapped class, Foo
and Bar, now:
class MyPythonClass(Foo,Bar):
....
will properly work, even with directors, and the
deallocation of Foo.this and Bar.this will follow
correctly. Before, a class could only have one 'this'
instance (unlike C++), only the last base class was
properly deleted, or detected with directors.
Now 'self.this' can be a list, which will contain the C++
instance pointers for all the base classes.
Also, swig.this is responsible for deallocating the C++
instance(s), and the __del__ method is not emitted unless
the user preppend/append some code to it.
- Swig can now detect memory leaks, ie, if you still
don't use proxy/shadow classes, and type something like
import _example
f = _example.new_Foo()
and forget to call _example.delete_Foo(f), then swig will
tell you that there is a memory leak.
Otherwise, if you always use the proxy classes, you probably
you will never ever see this warning unless there is
something wrong inside the swig wrapping code.
*** POTENTIAL INCOMPATIBILITY ***
If you overloaded the __del__ method, and call the base
one without a try block, as in
class MyClass(SwigClass):
def __del__(self):
<your code here>
SwigClass.__del__(self)
python could complain that the method SwigClass.__del__ is
undefined. Try to use instead:
def __del__(self):
<your code here>
try: SwigClass.__del__(self)
except: pass
or simply
def __del__(self):
<your code here>
11/02/2005: mmatus
[Python] Adding more fun to STL/STD containers, now you
can do
%template(pyset) std::set<PyObject *>;
%template(pyvector) std::vector<PyObject *>;
%template() std::pair<PyObject *,PyObject *>;
%template(pyvector) std::map<PyObject *,PyObject *>;
....
The same applies to std::list, std::deque, std::multiset, etc.
Then, at the python side you can do now:
# C++ std::vector as native python sequence
v = pyvector([1,"hello",(1,2)])
print v[1]
>> 'hello'
print v[2]
>> (1,2)
# C++ std::set as native python sequence
s = pyset()
s.insert((1,2))
s.insert(1)
s.insert("hello")
sum=()
for i in s:
sum +=(i,)
print sum
>>> (1, 'hello', (1, 2))
# C++ std::map as native python sequence
m = pymap()
m["foo"] = "hello"
m[1] = (1,2)
pm = {}
for k in m:
pm[k] = m[k]
print pm
>>> {1: (1, 2), 'foo': 'hello'}
ie, the STD/STL containers work as real native python
container, with arbitrary item types and so.
But since normal C++ containers do not properly ref/unref
their items, you should use the safer versions:
%template(pyset) std::set<swig::PyObject_ptr>;
%template(pyvector) std::vector<swig::PyObject_ptr>;
%template() std::pair<swig::PyObject_ptr, swig::PyObject_ptr>;
%template(pyvector) std::map<swig::PyObject_ptr,swig::PyObject_ptr>;
....
where swig::PyObject_ptr is a PyObject * envelope class provided
to safely incref/decref the python object.
So, now you can use all the STL/STD containers as native
Python containers.
Note 1: std::map, std::set and the other 'ordered'
containers will properly use PyObject_Compare for sorting,
when needed.
Note 2: all the STL/STD containers have a limit size of
SIZE_MAX, ie, you can have manage containers larger than
INT_MAX, the python limit.
11/02/2005: mmatus
[Python]
- add 'iterator()' method for all sequences and additionally
'key_iterator()' for maps.
'iterator()' will always return the native C++ iterator.
Additionally, in maps, 'key_iterator()' will return a python
iterator using only the map keys.
In general the sequence method __iter__ will call
'iterator()', returning the native C++ iterator, but in
maps it will call 'key_iterator()', maintaining
backward compatibility.
Hence, for std::maps, you can play then with the native
C++ iterator, which value is a (key, value) pair, by
calling map.iterator(), as with map.begin(), map.end(), etc.
The difference is that map.iterator() returns a safe
'closed' iterator, while map.begin() and map.end() are
'open' iterators.
A 'closed' iterator knows the begin and the end of the
sequence, and it never can seg. fault. An 'open'
iterator, as in C++, can seg. fault at the C++ side.
# a closed iterator is safe in the following example.
# the next() method will throw a StopIteration
# exception as needed
i = seq.iterator()
try:
while True:
sum += i.next()
except: pass
# an open iterator always need to be checked,
# or it will crash at the C++ side
current = seq.begin()
end = seq.end()
while (current != end):
sum += current.next()
[Python]
- Finally, when we call
f = Foo()
the construction is 'one-way'. Before construction was done
something like
Foo() (python) -> _new_Foo() (C++)
new_Foo() (C++) -> FooPtr() (python)
FooPtr() (python) -> Foo() (python)
and returning a pointer was done like
NewPointerObj() (C++) -> FooPtr() (python)
FooPtr(python) -> Foo() (python)
ie, we when going back and forward between the C++ and
python side.
Now since there is no FooPtr the construction process is
Foo() (python) -> _new_Foo() (C++)
_new_Foo() (C++) -> NewPointerObj() (C++) (no shadow class)
and returning a pointer is done
NewPointerObj() (C++) (with shadow class) -> NewInstaceObj() (C++)
where NewInstanceObj creates a new instance without
calling __init__ and it doesn't go 'back' to python, is
'pure' C API.
- With this change, and the other ones in the
PySwigObject type, which now carries the thisown and
swig_type_info pointer, the generated code should be as
fast as boost::Python and/or the other python wrappers
based in pure Python/C API calls.
As a reference, the profiletest_runme.py example, which
does a simple call function many times, such as this code:
import profiletest
a = profiletest.A()
b = profiletest.B()
for i in range(0,1000000)
a = b.fn(a)
where fn is defined as 'A* B::fn(A *a) {return a;}',
produces the following times
nomodern modern
swig-1.3.26 19.70s 5.98s
swig-CVS 0.99s 0.98s
Clearly, there is a large improvement for the python
'nomodern' mode. Still, the 'modern' mode is around
6 times faster than before. For the same test, but
using the non-shadow version of the module, we get
_profiletest (non-shadow)
swig-1.3.26 0.80s
swig-CVS 0.60s
Hence, now for practical purposes, the proxy overhead
is insignificant.
Note that the performance numbers we are showing is for
a simple module (two types) and a simple function (one
argument). For real situations, for modules with many
more types and/or functions with many more parameters,
you will see even better results.
10/31/2005: mmatus
[Python]
- Finally, no more ClassPtr proxy classes. You will see
only a clean Class proxy class in the .py file.
- No more 'real' thisown attribute either, the PySwigObject now
carries the ownership info.
You can also do something like
print self.this.own()
>>> True
self.this.disown()
self.this.own(0)
print self.this.own()
>>> False
self.this.acquire()
self.this.own(1)
print self.this.own()
>>> True
Still the old way,
print self.thisown
>>> True
self.thisown = 0
print self.thisown
>>> False
self.thisown = 1
print self.thisown
>>> True
is supported, and python dispatches the proper method
calls as needed.
- Support for iterators in STL/STD containers, for example, if you have
%template<set_string> std::set<std::string>;
you can use the C++ iterators as:
s = set_string()
s.append("c")
s.append("a")
s.append("b")
b = s.begin()
e = s.end()
sum = ""
while (b != e):
sum += b.next()
print sum
>>> "abc"
advance the iterator as in C++
current = s.begin()
current += 1
print current.value()
>>> "b"
now using the reverse operators
b = s.rbegin()
e = s.rend()
sum = ""
while (b != e):
sum += b.next()
print sum
>>> "cba"
or the 'previous' method
b = s.begin()
e = s.end()
sum = ""
while (b != e):
sum += e.previous()
print sum
>>> "cba"
or just as in a python fashion
for i in s:
sum += i
Note 1: Iterators in C++ are very powerful, but
dangerous too. And in python you can shoot yourself in the foot
just like in C++, so, be careful.
Note 2: the iterators are 'light', ie, they do not
convert sequence elements until you request to do so, via
next(), value() or previous(). If you just increment/decrement one
no conversion is performed, for example:
b = s.begin()
b += 1
b.incr()
b.incr(2)
b.decr(2)
b.decr()
b -= 1
only the iterator is modified, and not value wrapper
is generated. Other typical C++ operations are also
available, such as:
print s.end() - s.begin()
>>> 3
f = s.begin() + 1
print f.value()
>>> "b"
l = s.end() - 1
print l.value()
>>> "c"
etc. Of course, the 'find', 'insert', 'erase', and
so on methods also supports iterators now, ie:
i = s.begin()
i += 1
s.erase(i)
for i in s:
sum += i
print sum
>>> "ac"
*** POTENTIAL INCOMPATIBILITY ***
There is no more 'thisown' attribute. If you use it, python
will translate the following code as follows:
if (self.thisown): ==> if (self.this.own()):
self.thisown = 1 ==> self.this.own(1)
self.thisown = 0 ==> self.this.own(0)
Still, maybe in some unusual cases the translation will not be
100% correct, so if you have a problem, please report it
and/or use the new 'self.this.own()' accessor.
*** POTENTIAL INCOMPATIBILITY ***
There is no more ClassPtr classes in the python code. Hence,
if in the past you needed to resort to some kind of trickery
with them, or overcome their presence, it is no longer
required, but the extra code you added could now break
things.
If needed, you can use the option -classptr, i.e.,
swig -classptr -python ...
to generate the old ClassPtr classes.
10/30/2005: mkoeppe
[Guile] Make declared and defined linkage of SWIG_init consistent.
Reported by Steven G. Johnson (SF patch 1315498).
10/26/2005: mmatus
- Added the attribute.i file to the global library director.
Now it can be used from other languages that do not use
the unified typemap library as well.
So, if you have something like:
%include attribute.i
%attribute(A, int, a, get_a, set_a);
struct A
{
int get_a() const;
void set_a(int aa);
};
%attribute_ref(B, int, c);
struct B
{
int& c();
};
then in the target language the 'A.a' and 'B.c' attributes will
be visible, ie, you can access them as plain variables:
f = A()
f.a = 3
g = B()
g.c = 3
h = f.a + g.c
and the proper get/set methods will be dispatched. See
attribute.i for more info.
- More cleanups around and adding more test-cases. The
DISOWN typemap now is tested and working in all the
languages that use the unified typemap library, ie, tcl,
ruby, perl and python.
10/25/2005: mmatus
- Perl, complete the DISOWN typemap.
- added the attribute.i file to the unified typemap
library (before was only usable from python).
- unify the names for the setter and getter methods in
perl,tcl,ruby and python, so, the attribute.i library
can work across them.
- see the li_attribute.i test-case or the library file
Lib/typemaps/attribute.swg
for more info about how to use it.
10/24/2005: mmatus
- Perl now uses the unified typemap library.
- Changes in ruby to use the $track option in typemaps.
- Changes in the unified typemap library to follow the
convention that all macros that are not used in the
C/C++ side starts with %, such as
%delete
%new_array
etc.
- Documenting fragments, see fragments.swg.
- Cleaner way to use the unified typemap library, include
just <typemaps/swigtypes.swg>.
Check some of the supported languages: perl, tcl, ruby,
python.
Always start with the head file, such as
python/python.swg
tcl/tcl8.swg
ruby/ruby.swg
perl5/perl5.swg
and the principal file that invokes the unified library, such as
python/pytypemaps.swg
tcl/tcltypemaps.swg
ruby/rubytypemaps.swg
perl/perltypemaps.swg
The file that provide the specialization for each
language are the one that provides the basic types:
python/pyprimtypes.swg
ruby/rubyprimtypes.swg
tcl/tclprimtypes.swg
perl5/perlprimtypes.swg
and the string manipulation:
python/pystrings.swg
ruby/rubystrings.swg
tcl/tclstrings.swg
perl5/perlstrings.swg
The rest of the files, such as carray.i, are mostly one
line files that include the proper typemap library
version.
*** POTENTIAL INCOMPATIBILITY in Perl ***
Some missing/wrong typemaps could start working properly,
and change the old expected behavior in Perl.
10/23/2005: wuzzeb
Chicken:
+ pointers to member functions finally work properly
+ add test of member function pointers to cpp_basic.i
10/20/2005: dancy
[allegrocl] Added C++ support. Large update, many changes. See
newly added Allegro Common Lisp section in lisp.html
10/20/2005: mmatus
Ruby, Tcl, Python:
- Uniform way to fail (label fail:), now finally
SWIG_exception works across the three languages and all
the typemaps.
- Add proper cleanup code to ruby
- More valgrind fixes
- Simplify the inline use, it seems a small interface of
20,000 lines (plus many many templates) can break
gcc -O3 easily.
- Finalize the typemaps library. All the old *.i files
(carray.i, cpointer.i, exception.i) had been implemented
in the new typemaps library.
10/19/2005: wuzzeb
Update the Runtime Typemap documentation in Typemaps.html
10/18/2005: wuzzeb
Chicken:
- Correctly handle %ignored classes
- Correctly convert long, long long, unsigned long, etc
to chicken primitives. (Thanks to Felix Winkelmann)
- Using argout parameters when the return value was a
wrapped pointer caused a memory corruption. The chicken
garbage collector moved a pointer out from under us.
This is now fixed by running all the proxy creation
functions as continuations after the wrapper function
returns. As part of this, we no longer need the
chickenfastproxy flag on output typemaps.
- using -proxy and -nocollection together works now
Before, it was not exporting the destructor in the proxy
wrapper.
10/18/2005: mmatus
Added the Unified Typemap Library (UTL). It unifies the typemaps for
python, ruby, tcl
and in the process, fixes several problems in each of the three
languages to work in a "canonical" way now established in
the typemap library
SWIG/Lib/typempas
The current status of the unification is that everything
compiles and runs inside the test-suite and examples
directories. And for the first time we have three
languages than pass the primitive_types.i case.
Also, we have a uniform way to treat the errors, for example
if you do something like
>>> from primitive_types import *
>>> print val_uchar(10)
10
>>> print val_uchar(1000)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
OverflowError: in argument 1 of type 'unsigned char'
you get the same exception in all the three languages.
And well, many more good things will come from this
unification, for example, proper support of the STL/STD classes
for all the languages, and hopefully, we can keep
adding other languages.
The hardest part, writing a common typemap library
that suites the three different languages, is done,
and adding another language should now be easy.
Still the global unification is not complete, the STL/STD
part is next, and probably as well as adding one or two more
languages.
If you are curious, look at the python, ruby and/or tcl
directories to see what is needed to support the new
common typemaps library. Still, the final way to
integrate a new language could change as we move to
integrate the STD/STL.
*** POTENTIAL INCOMPATIBILITY in Ruby/Tcl ***
Some missing/wrong typemaps could start working properly,
and change the old behavior, specially in ruby and tcl.
Version 1.3.27 (October 15, 2005)
=================================
10/15/2005: wsfulton
[Java] Fix for typesafe enum wrapping so that it is possible to
overload a method with 2 different enum types.
10/15/2005: wsfulton
Fix for %feature("immutable","0") attempting to generate setters
for constants.
Restored %immutable and %makedefault to clear the feature as it
behaved in SWIG-1.3.25 and earlier.
10/14/2005: mmatus
Fix bug in anonymous typedef structures which was leading to
strange behaviour.
10/13/2005: mmatus
Several minor changes:
- Improve the wchar_t type support
- Add a warning for when you define the 'in' typemap but
you don't define the 'typecheck' one. Very common mistake.
- Add proper default rule for function pointers, now you
can define a typemap such as:
%typemap(in) SWIGTYPE ((*)(ANY)) {...}
That will apply to all the pointer to functions. The
rule in C++ also apply to the function 'reference', ie,
in both cases
typedef int (*fptr)(int a);
typedef int (func)(int a);
This was needed since it seems to be 'illegal' in C++ to
do something like:
void *ptr = static_cast<void *>(fptr);
and probably, as for member functions, it is not
warrantied that the pointer sizes will match.
- Add the #error/#warning directives to swig's cpp.
- Add the noblock option for typemaps, which is used as
follows: supposed you a typemap, like this
%typemap(in,noblock=1) Hello {
....
}
then the typemap will be inserted without the block
imposed by the brackets, similar to
%typemap(in) Hello "..."
So, why you don't just use the quote style?, because:
1.- The quote style doesn't get preprocessed, for example
%typemap(in) Hello "$1= SWIG_macro($1);"
here, SWIG_macro doesn't get expanded
2.- Inside a quote typemap, you have to use
quotes carefully
%typemap(in) Hello "$1 = \"hello\" "
3.- You can't make emacs and/or other editors
to indent inside a string!.
So, why do you want to remove the block?, because an extra
block when not needed (no local variables in it):
1.- makes the code harder to read
2.- makes the code larger
3.- or in short, for the same reason we have the quote style.
Version 1.3.26 (October 9, 2005)
================================
10/08/2005: wsfulton
[Php] Added 'throws' typemaps.
10/08/2005: wsfulton
Fixes for languages that don't support multiple inheritance. The
first non-ignored class in the public base class list is used for inheritance.
by the proxy class. Previously, if the first class in the list was ignored, then
the proxy class wouldn't have any base classes.
10/07/2005: mmatus
Update more features to follow new convention, including:
callback
ref/unref
except
All of them use not only the feature as a flag, but also
as code value. To deal with those features, we use now
GetFlagAttr, which is similar to GetFlag, but instead or
returning 1 or 0, it returns the attr value, if happens
to be different of "0" of course.
Now there are also more uniform directive names for the
ones based in features, for example, for the old
%newobject directive now we have tree directives defined:
#define %newobject %feature("new")
#define %nonewobject %feature("new","0")
#define %clearnewobject %feature("new","")
and so on for all the other feature directives.
*** POTENTIAL INCOMPATIBILITY ***
09/30/2005: wsfulton
Subtle change to some features. Previously it was not possible to disable many
features once they had been enabled. This was for most features that behave as
flags. These features now work as follows:
%feature("name") // enables the feature
%feature("name", "1") // enables the feature
%feature("name", "0") // disables the feature
%feature("name", "") // clears the feature
In fact any non-empty value other than "0" will enable the feature (like C boolean logic).
Previously "1", "0" or any other non-empty value would enable the feature and it would
only be possible to disable the feature by clearing it (assuming there was no global enable).
The following features are affected:
allowexcept
compactdefaultargs
classic (Python)
cs:const (C#)
director
exceptionclass (Python)
ignore
immutable
java:const (Java)
java:downcast (Java)
kwargs
modern (Python)
new
noautodoc (Python)
nodefault
nodirector
noref
notabstract
nounref
novaluewrapper
python:maybecall (Python)
python:nondynamic (Python)
modula3:multiretval (Modula3)
predicate (Ruby)
trackobjects (Ruby)
valuewrapper
It is now possible, for example to ignore all methods/classes in a header file, except for a
few targetted methods, for example:
%feature("ignore"); // ignore all methods/classes
%feature("ignore","0") some_function(int, double); // do not ignore this function
%feature("ignore","0") SomeClass; // do not ignore this Class
%feature("ignore","0") SomeClass::method; // do not ignore this method
%include "bigheader.h"
Removed %pythondynamic - it never worked properly. Use %pythonnondynamic instead.
Removed %feature("nokwargs") - it wasn't fully implemented - use %feature("kwargs","0") instead.
*** POTENTIAL INCOMPATIBILITY ***
09/25/2005: mkoeppe
[Guile] Add "throws" typemaps.
09/24/2005: cfisavage
[Ruby] Adds new %trackobjects functionality that maps C++ objects to
Ruby objects. This functionality makes it much easier to implement
mark functions for the garbage collector. For more information
refer to the update documentation and examples.
09/20/2005: wsfulton
[Perl] Patch 1116431 from Josh Cherry. Fixes non member functions inadvertently
being called instead of member functions.
09/20/2005: wsfulton
[Lua] Patch from Mark Gossage to add support for Lua-5.1, std::string,
std::vector, std::exception and documentation.
09/14/2005: mmatus
[Python] Add -nocppcast. Now the default behavior is to
always use the cppcast operators. Before that was the case
only when you used the -cppcast option.
If this seems to break your code... your welcome!, it
means it was broken before, and you never notice.
If you thing the error is due to one of the SWIG typemaps,
send us an example.
Use -nocppcast only with very old C++ compilers that
do not support the cppcast operations.
So, here applies:
This change doesn't break compatibility, it was broken before.
09/13/2005: wsfulton
[Java] Fix for director methods when a class is passed by value as a
parameter.
09/11/2005: mmatus
Adding the module option to the %import directive. Now you
can use it as
%import(module="BigModule") foo.i
where subfile could (or not) define the module name via
the %module directive. The module option take precedence
and it has the same effects than having the directive
%module BigModule
inside the imported file foo.i.
You can use the option in mainly two cases:
1.- You used the -module option when you generated the
module to be imported, and hence the module name in
the imported %module directive is not really useful.
2.- The module you want to import is very large, and it
has several .i/.h files. Then, if you just one to
import a class or so from the module, says 'foo', and
not the entire module via importing the main
BigModule.i file, then you just do:
%import(module="BigModule") foo.h
or
%import(module="BigModule") foo.i
where foo.i contains the 'foo' declaration and maybe a
couple of extra %include directives, as needed.
09/11/2005: mmatus
Fix bug #1282637, about the -module option not having effect
in places where it was needed.
09/11/2005: wsfulton
When wrapping variables, ensure that none of the typemaps used for the
set wrappers are used when generating the get wrappers. I doubt this was a
problem for any languages except for the recently introduced null attribute
in the out typemap (C# only).
09/08/2005: wsfulton
More descriptive error messages when files fail to open.
09/06/2005: mmatus
Allow a %define a macro inside another %define macro, for example
%define hello(name, Type)
%define name ## a(Type)
%typemap(in) Type "hello;"
%enddef
%enddef
To learn how to use this new features in your own typemaps library, see
python/cstring.i, python/cwstring.i and python/cwstrbase.i.
[Python] Normalize the cstring.i implementation to use fragments, and add
cwstring.i, which implements the same typemaps but for wchar_t strings.
[Python] Bug fixed: 1247477, 1245591, 1249878 and others.
08/18/2005: wsfulton
[Ruby] Implement support for SWIGTYPE* DISOWN typemap (like in Python) for
better control of memory management, eg when adding an object created in Ruby
to a C++ container. Patch #1261692 from Charlie Savage.
08/18/2005: wsfulton
[Tcl] 64 bit platform fixes for the varargs handling in SWIG_GetArgs. This is an
improved fix for bug #1011604 as suggested by Jeremy Lin.
08/18/2005: wsfulton
[Tcl] Bug #1240469 - %newobject support for Tcl. Patch from Bob Marinier.
08/16/2005: wsfulton
[Perl] Bug #1254494 - Fix for global namespace pollution by perl header files
(bool define) prevented STL headers from being used on some systems, eg
Windows with Visual Studio.
08/16/2005: wsfulton
[Java] Bug #1240937 - Redefinition of __int64 typedef for Intel compilers.
08/15/2005: wsfulton
[Xml] Bug #1251832 - C++ template may generate invalid XML file
08/15/2005: wsfulton
[Lua] Support added for Lua. Patch #1242772 from Mark Gossage.
It supports most C/C++ features (functions, struct, classes, arrays, pointers,
exceptions), as well as lots of documentation and a few test cases & examples.
08/14/2005: wsfulton
[Xml] Fix incorrect xml escaping in base class name when base class is a template.
08/13/2005: efuzzyone
[CLISP] Added support for handling enums. Does not adds the return type declaration
to the function definition, if a function returns void.
08/09/2005: mkoeppe
New language module, Common Lisp with UFFI, from Utz-Uwe Haus.
08/09/2005: mkoeppe
Fix the Lisp s-expression output module; it no longer complains about "unknown targets".
07/27/2005: wsfulton
Modifications to STL wrappers so that it is possible for a user's %exception directive
to be applied to the STL wrapper methods. Previously the following global %exception
directive would not be used on the wrapper methods:
%exception {
try {
$action
} catch (...) {
// handle uncaught exceptions
}
}
This has been implemented by replacing %exception directives for specific STL wrapper
methods with an exception specification declared on the wrapper methods. throws typemaps
are now supplied for handling the STL exception specification. These can also be easily
overridden, for example the std::out_of_range exception, which is used a lot in the STL
wrappers, can be customised easily:
%include "std_vector.i"
%typemap(throws) std::out_of_range {
// custom exception handler
}
%template(VectInt) std::vector<int>;
07/22/2005: efuzzyone
[CLISP] The clisp module for SWIG:
- It can only handle C, clisp currently does not supports ffi bindings to C++.
- It has two options, (a) -extern-all this will generate wrappers for all functions
and variablestions, (b) -generate-typedef this will generate wrappers "def-c-type"
wrappers for typedefs
- Can handle pointers to functions, complex types such as n-dimensional arrays of
pointers of depth d
- Generates wrappers for constants as well as variables
- Correctly distinguishes between the declaration of variables in structures and functions
- Creates a defpackage "declaration" with the module name as the package name, the created
package exports both functions and variables
- tries to guess when should a pointer variable be declared as c-ptr or c-pointer
07/22/2005: wsfulton
[C#] Changes to support C# structs returned by value. The changes required are:
- Using an optional 'null' attribute in the out typemap. If this attribute is specified,
then it is used for the $null special variable substitution.
- The ctype used in the C/C++ wrappers is no longer initialised to 0 on declaration.
Both of these changes fix the situations where an attempt was made to assign 0 to the
returned struct. Marshalling structs as value types still requires user defined typemaps.
See documentation for an example.
07/22/2005: wsfulton
[C#, Java] Fix SWIG_exception usage to work with compilers that don't support empty macro
arguments. Unfortunately this fix will stop usage of SWIG_exception being used within typemaps
that use "" or %{ %} delimiters, but continues to work with typemaps using {} delimiters.
Please use the SWIG_CSharpSetPendingExceptionArgument or SWIG_JavaThrowException methods instead
as SWIG_exception is really intended as a platform independent macro for the SWIG library writers.
07/16/2005: mkoeppe
[Allegro CL] Use specific foreign types rather than (* :void).
Use *swig-identifier-converter*.
06/27/2005: wsfulton
Functions declared as 'extern' no longer have an additional function declaration added to the
wrapper files. There are some cases where SWIG does not get this right, eg bug #1205859 (extern
functions with default arguments declared in a namespace). Also SWIG cannot get non-standard
calling conventions correct, eg Windows calling conventions are usually handled like this:
%{
#define DLLIMPORT __declspec(dllimport)
#define STDCALL __stdcall
%}
#define DLLIMPORT
#define STDCALL
%inline %{
DLLIMPORT extern STDCALL void function(int);
%}
SWIG incorrectly generates:
extern void function(int);
To which there is no solution as SWIG doesn't handle non-standard calling conventions. The extra
'extern' function that SWIG generates is superfluous unless a user has forgotten to add the function
declaration into the wrappers.
The -noextern commandline argument is now redundant and a new commandline argument -addextern can
be used to obtain the original behaviour. This shouldn't be necessary unless the header file
containing the function declaration was inadvertently not added to the wrappers. To fix this
add the function declaration into your wrappers, For example, replace:
extern void foo(int);
with:
%inline %{
extern void foo(int);
%}
*** POTENTIAL INCOMPATIBILITY ***
06/22/2005: wsfulton
[C#, Java, Modula3, Ocaml]
The intermediary function names have been changed when wrapping variables to
match the other language modules so that %extend for a member variable works
uniformly across all language modules, eg:
%extend ExtendMe {
Var;
};
%{
void ExtendMe_Var_set(ExtendMe *, double) {...}
double ExtendMe_Var_get(ExtendMe *) {...}
%}
The methods implementing the get/set used to be:
%{
void set_ExtendMe_Var(ExtendMe *, double) {...}
double get_ExtendMe_Var(ExtendMe *) {...}
%}
This also changes the name of variable wrapper functions when using -noproxy.
The original names can be generated with the -oldvarnames commandline option.
*** POTENTIAL INCOMPATIBILITY ***
Version 1.3.25 (June 11, 2005)
==============================
06/11/2006: mkoeppe
[Guile] Fix handling of anonymous-enum variables.
06/10/2005: mkoeppe
[Guile] Fix for function arguments that are passed by
copy-of-value. Fix for global "const char *" variables.
Fix testcases arrays_dimensionless, arrays_global.
06/08/2005: wsfulton
Fix for when a base class defines a symbol as a member variable and a derived class defines
the same symbol as a member method.
06/08/2005: wsfulton
[C#] More fixes for virtual/new/override modifiers - when a method has protected access
in base and public access in derived class.
06/02/2005: wsfulton
Fix #1066363 - Follow convention of release tarball name matching directory name.
06/02/2005: wsfulton
[C#, Java] Fix #1211353 - typesafe enums (and Java proper enums) wrappers when enum value
is negative.
05/27/2005: wsfulton
Modernised and tidied up Windows macros --> SWIGEXPORT, SWIGSTDCALL. They can be overridden
by users via -D compiler directives if need be.
05/26/2005: wsfulton
%csmethodmodifiers can be applied to variables as well as methods now.
In addition to the default 'public' modifier that SWIG generates, %csmethodmodifiers will also
replace the virtual/new/override modifiers that SWIG thinks is appropriate. This feature is
useful for some obscure cases where SWIG might get the modifiers incorrect, for example
with multiple inheritance and overriding a method in the base class.
*** POTENTIAL INCOMPATIBILITY FOR C# MODULE ***
05/25/2005: wsfulton
Added missing constructors to std::pair wrappers (std_pair.i) for all languages.
05/25/2005: wsfulton
[C#] Added std::pair wrappers in std_pair.i
05/25/2005: wsfulton
[C#] The C# 'new' and 'override' modifiers will be generated when a C++ class inherits methods
via a C++ 'using' declaration.
05/25/2005: wsfulton
Fix for exception specifications previously being ignored in classes that inherited methods
from 'using' declarations, eg calls to Derived::bar below will convert C++ exceptions into
a target language exception/error, like it always has done for Base::Bar.
class Base {
virtual bar() throw (std::string);
};
class Derived : public Base {
using Base::bar;
};
05/23/2005: wsfulton
Fixes for detecting virtual methods in %extend for the -fvirtual option and C# override and new
method modifiers.
05/23/2005: wsfulton
[C#] The 'new' modifier is now generated on the proxy method when a method in a derived
class is not polymorphic and the same method exists in the derived class (ie it hides
the base class' non-virtual method).
05/23/2005: wsfulton
[Java, C#] Fixes to detection of covariant return types - when the class hierarchy is more
than 2 classes deep.
05/21/2005: wsfulton
[Java] std::wstring typemaps moved from std_string.i to std_wstring.i
05/21/2005: wsfulton
Fix for crash in DohStrstr, bug #1190921
05/21/2005: wsfulton
[TCL] Fix for methods with similar names when showing list of names on error - bug #1191828.
Patch from Jeroen Dobbelaere.
05/21/2005: wsfulton
[TCL] long long overloading fix - bug #1191835, patch from Jeroen Dobbelaere.
05/21/2005: wsfulton
Fix bug #1196755 to remove debug from swigtcl8.swg.
05/19/2005: wsfulton
[C# and -fvirtual option] Fix for the override key not being generated in the derived class when a
virtual method's return type was a typedef in either the base or derived class. Also ensures the
method is eliminated when using the -fvirtual option. For example, Derived.method now has the C#
override keyword generated:
typedef int* IntegerPtr;
struct Base {
virtual IntegerPtr method();
};
struct Derived : Base {
int * method() const;
};
[C#] Fix for the override key being incorrectly generated for virtual methods when a base class
is ignored with %ignore.
05/13/2005: wsfulton
[Java] Fixes to remove "dereferencing type-punned pointer will break strict-aliasing rules"
warnings in C wrappers when compiling C code with 'gcc -Wall -fstrict-aliasing'. Patch from
Michael Cahill. This modifies many of the casts slightly, for example
arg1 = *(DB_ENV **)&jarg1;
to
arg1 = *(DB_ENV **)(void *)&jarg1;
05/12/2005: wsfulton
[C#] Support for C# attributes. C# attributes can be generated:
1) On a C/C++ type basis by specifying an inattributes and/or outattributes typemap attribute
in the imtype or cstype typemaps (for C# return type or C# parameter type attributes).
2) On a wrapped method or variable by specifying a csattributes feature (%feature).
3) On a wrapped proxy class or enum by specifying a csattributes typemap.
Examples are in the C# documentation (CSharp.html).
04/29/2005: wsfulton
New configure option to turn off the default maximum compiler warning as
they couldn't be removed even when overriding CFLAGS and CXXFLAGS with configure
(./configure CFLAGS= CXXFLAGS=). To turn the maximum warnings off, run:
./configure --without-maximum-compile-warnings
04/28/2005: wsfulton
Patch from Scott Michel which reworks the Java constructor and finalize/destructor typemaps,
for directors to reduce the number of overall Java typemaps. Added the director_take and
director_release typemaps to emulate other modules' __disown__ functionality.
*** POTENTIAL INCOMPATIBILITY FOR JAVA DIRECTORS ***
04/28/2005: wsfulton
[C#] Fixed problems due to the over eager garbage collector. Occasionally the
garbage collector would collect a C# proxy class instance while it was being used
in unmanaged code if the object was passed as a parameter to a wrapped function.
Needless to say this caused havoc as the C# proxy class calls the C++ destructor
when it is collected. Proxy classes and type wrapper classes now use a HandleRef,
which holds an IntPtr, instead of a plain IntPtr to marshal the C++ pointer to unmanaged
code. There doesn't appear to be any performance degradation as a result of this
modification.
The changes are in the proxy and type wrapper classes. The swigCPtr is now of type HandleRef
instead of IntPtr and consequently the getCPtr method return type has also changed. The net
effect is that any custom written typemaps might have to be modified to suite. Affected users
should note that the implementation uses the new 'out' attribute in the imtype typemap as the
input type is now a HandleRef and the output type is still an IntPtr.
*** POTENTIAL INCOMPATIBILITY FOR C# MODULE ***
04/28/2005: wsfulton
[C#] Support for asymmetric type marshalling added. Sometimes the output type needs to be
different to the input type. Support for this comes in the form of a new optional 'out'
attribute for the ctype, imtype and cstype typemaps. If this typemap attribute is not
specified, then the type used for both input and output is the type specified in the
typemap, as has always previously been the case. If this typemap attribute is specified,
then the type specified in the attribute is used for output types and the type specified
in the typemap itself is used for the input type. An output type is a return value from
a wrapped method or wrapped constant and an input type is a parameter in a wrapped method.
An example shows that char * could be marshalled in different ways,
%typemap(imtype, out="IntPtr") char * "string"
char * function(char *);
The output type is thus IntPtr and the input type is string. The resulting intermediary C# code is:
public static extern IntPtr function(string jarg1);
04/22/2005: mkoeppe (Matthias Koeppe)
[Guile] Fix generation of "define-method" for methods of
classes with a constructor. Reported by Luigi Ballabio.
04/15/2005: wuzzeb (John Lenz)
[Chicken]
For wrapped functions that return multiple values (using argout),
SWIG CHICKEN now returns them as multiple values instead of as
a list. They can then be accessed using (call-with-values).
04/14/2005: wuzzeb (John Lenz)
[Chicken]
+ Added a whole bunch of new _runme scripts into the chicken test
suite. Also fix some bugs these new scripts turned up.
+ Added optimization when returning a wrapped proxy class. Before,
a minor garbage collection was invoked every time a function returned.
+ All the chicken Examples should now run correctly
04/14/2005: wsfulton
[C#] More fixes for typemap matching when wrapping variables, in particular
std::string, so that std::string variables can be easily marshalled with
a C# string property using:
%include "std_string.i"
%apply const std::string & { std::string *variable_name };
std::string variable_name;
(Recall that all class variables are wrapped using pointers)
04/05/2005: wuzzeb (John Lenz)
[Chicken]
+ Added Examples/chicken/egg, an example on how to build a chicken
extension library in the form of an egg. Also updated the
documentation on the different linking options.
+ chicken test-suite now has support to check SWIG with the -proxy
argument if there exists a _proxy_runme.ss file.
+ More fixes for overloaded functions and -proxy
03/31/2005: wsfulton
Turned on extra template features for all languages which were
previously only available to Python.
This enables typemaps defined within a templated class to be used as
expected. Requires %template on the templated class, %template() will
also pick up the typemaps. Example:
template <typename T> struct Foo {
...
%typemap(in) Foo "in typemap for Foo<T> "
or
%typemap(in) Foo<T> "in typemap for Foo<T> "
};
%template(Foo_i) Foo<int>;
%template() Foo<double>;
will generate the proper 'in' typemaps wherever Foo<int> and Foo<double>
are used.
03/30/2005: mkoeppe (Matthias Koeppe)
[MzScheme] Patch from Hans Oesterholt for supporting MzScheme 30x.
03/29/2005: wuzzeb (John Lenz)
[Chicken]
+ Reallow older versions of chicken (1.40 to 1.89) by passing -nocollection
argument to SWIG
+ %import now works correctly with tinyclos. (declare (uses ...)) will be
exported correctly.
+ TinyCLOS proxy classes now work correctly with overloaded functions
and constructors.
03/29/2005: wsfulton
[Java] Patch from Scott Michel for directorout typemaps. Java directors
require the directorout typemaps like the other languages now. The new
typemaps provide fixes for methods where the return type is returned
by reference (this cannot automatically be made thread safe though).
03/22/2005: wsfulton
Enum casting fixes. Visual C++ didn't like the C type casting SWIG produced
when wrapping C++ enum references, as reported by Admire Kandawasvika.
03/21/2005: wsfulton
[Perl] SF #1124490. Fix Perl macro clashes when using Visual Studio's STL string,
so now projects can #include <string>.
03/21/2005: wsfulton
Fixed %varargs which got broken with the recent default argument changes.
Also works for Java and C# for the first time now.
03/17/2005: wuzzeb (John Lenz)
[Chicken]
+ Fix a whole bunch of bugs in the chicken module. The entire
test suite now compiles, with the exception of the tests that require
std_vector.i, std_deque.i, and so on, which chicken does not have yet.
+ Add support for %exception and %typemap(exceptions). Exceptions are
thrown with a call to (abort) and can be handled by (handle-exceptions)
03/15/2005: wsfulton
[Java] Patch from Scott Michel for directors. Modifications to the typemaps
giving users fine control over memory ownership and lifetime of director classes.
Director classes no longer live forever by default as they are now collectable
by the GC.
03/15/2005: wuzzeb (John Lenz)
[Chicken] Add support for adding finalizers garbage collected objects.
Functions that return new objects should be marked with %newobject and
input arguments which consume (or take ownership) of a pointer should
be marked with the DISOWN typemap.
Also add support for correctly checking the number of arguments passed
to a function, and raising an error if the wrong number are passed.
03/14/2005: wuzzeb (John Lenz)
Add --without-alllang option to configure.in, which is the same as
passing all the --without-python --without-perl5 etc... that Matthias added.
03/09/2005: wsfulton
[Php] Memory leak fix for functions returning classes/structs by value.
03/08/2005: wsfulton
[Perl] Fix for Perl incorrectly taking memory ownership for return types that
are typedefs to a struct/class pointer. Reported by Josh Cherry.
03/07/2005: wsfulton
[C#] Various exception changes for the std::vector wrappers. These now more
accurately mirror the same exceptions that System.Collections.ArrayList throw.
03/07/2005: wsfulton
[C#] Fix undefined behaviour after any of the std::vector methods
throw an exception.
03/07/2005: wsfulton
[C#] When null is passed for a C++ reference or value parameter, the
exception thrown has been corrected to an ArgumentNullException instead
of NullReferenceException as recommended in the .NET Framework documentation.
The default throws typemaps turn a C++ exception into an ApplicationException,
not a SystemException now.
03/07/2005: wsfulton
[C#] Numerous changes in C# exception handling have been made over the past
few weeks. A summary follows:
The way in which C++ exceptions are mapped to C# exceptions is quite different.
The change is to fix C# exceptions so that the C++ exception stack is correctly
unwound as previously C++ exceptions were being thrown across the C PInvoke layer
into the managed world.
New typemap attributes (canthrow and excode) have been introduced to control the
mapping of C++ to C# exceptions. Essentially a callback into the unmanaged world
is made to set a pending exception. The exception to throw is stored in thread local
storage (so the approach is thread-safe). The typemaps are expected to return
from unmanaged code as soon as the pending exception is set. Any pending exceptions
are checked for and thrown once managed code starts executing. There should
be minimal impact on execution speed during normal behaviour. Full details will be
documented in CSharp.html.
The SWIG_CSharpThrowException() function has been removed and replaced with the
SWIG_CSharpSetPendingExceptionArgument() and SWIG_CSharpSetPendingException()
functions. The original name has been deliberately changed to break old code as
the old approach was somewhat flawed. Any user defined exceptions that follow the
same pattern as the old approach should also be fixed.
Numerous new .NET framework exceptions are now available for easy throwing from
unmanaged code. The complete list is:
ApplicationException, ArithmeticException, DivideByZeroException,
IndexOutOfRangeException, InvalidOperationException, IOException,
NullReferenceException, OutOfMemoryException, OverflowException,
SystemException, ArgumentException, ArgumentNullException and
ArgumentOutOfRangeException.
*** POTENTIAL INCOMPATIBILITY FOR C# MODULE ***
05/05/2005: mmatus
Fix several memory leaks around. Even when we survive knowning
swig is a memory leak factory, it was a little out of
control. To run std_containers.i in the python test-suite,
swig was using ~260MB, now it uses 'only' ~40MB, which is
the same ammount that g++ uses, so, is not that bad.
In the process, I found a couple of extra Deletes, which
in some cases could trigger seg. faults and/or
DOH/asserts.
[python] Better support for directors + exception. More
verbose errors and added an unexpected exception handler.
[python] Fix memory leak for the
std::vector<std::vector<int> >
case,reported by Bo Peng.
[python] Fix SwigPyObject compare problem reporte by
Cameron Patrick.
[python] Fix several warnings in the generated code
for gnu-gcc, Intel and VC7.1 compilers.
02/25/2005: wuzzeb (John Lenz)
Update documentation to use CSS and <div> instead of <blockquote>
I used a script to convert the docs, and it set all the box classes
to be "code". There are actually 4 different classes,
"shell", "code", "targetlang", and "diagram". We need to go through
and convert the divs depending on what they contain.
02/23/2005: mmatus
[Python] Added option -nortti to disable the use of native
C++ RTTI with directors (dynamic_cast<> is not used).
Add more code for directors to detect and report errors in
the python side.
Extend the use of SWIGINTERN whenever is possible.
Remove template warnings reported by VC7.1.
Remove warnings reported by gcc/g++. Finally you can
compile using
g++ -W -Wall -c mymodule_wrap.cxx
and no spurious errors will be generated in the wrapper
code.
02/23/2005: wuzzeb (John Lenz)
Added -external-runtime argument. This argument is used to dump
out all the code needed for external access to the runtime system,
and it replaces including the files directly. This change adds
two new virtual functions to the Language class, which are used
to find the language specific runtime code. I also updated
all languages that use the runtime to implement these two functions.
02/22/2005: mmatus
Fix %template + private error SF#1099976.
02/21/2005: mmatus
Fix swigrun.swg warnings reported when using "gcc -W -Wall"
(static/inline not used in front of a function
declaration), and add SWIGUNUSED attribute to avoid
unused warnings elsewhere.
Fix unused variable warnings.
[Python] Use new SWIGUNUSED attribute to avoid warnings in
SWIGINTERN methods.
[Python] Fix PyOS_snprintf for python versions < 2.2 (SF #1104919).
[Python] Fix map/multimap to allow empty maps (reported by
Philippe Hetroy).
[Docs] Add some documentation to Python.html and
SWIGPlus.html, including for example the fact that
'friends' are now supported.
02/21/2005: wsfulton
[PHP] Patch from Olly Betts, so that wrappers compile with Zend thread safety enabled.
02/17/2005: wsfulton
Memory leak fix in some of the scripting language modules when using default
arguments in constructors. The scripting language was not taking ownership of the
C++ object memory when any of the constructors that use default arguments was called.
02/16/2005: wsfulton
SF #1115055: Failed make install. Patch from Rob Stone.
02/16/2005: wsfulton
[Java] SF #1123416 from Paul Moore. Correct memory allocation for STRINGARRAY
typemaps in various.i.
02/15/2005: wsfulton
Disabled typemap search changes for now (see entry 19/12/2004). It breaks
old typemaps, lengthens the execution time by about 25% and introduces
inconsistencies.
02/15/2005: wsfulton
swig -help follows other software by printing to stdout instead of stderr now.
swig -version also displays to stdout instead of stderr now.
Behaviour reported by Torsten Landschoff.
02/15/2005: wsfulton
[Ruby] Fix for the less commonly used ordering of %include and #include, so
that the generated code compiles. Bug reported by reported by Max Bowsher.
%include foo.h
%{
#include foo.h
%}
02/15/2005: wsfulton
[C#, Java] SWIG_exception macro will now return from unmanaged code / native code
as soon as it is called. Fixes possible JVM crashes and other code unexpectedly
being executed. Note SWIG_exception is only occasionally used by SWIG library
writers, and is best avoided by SWIG users.
02/15/2005: wsfulton
[C#, Java] Typemaps can now be targeted at global variable names
and static member variable names. Previously the typemaps for
the setters were ignored, for example:
%typemap(in) int globalint "..."
int globalint;
02/13/2005: mkoeppe (Matthias Koeppe)
[Guile] Add %typecheck for SWIGTYPE, add %typecheck for ptrdiff_t, fix
typemaps for size_t.
[Pike] Merge patch from Torsten Landschoff for improved Pike configuration.
02/12/2005: mkoeppe (Matthias Koeppe)
New configure switches --without-tcl, --without-python etc. allow to
disable the search for installed languages.
01/31/2005: wuzzeb (John Lenz)
- Add DohSortList to DOH
- Improve the runtime type system:
+ Speed. Type loading is now O(n log n) instead of O(N^2), which
for large modules is a huge improvement.
+ A whole bunch of functions in swigrun.swg no longer need the
swig_type_list_handle passed to them. The only one left is
TypeQuery. This also makes runtime.swg a lot smaller.
+ Split up swig_type_info structure into two structures
(swig_type_info and swig_cast_info)
+ Store a pointer to a swig_type_info rather than just the type
name string in the linked list of casts. First off, this makes
the guile module a little faster, and second, the
SWIG_TypeClientData() function is faster too.
+ Add the idea of a module into the type system. Before, all the
types were stored in one huge linked list. Now, another level is
added, and the type system stores a linked list of modules, each
of which stores an array of types associated with it.
+ For more information of how the runtime type system now works,
please see Doc/Manual/typemaps.html and Doc/Devel/runtime.txt
- Update all language modules to use the new type system. The changes
to each language module are minor. All languages are now able to
use runtime.swg for external access to the type system. Before
only python and perl did.
- [guile, mzscheme, ocaml, and php4] These languages opened up the
init function inside the .cxx code, and any code in the .swg files
in the init section was inside this function. This was a problem
for swiginit.swg, which needs to be inserted before the SWIG_init
function is opened. Thus I changed these languages to be like
python or perl, where the init function is declared in the .swg
file.
- [Ruby] Instead of moving the init function to the .swg file, I
added a new section initbeforefunc, and then added
%insert(initbeforefunc) "swiginit.swg"
- [MzScheme] Fix enums and fix Examples/Makefile.in so that if
multiple -I arguments are specified in the INCLUDES variable, each
gets a ++ccf.
- [Guile GH] Update Guile GH to use the new type system. See
Doc/Manual/Guile.html for how smobs are now used.
01/11/2005: wsfulton
[C#] New typemap called 'csconstruct'. The code in this typemaps was previously hard
coded and could not be customised by a user. This typemap contains the code that is
generated into a proxy class's constructor.
[Java] New typemap called 'javaconstruct'. The code in this typemaps was previously hard
coded and could not be customised by a user. This typemap contains the code that is
generated into a proxy class's constructor. Another typemap named 'javaconstruct_director'
is used instead when the proxy class is a director class.
[C#, Java] If a C++ class did not have a default constructor, a protected default constructor
was automatically generated by SWIG. This seems is unnecessary and has been removed
and thereby giving the user almost complete control over the generated code along with the
new typemaps above.
19/12/2004: mmatus
[Disabled, see entry 02/15/2004]
- Fix typemap search, now the "out" typemap search is done as follows
int *Foo::foo(int bar) -> int *Foo::foo(int bar)
-> int *Foo::foo
-> int *foo(int bar)
-> int *foo
-> int *
then, now you can be more specific, and define
/* apply only for 'Foo::foo' method */
%typemap(out) int * Foo::foo(int *bar) ...;
/* apply for all 'foo' functions/methods */
%typemap(out) int * foo(int *bar) ...;
%inline {
struct Foo {
int *foo(int *bar);
};
}
15/12/2004: mmatus
- More fixes for templates and template default args.
See template_default.i for scary cases that now are
supported, besides the already ugly STL/std cases.
- Cosmetics and more use of 'const' where it was implicit.
- Other fixes for OSS, which is now working again with 1.3.25.
Version 1.3.24 (December 14, 2004)
==================================
12/12/2004: wuzzeb (John Lenz)
[Chicken] Fix a bunch of bugs relating to -proxy support
+ non-class variables now export properly using -proxy
+ static member functions now export properly using -proxy
+ member class variables now export properly using -proxy
+ added a -nounit argument, which does not export the (declare (unit ...))
+ correctly install swigclosprefix.scm
+ constants (enums, defines) now correcly export when using -proxy
12/11/2004: wsfulton
configure fix for when more than one version of jni_md.h is found
in the Java include directory (was generating lots of sed error
messages).
12/08/2004: wsfulton
[Java] Fixes to arrays_java.i so that one can apply the array
typemaps to functions taking pointers as input, eg
%include "arrays_java.i"
%apply int[] {int*};
void foo(int *a);
12/05/2004: wsfulton
[Java] Director mods contributed by Scott Michel. New typemaps
directordisconnect and directordisconnect_derived for the
swigDirectorDisconnect() method. Also fix to get the javapackage
typemap working again.
12/05/2004: mmatus
- Finishing the fixes for templates + default template
args + specializations.
- [Python] Now we use the new templates + default template
args in the std/STL library. That means the internal
swig files are getting uglier since we now support the
original declarations:
template<class _Tp, class _Alloc = std::allocator< _Tp > >
class vector {
....
};
template<class _Key, class _Tp, class _Compare = std::less<_Key >,
class _Alloc = std::allocator<std::pair<const _Key, _Tp > > >
class map {
....
};
and the user can use the %template directive as
%template() std::vector<int>;
%template() std::vector<int, std::allocator<int> >;
%template() std::vector<int, MyAllocator<int> >;
Now we are closer to the cleaning/rewriting of the
python std/STL support, such that we recover support for
MSVC++ 6.0, and we can add support for other languages
too.
12/02/2004: wsfulton
[Java] Fix for directors when wrapping methods using a member enum
and typesafe/proper enums enabled.
12/01/2004: mmatus
- Fix typemaps to work with templates and default template
args, ie
template <class A, class B = int>
struct Foo {
};
%typemap(in) Foo<int> *{...}
%typemap(out) Foo<int,int> *{...}
Foo<int> * foo( Foo<int> *f1, Foo<int,int> *f2);
now 'f1', 'f2' and the return value resolve the provided
typemaps properly.
This is highly needed for proper STL support, see new
std_basic_string.i, std_sstream.i, etc.
- Added std_sstream.i, and fix std_basic_string.i to use
the new typemaps + template def. arg mechanism. Also,
added the needed std_alloc.i. Now, all the containers
can be modified to support std::allocator, like in:
template<class T, class A = std::allocator<T > >
class vector {
public:
....
};
This change is only completed by now for basic_string.
- Fix for smart pointers + members + extensions:
%extend Foo {
int extension(int i, int j) { return i; }
int extension() { return 1; }
}
%inline %{
class Foo {
public:
int y;
static const int z;
};
class Bar {
Foo *f;
public:
Bar(Foo *f) : f(f) { }
Foo *operator->() {
return f;
}
};
now you can
f = Foo()
f.y = 3
a = f.z
f->extension()
b = Bar(f)
b.y = 3
a = b.z
b->extension()
- Other small errors fixes, mostly python.
11/25/2004: wsfulton
[Java] Numerous director bug fixes so that the correct java types
and canonicalized types in the JNI code are emitted. Use of the
$javaclassname special variables in the director typemaps now
consistent with the non-director typemaps. The types used for
typemap lookups are also corrected in a few places. If you
previously had your own director typemaps, ensure they are using the
correct C++ type.
*** POTENTIAL INCOMPATIBILITY FOR JAVA DIRECTORS ***
11/25/2004: wsfulton
const enum SWIGTYPE & typemaps added. These wrap const enum references
as if they were passed by value. Const enum references thus work the
same as const reference primitive types such as const double &,
const int & etc. Typemaps added for Java, C#, Ruby, Tcl, Perl and Pike.
11/25/2004: wsfulton
[Java, C#] New special variable: $*javaclassname, similar to $javaclassname
and $&javaclassname. The new one removes a pointer from the C type before
obtaining the Java class name. One or more of $javaclassname,
$&javaclassname or $*javaclassname may now appear in a typemap. Likewise for
C# using csclassname instead of javaclassname.
11/25/2004: wsfulton
The last vestiges of enums being handled as integers removed from the
internals. The wrapper methods use the enum type rather than an int
now. The net result is added type safety for enums when handled as
pointers, references etc. Previously in situations such as a method
taking a pointer to an enum, a pointer to an int or a pointer to an
enum of some other type could inadvertantly be passed to the method.
This is now fixed as the descriptor for an enum is no longer based on
an int, but the enum type instead. Anonymous enums are still handled
as integers.
The consequence for scripting language users in correct usage of enums
should not be noticeable. There is no change for any of the languages
where enums are passed by value - most of the scripting languages will
still accept an integer for an enum value and the strongly typed
languages still use either typesafe enums, integers or proper enums
depending on what the user configures. For Java and C# users a change
in the typewrapper class name has occurred (for enum pointers,
references etc). For example:
enum Numbers { one=1, two };
enum Numbers* number();
In Java and C# this must now be coded as
SWIGTYPE_p_Numbers n = modulename.number();
rather than
SWIGTYPE_p_int n = modulename.number();
*** POTENTIAL INCOMPATIBILITY ***
11/21/2004: wsfulton/mmatus
Added missing deprecated warning for %name and remove remaining %name
usage in the SWIG libraries.
11/21/04: mmatus
- [Python] Adding the PySwigObject to be used for carrying
the instance C/C++ pointers. This is used instead of
string and PyCObjects.
The new PySwigObject is even safer than PyCObject, and
more friendly than plain strings:
now you can do
print a.this
<Swig Object at _00691608_p_A>
print str(a.this)
_00691608_p_A
print long(a.this)
135686400
print "%s 0x%x" % (a.this, a.this)
_00691608_p_A 0x8166900
the last one is very useful when debugging the C/C++
side, since is the pointer value you will usually get
from the debugger.
Also, if you have some old code that uses the string
representation "_00691608_p_A", you can use it now again
using 'str(ptr)', or by calling 'str = PyObject_Str(obj)'
in the C/C++ side.
This change is mainly for nostalgic swig users that miss
the string representation, but also allows to say again
if a.this == b.this:
return "a is b"
and well, since the change were really simple, maybe in
the future we will be able to do
next = a.this + 1
or add native python iteration over native C/C++ arrays,
ie, no need to create/copy new tuples when returning and
array or vector.
Also, a PySwigPacked object was adding to carry a member
method pointer, but this is probably a temporary solution
until a more general object for methods is added.
Be aware that to simplify maintaining and compatibility
with other tools, the old string and PyCObjects
representation could disappear very soon, and the
SWIG_COBJECTS_TYPES or SWIG_NO_OBJECT_TYPES macros will
have no effect at compilation time. Still, the three
mechanisms are present in the code just for testing,
debugging and comparison purposes.
11/21/04: mmatus
- [Python] Adding back support for using the swig runtime code
inside the user code. We just allow the user to include
the minimal code needed to implement the runtime
mechanism statically, just as in done in the swig
modules.
To use the swig runtime code, for example with python,
the user needs include the following:
#include <Python.h> // or using your favorite language
#include <swigrun.swg>
#include <python/pyrun.swg> // or using your favorite language
#include <runtime.swg>
the files swigrun.swg, pyrun.swg and runtime.swg can
be checked out by using swig -co, or they can simply
be found by adding the swig lib directory to the
compiler include directory list, for example
SWIGLIB=`swig -swiglib`
c++ -I${SWIGLIB} ..
of better, using the CPPFLAGS, but that depends on your
environment.
This change can be ported to the other languages too,
you just need to isolate the needed runtime code in
a single file like 'pyrun.swg', and provide the
SWIG_Runtime_GetTypeList() method. Look at the
Lib/python/pyrun.swg file and the Examples/python/swigrun
example.
11/15/04: mmatus
- Fix mixed_types.i + gcc-3.4, ie, arrays + references +
typedefs
- Fix multidim arrays + typedefs,ie
typedef char character[1];
typedef character word[64];
- Process protected/private bases in the same way before
we process protected/private members, ie, we check
for constructors, operator new, virtual members, etc.
- Fix Ruby/Java to work (or ignore) multi-inheritance +
directors. Allow other languages to define if it is
supported or not.
- Now you can run
SWIG_FEATURES="-directors -dirprot"
make check-ruby-test-suite
make check-python-test-suite
make check-java-test-suite
make check-ocaml-test-suite
and you will get only 'real' errors. ruby and python
compile with no errors, java shows some problems.
Version 1.3.23 (November 11, 2004)
==================================
11/05/2004: wsfulton
Patch #982753 from Fabrice Salvaire: Adds dependencies generation for
constructing makefiles. New command line options -MF -MD -MMD to work
with the current options -M and -MM. These options are named the same
and work the same as in gcc.
11/05/2004: wsfulton
%ignore/%rename changes for methods with default arguments to mirror
%feature behaviour. See previous entry.
*** POTENTIAL INCOMPATIBILITY ***
11/04/2004: wsfulton
%feature improvements for fine tuning when wrapping methods with
default arguments. Any %feature targeting a method with default arguments
will apply to all the extra overloaded methods that SWIG generates if the
default arguments are specified in the feature. If the default arguments are
not specified in the feature, then the feature will match that exact
wrapper method only and not the extra overloaded methods that SWIG generates.
For example:
%feature("except") hello(int i=0, double d=0.0);
void hello(int i=0, double d=0.0);
will apply the feature to all three wrapper methods, that is:
void hello(int i, double d);
void hello(int i);
void hello();
If the default arguments are not specified in the feature:
%feature("except") hello(int i, double d);
void hello(int i=0, double d=0.0);
then the feature will only apply to this wrapper method:
void hello(int i, double d);
and not these wrapper methods:
void hello(int i);
void hello();
This has been introduced to make %feature more powerful to ease the migration
to new default arguments wrapping approach.
*** POTENTIAL INCOMPATIBILITY ***
If you previously had a %feature and didn't specify the default arguments,
you will have to add them in now or you can obtain the original behaviour
by using %feature("compactdefaultargs").
11/04/2004: wsfulton
[C#] Typemaps for std::vector added into std_vector.i. The proxy classes
generated are modelled on the .NET ArrayList class. This isn't quite
ready for general consumption yet, but will work with vectors of primitive
types and some classes.
10/3/2004: wuzzeb (John Lenz)
[GUILE] The -scm interface is now the default. The old GH interface can
still be enabled by passing -gh to SWIG.
10/2/2004: mmatus
- More fixes for namespace + class declarations.
As an extra bonus, we get %template support for static/members class
methods, ie, now you can say:
namespace space {
struct A
{
template <class Y>
static void fooT(Y y) { }
};
}
struct B
{
template <class Y>
void barT(Y y) {}
};
%template(foo) space::A::fooT<double>;
%template(foo) space::A::fooT<int>;
%template(foo) space::A::fooT<char>;
%template(bar) B::barT<double>;
%template(bar) B::barT<int>;
%template(bar) B::barT<char>;
and call
A.foo(1)
b = B()
b.bar(1)
note the methods are emitted inside the classes,
and hence, the %template name refers to the 'member'
method name, not a global namespace name.
10/31/2004: mmatus
- Solve namespace + class declarations, as in
namespace foo {
struct Bar;
struct Foo {
};
}
struct foo::Bar : Foo {
};
see namespace_class.i for more examples.
- Fix %template directive to properly use namespaces,
including the case:
namespace one
{
template <typename T>
struct Ptr {};
}
namespace one
{
struct Obj1 {};
typedef Ptr<Obj1> Obj1_ptr;
%template(Obj1_ptr) Ptr<Obj1>;
}
namespace two
{
struct Obj2 {};
typedef one::Ptr<Obj2> Obj2_ptr;
%template(Obj2_ptr) one::Ptr<Obj2>;
}
this is done by using the namespace name 'one' to create
a namespace node to emit the template instantiation,
just as before, but the template parameters are resolved
and qualified in the current namespace ('one' or 'two').
This is same way that typedef works.
This resolve the smart_pointer_namespace2.i case, and at
the same time, several other ones where before swig was
generating the
"Can't instantiate template 'xx' inside namespace 'yy'"
error message. In fact, that error doesn't exist
anymore. You can only get an error if you use a bad
namespace name or so.
10/30/2004: mmatus
- [ruby] Directors fixes:
- enums and std::strings are working now (several
reports in bug track system)
- added patch 1025861 for director + exceptions
*** Attention ***: ruby with directors + protected
members work with version 1.7+. Older versions seems to
have a broken signature for'rb_protect'.
If you need to use an old version, look at
http://excruby.sourceforge.net/docs/html/ruby__hacks_8hpp-source.html
for workarounds.
- [ruby] Fix memory allocation problem in typemap (bug 1037259)
- [tcl] Fix (enums|constants) + namespace option
(reported by jason.m.surprise@intel.com).
- [perl] Add patch 962168 for multiple inheretance
- Fix 'defined' as variable name.
10/29/2004: wsfulton
Seg fault fix for global scope operator used for friend methods:
class B {
friend void ::globalscope();
...
};
10/28/2004:mmatus
- Added module and swig option "templatereduce" to force swig
to reduce any type needed with templates, ie, in these cases
%module("templatereduce") test
template <class T> struct A { };
typedef int Int;
%template(A_Int) A<Int> ==> %template(A_Int) A<int>
typedef B* Bp;
%template(A_Bp) A<Bp> ==> %template(A_Bp) A<B*>
swig reduces the types Int and Bp to their primitives
int and B*. This is closer to the usual compiler
resolution mechanism, and it is really needed sometimes
when you mix templates + typedefs + specializations.
Don't use it if you don't have any problem already,
since the type reduction can interfere with some
user typemaps, specially if you defined something like
typedef int Int;
%typemap(in) Int ...;
in this case, when you use the "templatereduce" option,
swig will ignore the user typemap, since the "typedef int Int"
will take precedence, and the usual "int" typemap will be
applied.
Note that the previous case is not common, and should be
avoided, ie, is not recommended to use a typedef and a
typemap at the same time, specially if you are going to
use templates + specializations.
- Directors:
virtual destructor is always emitted now, this doesn't
cause any harm, and could solve some nasty and
mysterious errors, like the one mentioned by Scott.
also the destructor is not in-lined, so, that can solve
some other mysterious errors when mixing directors +
imports + embedded applications + some specific compilers.
10/27/2004: wsfulton
[C#] typemaps.i library file with INPUT, OUTPUT and INOUT typemaps added.
10/27/2004: wsfulton
[Java] std::wstring typemap fixes in std_string.i from Russell Keith-Magee.
10/25/2004: mmatus
- Using + namespace is working now (using_namespace.i).
- Derived + nested classes is working now
(deriver_nested.i), but of course, we are still waiting
for the nested class support.
- Directors:
- unnamed parameters support,
- protected constructor support (automatic and with
dirprot mode),
- detection of really needed protected declarations
(members and constructors) now is done automatically.
Even if you don't use the 'dirprot' mode, swig will
wrap what is minimally needed (and protected) for the
code to compile.
what is public, as usual, is always wrapped, and if
you use the 'dirport'
- Final fixes for the OSS to compile with SWIG 1.3.23 (my
very very ugly C++ + templates + everything mounters wrap).
10/25/2004: wsfulton
[C#] New commandline option -dllimport. This enables one to specify
the name of the DLL for the DllImport attribute. Normally this name
comes from the module name, so now it is possible to override this:
swig -csharp -dllimport xyz example.i
will generate for all the wrapped PInvoke methods:
[DllImport("xyz", EntryPoint="...")]
public static extern ...
The wrappers from many different SWIG invocations can thus be compiled
into one DLL.
A new special variable $dllimport can also be used in typemaps, pragmas,
features etc. This will get translated into the value specified by -dllimport
if specified, otherwise the module name.
10/22/2004: wsfulton
[Java] Patch #1049496 from Scott Michel fixes directors methods with
enums when wrapped with typesafe or proper Java enums.
10/21/2004: wsfulton
Fixes for default arguments in director constructors (Python, Ruby, Ocaml).
10/21/2004: mmatus
- [Python] Add the '-cpluscast' option to enable the 'new'
C++ casting operators, such as 'static_cast', inside the
typemaps. By default swig use the old C cast style, even
when parsing C++.
- [Python] Add the '-new_vwm' option to enable the new
SwigValueWrapper mode. Now this is mainly for testing
that the typemaps are really safe for any future
solution, but you can use it if you have a very strange
error with default cosntructors missing + %apply +
%typemap, and if everything else fails (see
valuwrapper_opaque.i for alternative and current
solutions). If you are a user that don't know what is
SwigValueWrapper, don't even try it.
- [Python] Add the '-noh' option to be used with directors
and when you prefer to disable the generation of the
director header file. If not used, swig will work as
usual generating both the wrap.cxx and wrap.h files. If
you use it, swig will only generate wrap.cxx.
10/21/2004: wuzzeb (John Lenz)
- If you define SWIG_TYPE_TABLE when compiling a wrapper file,
the runtime types will be stored in the given type table name.
Using this, you can seperate different modules to share their
own type systems. -DSWIG_TYPE_TABLE=Mytable
- [Python] If you define SWIG_STATIC_RUNTIME then the type information
will be static to this wrapper. Nothing will be shared with any
other modules
- [Python] If you define SWIG_LINK_RUNTIME, then instead of using
the new way of sharing type information, the wrapper will expect
to be linked against the Lib/linkruntime.c file. Any modules compiled
with SWIG_LINK_RUNTIME and linked against linkruntime.c will all
share type information.
10/20/2004: mmatus
- [Python] Initial fix for python/import example. Please
update the Makefile (autoconf, configure, etc, expert),
since now probably is only working with g++, icc and a
few other compilers that have the -shared option.
We need to create additional shared libraries for the
virtual destructors. Old and usually forgotten C++
requirement.
Same fix need to be used in perl, I think.
- [Python] Fix generation of header file for directors,
now directors.swg is also included, so, it can be really
used from C++, and it solves some problem with compiler
that require that, even with the simple swig inclusion.
- [Python] Reordering the methods and moving some bodies
outside the class declaration. This is needed due to
some gcc-2.96 internal compiler errors. It seems the
PYTHON class is getting too large to been declared and
defined at the same time.
- Add the -oh option to change the output header file name
if needed:
swig -c++ -python test.i -o test.CC -oh test.HH
this is mainly needed when using directors, and if the
current default header file name is not good for you,
which is generated as follow:
swig -c++ -python test.i => test_wrap.h
swig -c++ -python test.i -o test.CC => test.h
10/20/2004: wsfulton
1) Compact default arguments feature added. This feature allows one
to use the default argument code generation that was used in
SWIG-1.3.22 and earlier versions. It produces more compact wrappers
as only one wrapper method is generated for any method with default
arguments. So the advantage is it generates less code but has the
original limitations, like it it does not work with all default arguments
and default arguments cannot be taken advantage of in the strongly typed
languages (C# and Java). It is implemented via the usual %feature mechanism:
%feature("compactdefaultargs");
2) Keyword arguments (kwargs) are working again for default arguments
in the languages that support it, ie, Python and Ruby. The new default
argument wrapping approach using overloaded methods cannot support kwargs
so the compact default argument feature is automatically turned on when
kwargs are specified, by %feature("kwargs").
3) Compact default arguments are also automatically turned on when wrapping
C (not C++) code. This is to support the bizarre notion of default arguments
for C code.
10/20/2004: wsfulton
Overloaded templated functions in namespaces also working now.
Templated functions with default arguments in namespaces too.
10/19/2004: mmatus
- Allow to disable the new SwigValueWrapper mechanism,
if you add the following line in your language main.
/* Turn on safe value wrapper use mode */
Swig_value_wrapper_mode(1);
Now is only active in python. All the other languages
are using the old resolution, but they can also use the
"valuewrapper"/"novaluewrapper" features to fix some
of the old broken cases. Note, however, that not all
the broken cases can be solved in that way.
The new mechanism seems to be working fine in perl, ruby
and tcl, but failing in some typemaps in java.
Hence, is upto the language maintainer to test it, and
decide to enable it or not.
Look at the valuewrapper_opaque.i for examples.
- Fix more SwigValueWrapper cases when the new mechanism
is active. Now it also check for local typemap
variables, see valuewrapper_opaque.i for an example when
this is needed. But again, this extra checking will only
be activated when using the new value wrapper mode.
- [Python] Fix variable wrapping of classes with private
assign operators. It should be easy to fix in all the
other modules, instead of checking
if (!Getattr(n,"immutable")) ...
you need to verify
if (is_assignable(n)) ...
Look at the private_assign.i for an example.
10/18/2004: mmatus
- %features "director"/"nodirector" now work as expected.
- General fixes in %feature to resolve function decl
properly,
%feature("hello") foo();
char foo() -> f() // was working
char *foo() -> f().p // it wasn't
- Template + specialization + default template args now is
working, (don't confuse with template + default arg
values, that was solved before), now this ugly case is
working:
template <class T, class A = Alloc<T> >
struct Vector
{
Vector(T a){}
};
template <>
struct Vector<double>
{
Vector(){}
int foo() { return 0; }
};
%template(V_c) Vector<char, Alloc<char> >;
%template(V_i) Vector<int>; // picks Vector<int,Alloc<int> >
%template(V_d) Vector<double>; // picks the specialization
this is needed for automatic STL support (later will
be).
- Fix the template + typedef errors in test-suite, which
probably will fix another group of strange template +
namespaces + typedefs errors.
- %warnfilter is working better now, parser.y tries to use
them when needed.
- **** New default type resolution method (stype.c) *****
It preserves the original mixed types, then it goes
'backward' first deleting the qualifier, then the inner
types, for example:
typedef A *Aptr;
const Aptr&;
r.q(const).Aptr -> r.q(const).p.SWIGTYPE
r.q(const).p.SWIGTYPE -> r.p.SWIGTYPE
r.p.SWIGTYPE -> r.SWIGTYPE
r.SWIGTYPE -> SWIGTYPE
enum Hello {};
const Hello& hi;
r.q(const).Hello -> r.q(const).enum SWIGTYPE
r.q(const).enum SWIGTYPE -> r.enum SWIGTYPE
r.enum SWIGTYPE -> r.SWIGTYPE
r.SWIGTYPE -> SWIGTYPE
int a[2][4];
a(2).a(4).int -> a(ANY).a(ANY).SWIGTYPE
a(ANY).a(ANY).SWIGTYPE -> a(ANY).a().SWIGTYPE
a(ANY).a().SWIGTYPE -> a(ANY).p.SWIGTYPE
a(ANY).p.SWIGTYPE -> a(ANY).SWIGTYPE
a(ANY).SWIGTYPE -> a().SWIGTYPE
a().SWIGTYPE -> p.SWIGTYPE
p.SWIGTYPE -> SWIGTYPE
before it always stops after finding ref/pointer/enum/array/etc.
Now, then, you can define (use and apply) 'higher' typemaps such as:
%typemap(in) SWIGTYPE* const&
%typemap(out) char FIXSIZE[ANY]
%typemap(in) SWIGTYPE* const&
%typemap(in) const enum SWIGTYPE&
%typemap(in) SWIGTYPE[ANY][ANY]
%typemap(in) const char (&)[ANY]
It is possible with this change that previous typemaps
that were defined (but ignored), now will start to work.
Also, it is necessary check for the '%typemap(varin) SWIGTYPE[]',
before it was usually not defined (but char[] was),
and that can produce some inconsistencies.
*** POTENTIAL INCOMPATIBILITY ***
This change was needed for STL, since std::vector<enum Hello>
std::vector<A*>, etc, will always generate methods that
mix const references with the vector type.
Now that is working, all the std::container<T*>
specialization will not be needed anymore, well, in
theory.
In the practice, everythin is working as before until
the proper mixed types are defined and the libraries
simplified to use them.
- Change the behavior of extern "java"/"fortran"/"etc",
now swig produces a warning, and use extern "C" instead.
The warning can also be disable with the "-w 313" flag.
(WARN_PARSE_UNDEFINED_EXTERN).
- SwigValueWrapper is now more selective (lang.cxx).
[Perl/Tcl]
- Fix some typemaps (perl/tcl) to work properly with
SwigValueWrapper. This was not a problem with
SwigValueWrapper, but with the typemaps that now are
safe to use with %apply.
[Python]
- Fix %callback/%pythoncallback work now as before after
the def args changes. Also, %callback now is an alias
for %pythoncallback, so, they do the same.
[Python/Ruby]
- %callback is more usable and uniform:
%callback("%s_cb") foo(); // for both, python/ruby
%callback("%s_cb"); // for both, python/ruby
%callback(1) foo(); // only in python.
10/17/2004: arty
[OCAML]
- Tweak to enum typing for soundness in the presence of multiple
modules.
- global functions are now unambiguous in multiple loaded modules.
- Fixed test case code to build multimodule test cases correctly.
- There is no way to share overload resolution across modules
because of soundness issues. If the user wants to call some
function foo from an arbitrary module bar, they will have to
use Bar._foo to call it correctly. Later I will fix the
camlp4 module to do something clever in this case.
- Promided performance overhaul of class mechanism.
- Removed symbol hack for ocaml-3.07 and below which is not needed
for ocaml-3.08 and above.
10/16/2004: wuzzeb (John Lenz)
[CHICKEN]
- Completly change how chicken.cxx handles CLOS and generic code.
chicken no longer exports -clos.scm and -generic.scm. The clos
code is exported directly into the module.scm file if -proxy is passed.
- The code now always exports a unit. Running the test-suite is now
majorly broken, and needs to be fixed.
- CLOS now generates virtual slots for member variables similar to how
GOOPS support works in the guile module.
- chicken no longer prefixes symbols by the module name, and no longer
forces all names to lower case. It now has -useclassprefix and -closprefix
similar to how guile handles GOOPS names.
10/16/2004: wsfulton
Templated functions with default arguments working with new default argument
wrapping approach. The new approach no longer fails with the following default
argument pattern (previously failed with some primitive types, like
unsigned primitive types):
template<typename T> int foo(const T& u = T());
%template(foo) foo<unsigned int>;
This relies on the templated function overloading support just added, so all
the combinations of overloading by template parameters and normal parameters
as well as overloading with default parameters works.
10/16/2004: wsfulton
Added support for the large range of templated function overloading that C++
supports.
- Overloaded templated functions, eg
template<typename T> int overload(T t);
template<typename T> int overload(T t, const T &r);
- Fixes where the templated type is not used in the parameter list, eg
template<typename T> void xyz();
template<> void xyz<double>();
- Fixes for overloading of plain functions by a templated function:
void abc(double d);
template<typename T> void abc(T t);
- Overloading by templated parameters fixed:
template<typename T> void foo(T t) {}
template<typename T, typename U> void foo(T t, U u) {}
%template(foo) foo<double, double>;
- All combinations of the above also working including specializations, eg:
void abc(double d);
template<typename T> void abc(T t);
template<> void abc<double>(double t);
template<> void abc(int t);
10/16/2004: wuzzeb (John Lenz)
- Remove the ability to share type information by using c linking.
All type sharing happens through a global variable in the target language.
+ Remove SWIG_NOIMPORT, SWIG_RUNTIME, and related defines.
+ Deprecate -runtime, -noruntime command line options
+ Update test-suite common.mk to correctly build multicpptest
+ Remove reference to precommon.swg
+ Update the guile_gh interface to share data by a global var instead
of c linkage.
- Remove Advanced.html, since everything in it is now obsolete
10/09/2004: mmatus
- Split the python std/STL C++ library files, now
all the language independent definitions are under
the directory
Lib/std
and hence, can be used from other languages.
- Add more documentation to the Python STL, and
clean unnecessary code.
- Add initial C99 complex support, and some fixes
for long double.
10/08/2004: mmatus
- Fix the SwigValueWrapper for opaque types, now it is
applied for opaque templates and classes, for which we
don't know if there is or not a default constructor, ie
struct A {
A(int);
};
Still, if you know that you class has a default
constructor, and for some very very particular reason
you want to avoid the SwigValueWrapper, and you don't
want or can't expose the class to swig, now you can
say
%feature("novaluewrapper") A;
class A;
or the other way around, if the class has a default
constructor, but you want to use the value wrapper, you
can say
%feature("valuewrapper") A;
struct A {
A();
....
};
- Fix for char > 128, ie
const char tilde_a = '\341';
- Add patch 1041858 for $lextype, which carries the
literal type of a symbol. See lextype.i in the
test-suite for more details.
10/07/2004: wsfulton
{Ruby, Java] Fix director + 'empty' throws
struct A {
A() throw();
virtual ~A() throw();
int foo() throw();
};
10/06/2004: wuzzeb (John Lenz)
[TCL]
- Fix bug reported by William A. Hoffman propagating clientdata
between modules. Added clientdata_prop.multicpptest to check for
this bug. The fix involved the following changes:
+ SwigType_clientdata_collect does not need to check
types in r_resolved because we only want to propagate clientdata
to typedefed classes, and r_mangled already takes care of typedefs.
+ SWIG_TypeRegister now copies the clientdata field correctly
+ Move SWIG_Guile_PropagateClientData function from guile module
into common.swg, because we need to call it from both guile and tcl.
+ Add base_names to swig_class to delay the lookup of bases. SWIG
now exports the base names and only when the base swig_class is
needed is SWIG_TypeQuery(name)->clientdata looked up.
- conversion_ns_template testsuite test was failing because
the name of the wrapped constructor function was not calculated
correctly for structs. Fixed.
10/06/2004: wsfulton
Fixes for default arguments used in directors - in virtual
methods and director constructors.
10/06/2004: mmatus
Fix the __cplusplus macro, and bug 1041170.
Now it is working as supposed, ie, you can safely use
#ifdef __cplusplus
...
all over swig, including inside %defines and %{ %} bodies.
*** POTENTIAL INCOMPATIBILITY ***
The old trick of using
#if __cplusplus
doesn't work any more. So, if you have your own typemaps
using that syntax, you will need to migrate them to use
"#ifdef __cplusplus".
10/05/2004: wuzzeb (John Lenz)
- Reorganize how runtime type information is stored and shared
between modules. For chicken and mzscheme, I removed
the ability to use runtime libraries, while perl, tcl, python, and
ruby default to using the new method but can go back to the old
method by declaring SWIG_ALLOW_RUNTIME.
- line 582 in mzscheme.cxx was generating a segfault on
imports.multicpptest, so I fixed it.
10/05/2004: wsfulton
Fixes for %extend and overloaded static methods with default
arguments.
10/05/2004: mmatus
- [python] Fix director + method with 'empty' throw, ie
struct A {
virtual int foo() throw();
};
other languages should also easy to fix, look for
Getattr(n,"throw") in python.cxx.
- Fix director + destructor with 'empty' throw
struct A {
virtual ~A() throw();
};
- Now SWIG_FEATURES parse all and the same options you
can pass to swig in the command line.
- New command line flag: -features <list>, as in
swig -features autodoc=3,director
ie, any global feature can be initialized from the
command line. This is mainly for testing, but users
can also take advantage of it.
10/04/2004: mmatus
- Properly qualify type in syntax as 'long(2)' or 'Foo()',
this solve old problem with default args, and probably
other problems around. However, the default arg problem
was also already solved by William (see below).
- Fix feature_set and feature_get methods. Before
they look from particular to general and keep the first
feature found. This didn't work well with templates.
Now the methods look from general to particular, and
override any found feature.
- Previously a feature could not be applied to constructors
or destructors that weren't explicitly declared in the class.
This is now fixed, for example:
%feature("featurename") Foo() "..."
%feature("featurename") ~Foo() "..."
class Foo {
// implicit Foo() and ~Foo()
};
- Fix missing features for default const/dest, by really
'creating' the methods and applying the features.
- Fix return_const_value.i case by adding SwigValueWrapper<const T>
specialization.
- Fix %extend + overload, including overloading actual
class methods.
- Adding more cases in related files in the test-suite.
10/04/2004: wsfulton
Changes to the way default arguments are wrapped. Previously a single
method was generated for each method that had default arguments. If
a method had 5 arguments, say, of which 1 had a default argument
then the call to the wrapped method would pass 5 arguments. The default
value was copied into the wrapper method and used if the scripting
language passed just 4 arguments. However, this was flawed as the
default argument sometimes does not have global access, for example
SWIG would generate code that couldn't compile when wrapping:
class Tricky {
public:
void foo(int val = privatevalue);
void bar(int val = Tricky::getDefault());
private:
static int getDefault();
enum { privatevalue = 200 };
};
Also bugs in resolving symbols generated code that wouldn't compile, for example
(probably fixable though):
namespace Space {
class Klass {
};
Klass constructorcall(const Klass& k = Klass());
}
The approach also does not work for statically typed languages (C# and Java)
as these languages do not allow methods to have variable number of arguments.
Although C# has a mechanism to pass a variable number of arguments they
must be of the same type and are more like varargs.
The new approach solves the above problems and wraps methods with default
arguments as if the method was overloaded. So SWIG will now treat
void foo(int val=0);
as if it had parsed:
void foo(int);
void foo();
The code generated is then exactly the same as if SWIG had parsed the two
overloaded methods. The scripting languages count the arguments passed and call
the appropriate method, just like overloaded methods. C# and Java are now able
to properly wrap methods with default arguments by generating extra methods,
again as if the method was overloaded, so for:
void bar(string s="hello", double d=10.0, int i=0);
the following proxy methods are generated:
void bar(string s, double d, int i);
void bar(string s, double d);
void bar(string s);
void bar();
The new approach comes with a couple of minor knock on effects.
1) SWIG support for default arguments for C (not C++) code no longer works.
Previously you could have this interface:
%{
void foo(int val);
%}
void foo(int val=0);
and call the wrapped method from a scripting language and pass no arguments
whereupon the default of 0 was used. You can get the same behaviour for C
code by using the "default" typemap:
%typemap(default) int val "$1 = 0;"
%{
void foo(int val);
%}
void foo(int val);
or you could of course compile your code as C++ if you want C++ features :) :
%{
void foo(int val=0);
%}
void foo(int val=0);
A couple of SWIG's libraries used this C extension and these have been modified
to use the "default" typemap. The "default" typemap is thus unchanged (and still
is not and is not fully supported by C# and Java, and is likely to remain so).
2) All features (%feature, %rename, %ignore etc) no longer work as if the method
with default arguments is just one method. For example, previously
%ignore foo(int);
would have ignored the method completely. Now it will only ignore foo(int) but
not the extra foo() method. Instead use:
%ignore foo;
to ignore them all. or
%ignore foo(int);
%ignore foo();
This of course allows one to fine tune the wrapping, for example one could use:
%rename(fooint) foo(int);
%rename(foodefaults) foo();
void foo(int val=0);
and call them from any language like so:
fooint(200)
foodefaults()
or for example ignore the extra overloaded method, so the defaults cannot be used:
%ignore foo();
void foo(int val=0);
*** POTENTIAL INCOMPATIBILITY ***
10/2/2004: mmatus
[Python]
- More cleaning up and uniformation on the Python Lib
- Added Robin's docstring patch, plus some fixes, plus
some extensions, see autodoc.i example in the test-suite,
and try using %feature("autodoc","extended").
This patch is not a complete solution for the
documentation problem, just enough to inform python about
the parameter list.
The expected swig documentation support is far far away yet.
10/1/2004: mmatus
- Fix the %callback feature (only used in ruby and python examples,
by now, but it should be generic), now member callbacks
are working again
- Fix wrapping of functions pointers like
std::ostream& std::endl(std::ostream&);
ie, the ones that return references or enums.
[Python] Add the %pythoncallback directive, which is
an improved version of %callback, ie,
%pythoncallback(1) foo;
%pythoncallback(1) A::bar;
%pythoncallback(1) A::barm;
int foo(int a) {
return a;
}
struct A
{
static int bar(int a);
int barm(int a);
};
int foobar(int a, int (*pf)(int a));
in python you can use
foo(2)
foobar(2,foo)
A.bar(2)
foobar(2,A.bar)
ie, no additional pointer elements are created, and
the original 'foo' and 'A.bar' can be used as parameters.
In the case of member function however, still you need
to use the special variable Class::<fnc_name>_cb_ptr, ie:
foobarm(3, a, A.barm_cb_ptr)
we will try to fix this situation also, but later.
[Python] Add more elements from the STL library, now
you can use
import std
std.cout << "hello " << 123 << std.endl
[Python] Fix in/out return mechanism, now swig will behave
as 1.3.21 but using a python list when needed. The problem
is that the types std::pair,std::vector,etc, use tuples,
and they interfer with the previous inout tuple type.
By using lists we solve the conflicts, swig acts as before,
but returns a list when more than one parameter are using
the OUT typemap. See the new inout.i example in the
test-suite.
*** POTENTIAL INCOMPATIBILITY FOR PYTHON MODULE ***
[Python] Much better error messages for bad arguments, now
you always get the argument number where the error occurred.
09/27/2004: wsfulton
Patch from Bill Clarke -
1) Warning emitted when -importall and -includeall is used together,
with -includeall taking precedence.
2) Ensure SWIGIMPORTED is always defined when a file is being
imported with %import. Note that this is not the same as SWIGIMPORT,
which gets defined in all generated wrapper files.
09/26/2004: mmatus
- add %feature("exceptionclass") to identify a class used
as exception. Before swig identified and marked a class
using the "cplus:exceptionclass" attribute. However, the
class needed to appear on an throw() statement. Now
swig keeps trying to identify the exception classes, as
before, but it also allows the user to mark a class by
using the %feature explicitly. (mostly relevant for
python and chicken)
[Python]
- fix -modern option + exceptions, which mix old class
style with the new one. So, we always need to emit
the "nonmodern" python code.
- add the "python:nondynamic" feature and its handler
now if you have
%pythonnondynamic A;
struct A {
int a;
int b;
};
then, in the python side
aa = A()
aa.a = 1 # ok
aa.b = 2 # ok
aa.c = 3 # error, the class can not be extended dynamically.
Since this is a feature, you can use
%pythonnondynamic;
or
%pythondynamic; [ Note: %pythondynamic since deprecated ]
to force all the wrapped classes to be "nondynamic" ones.
The default, as in regular python, is that all the wrapped
classes are dynamics. So, careful with your spelling.
09/14/2004: mmatus
- Support the -I- option.
- Differentiate between %include <file> and %include "file".
This fix several corner cases.
[Python] Several patches:
- Normalize the Lib file names:
*.swg internal files,
*.i user files.
- Fix Char[ANY] typemaps, so they also delete any extra '\0' chars,
now they behave as before (1.3.21). Still, you can use
the SWIG_PRESERVE_CARRAY_SIZE macro if you need to
preserve the original size (see pystrbase.swg).
- Add the Char FIXSIZE[ANY] typemaps, to preserve the
original C array sizes (see above). Though, you can't
use them yet since %apply and arrays are not working
together.
- Add pyfragments.swg, now the user can add fragments
to override the default ones.
09/10/2004: wsfulton
Patch from Bill Clarke which fixes spurious preprocessor bug which
shows on Solaris and gcc, eg:
Warning(202): Could not evaluate '!defined(SWIGJAVA) &&
!(defined(SWIGCSHARP)'
Also fixes a bug where '#if "a" == "b" == 1' wouldn't have worked
09/10/2004: wsfulton
Restored multiple build directories for the test-suite. Patch from
Bill Clarke.
09/06/2004: wsfulton
Added the missing runtime.dsp Visual Studio project files for the
import examples to work.
Version 1.3.22 (September 4, 2004)
==================================
09/03/2004: wsfulton
The swig.m4 macro for use with the Autoconf/Automake/Libtool has
been removed and is no longer installed. Please use the new and better
maintained version derived from swig.m4 in the Autoconf macro archive.
See http://www.gnu.org/software/ac-archive/htmldoc/ac_pkg_swig.html and
http://www.gnu.org/software/ac-archive/htmldoc/ac_python_devel.html.
09/01/2004: wsfulton
[Perl] Applied patch #1019669 from Christoph Flamm. Adds support
for %feature("shadow") in the same way as it works in Python. This
enables one to override the generated shadow/proxy methods, including
constructors and destructors. For example:
/* Let's make the constructor of the class Square more verbose */
%feature("shadow") Square(double w)
%{
sub new {
my $pkg = shift;
my $self = examplec::new_Square(@_);
print STDERR "Constructed an @{[ref($self)]}\n";
bless $self, $pkg if defined($self);
}
%}
class Square {
public:
Square(double w);
...
};
08/31/2004: mmatus
[Python] Incompatibility reported by Bill Clarke (llib@computer.org):
If you are using Sun Studio 8 (and possibly earlier
versions) to compile the output produced by swig
1.3.22rc1, and you are using C++ and STL templates then
you need to use either "-runtime" or "-noruntime". If you
use neither of these options then you will probably get
compiler errors when trying to compile the wrapper file;
the error message will be like this: The name
SWIG_Python_ConvertPtr[...] is unusable in static
swigpy::traits_asptr[...] If you get this error message,
you need to regenerate your wrapper file using 'swig
-runtime' or 'swig -noruntime'.
You shouldn't get this problem with Sun Studio 9.
*** POTENTIAL INCOMPATIBILITY FOR PYTHON MODULE ***
08/26/2004: wsfulton
[Perl] Applied #932333 from Ikegami Tsutomu. Fixes long long *OUTPUT
and unsigned long long *OUTPUT typemaps in typemaps.i.
08/26/2004: wsfulton
Applied patch #857344 from Art Yerkes. Workaround for autoconf bug when
running 'make install'.
08/26/2004: wsfulton
[Perl] Part of patch #982753 applied. This implements a %perlcode directive.
It allows one to add Perl code to the generated .pm file. Works the same
as %pythoncode.
08/26/2004: wsfulton
[Java] Fix for directors when wrapping virtual methods with exception
specifications that were not simple types. Previously code was generated that
didn't compile, for example when the exception specification was a pointer.
08/25/2004: wsfulton
[C#] Typemap fix for methods that return char *. The CLR would incorrectly
delete the memory pointed to by char *. Also applied the same correction to
the char array typemaps.
08/24/2004: wsfulton
Fixes for -fmicrosoft error/warning message display:
- End of file (EOF) warning messages not displaying in correct format
- Some messages containing a file path were displaying a double backslash
instead of a single backslash
08/23/2004: wsfulton
Applied patch #1011604 submitted by Charles Schwieters. Fix for 64 bit tcl
interpreters.
08/23/2004: wsfulton
Fix for bug #875583 - enum forward declarations previously gave a syntax error.
08/23/2004: mkoeppe
[Allegro CL] Use typemaps "ffitype" and "lisptype" to determine the FFI type
specifiers from the C type. This makes it possible, for instance, to control
whether a C "char" argument takes a Lisp character or a Lisp integer value.
The default (taking Lisp characters) is done by these built-in typemaps:
%typemap(ffitype) char ":char"
%typemap(lisptype) char "character"
If char means an integer instead, use these typemaps:
%typemap(ffitype) char ":char"
%typemap(lisptype) char "integer"
08/22/2004: wsfulton
As discussed in bug #772453, the SWIG library directory is now installed
into a different default directory. The library used to be installed to
/usr/local/lib/swig1.3. It is now in the more usual architecture independent
directory and I have additionally used a version specific subdirectory as
the library will rarely work with older versions of SWIG. This release
will thus use /usr/local/share/swig/1.3.22 by default, which can be
tailored as before using './configure --swiglibdir'.
08/17/2004: mkoeppe
[MzScheme] Add support to create native MzScheme structures from C structures.
To convert a C structure to an MzScheme structure, use the new runtime macro
SWIG_NewStructFromPtr in a typemap. Patch from Dmitriy Zavin.
08/12/2004: wsfulton
Patch #837715 from Ben Reser to correctly detect Python lib directory
on 64 bit systems.
08/12/2004: wsfulton
[C# and Java] Prevent memory leaks in the case of early return
from wrapper methods using const std::string & parameters. Modified
Mark Traudt patch #951565.
08/12/2004: wsfulton
Bug #943783 with patch fixes php char * out typemap NULL values.
08/03/2004: Ahmon Dancy <dancy@dancy>
[allegrocl] Additional case mode fixes. Also, make sure
foreign types are exported.
07/24/2004: mkoeppe
[Guile] In -scm mode, SWIG modules now exchange their pointer type
information via the Guile interpreter. It is no longer necessary to build a
runtime library or to use -noruntime and -runtime etc.
The module (Swig swigrun) which was introduced in the change of 05/17/2004 is
no longer automatically built. If you need it, run SWIG on the interface file
swigrun.i.
07/23/2004: wsfulton
[C#] Bug #917601 Mapping C++ bool fix from Mark Traudt
07/23/2004: wsfulton
RPM fixes for latest CVS version including removal of runtime
library.
07/23/2004: wsfulton
Patch #908955 from Robert H De Vries.
RPM file generation fix for Fedore Core 1 and Redhat AS2.1.
07/12/2004: wsfulton
Patch #864689 from Robin Dunn:
This patch corrects two problems in the XML output of SWIG:
1. There were often extra '/>\n' in the output.
2. value attributes were output with '\n' in them but
since that is not technically legal most (all?) XML
parsers will strip them out. Replacing the '\n' with
the '&#10;' entity reference solves this as that is
legal and XML parsers will convert it to a '\n' when
reading the values back in.
This patch also adds a new global command line option
that will allow the parse tree to be written out in XML
*after* some other language module has been run, in
order to be able to get extra info that the language
module puts in the tree. In this way the XML is a
post-processed version of the tree rather than a
pre-processed version.
Command line option is -dump_xml or -xmlout <file>
07/12/2004: wsfulton
[Java] Patch from Scott Michel to fix typesafe enums and proper enums
with directors.
07/12/2004: wsfulton
HTML documentation (makechap.py) file generator missing end of line
patch #908951 from Robert de Vries.
07/08/2004: wsfulton
The deprecated runtime library build has been removed. This also removes
the dependency on Libtool. Libtool is no longer required to build SWIG.
The associated -ldflags SWIG commandline option has also been removed.
The examples and test-suite testcases that used the runtime library have
been updated to use the replacement approach to using SWIG across
multiple modules, that is they use the -noruntime and -runtime commandline
options, see Modules.html. Effectively they build their own runtime
libraries using -runtime. The examples are import and import_template.
The test cases are in the imports and template_typedef_import directories.
Anyone who wants the original runtime libraries can either run the test-suite
or build the examples and use the appropriate shared object/DLL that is
generated with the -runtime commandline option. For example libimports_runtime.so
(Python calls it lib_imports_runtime.so) is generated after running the
'make imports.multicpptest' testcase in the Examples/test-suite/<lang>
directory. Or use libruntime.so / runtime.dll after building the import
examples in Examples/<lang>/import.
07/07/2004: mkoeppe
[Allegro CL] Convert character and string literals in constants to
CL syntax. Fix FF:DEF-FOREIGN-CALL for mixed-case C functions.
06/27/2004: wsfulton
[Java] New feature for Java exceptions with format %javaexception(exceptionclasses).
This feature is a slight enhancement to %exception and the only difference is the
addition of the exception classes which are generated into a throws clause.
The 'exceptionclasses' is a comma separated list of classes which will be
added to the associated proxy method's throws clause. The 'exceptionclasses'
are specified like the exception classes in the 'throws' attribute in the
typemaps. This feature should be used for correctly handling checked exceptions
thrown from JNI code. For example:
%javaexception("java.lang.Exception") throwException %{
... convert a std::logic_error into a java.lang.Exception using JNI code ...
%}
#include <stdexcept>
void throwException() {
throw std::logic_error("Logic error!");
}
will generate a method with a throws clause in the module class:
public static void throwException() throws java.lang.Exception { ... }
06/27/2004: wsfulton
[C#] New %csconstvalue(value) feature directive for use with constants and
enums. This works the same way as %javaconstvalue. For C#, this directive
is the only way that one can fix wrapping of C/C++ enums with proper C#
enums if the enum item's initialiser cannot compile as C# code. This is
because Java enums can use a call into C code to initialise the enum item,
whereas in C#, the enum value must be a compile time constant. That is,
using %csconst(0) cannot be used in C# to initialise the C# enum item via
a PINVOKE call.
06/27/2004: wsfulton
[Java] New %javaconstvalue(value) feature directive for use with constants and
enums. Sometimes the use of %javaconst(1) will produce code that won't compile
under Java. If a compile time constant is required, %javaconst(0) is not an
option. The %javaconstvalue directive achieves this goal and the value specified
is generated as Java code to initialise the constant. For example:
%javaconst(1);
%javaconstvalue(1000) BIG;
%javaconstvalue("new java.math.BigInteger(\"2000\")") LARGE;
%javaconstvalue(10) bar;
%{
const int bar = 10;
%}
%inline %{
#define BIG 1000LL
#define LARGE 2000ULL
enum Foo { BAR = ::bar };
%}
Generates:
public interface exampleConstants {
public final static long BIG = 1000;
public final static java.math.BigInteger LARGE = new java.math.BigInteger("2000");
}
public final class Foo {
public final static Foo BAR = new Foo("BAR", 10);
...
}
Previously, none of BIG, LARGE or BAR would have produced compilable code
when using %javaconst(1).
06/27/2004: wsfulton
%feature enhancements. Features can now take an unlimited number of attributes
in addition to the feature name and feature value. The attributes are optional
and are much the same as the typemap attributes. For example, the following
specifies two optional attributes, attrib1 and attrib2:
%feature(featurename, attrib1="attribval1", attrib2="attribval2") name "val";
%feature(featurename, val, attrib1="attribval1", attrib2="attribval2") name;
06/27/2004: wsfulton
%feature improvements for the syntax that takes the feature value within the
%feature() brackets. The value specified is no longer restricted to being just
a string. It can be a string or a number. For example, this is now acceptable
syntax:
%feature("featurename",20.0);
whereas previously it would have to have been:
%feature("featurename","20.0");
Useful for features that are implemented as a macro, for example:
#define %somefeature(value) %feature("somefeature",value)
These will now work accepting either a string or a number:
%somefeature("Fred");
%somefeature(4);
06/06/2004: wuzzeb (John Lenz)
[Chicken, Guile]
- Created the Examples/test-suite/schemerunme directory, which holds all the
runme scripts for guile and chicken (and possibly mzscheme...). The guile
and chicken _runme files then (load "../schemerunme/foo.scm").
- In chicken module, fix a few bugs invlolving dynamic casts.
06/03/2004: wsfulton
Patch to fix wrapping of templated methods. ISO compliant compilers, like
Comeau and GCC-3.4.0, don't like the template specifier that SWIG was generating
when calling the method. This fix may break some non standard compliant compilers,
for example, Sun workshop compilers prior to version 6.2.p2. Patch submitted
by Bill Clarke.
06/03/2004: wsfulton
[Java, C#] Undocumented special variable $imclassname removed.
New special variable $module is replaced by the module name, as specified
by %module or -module commandline option. $imclassname can be created from $module.
06/03/2004: wsfulton
[C#] Same as for Java below. The new typemaps are named differently, namely,
csbody and csbody_derived. The deprecated typemaps are csgetcptr and
csptrconstructormodifiers.
*** POTENTIAL INCOMPATIBILITY FOR C# MODULE ***
06/03/2004: wsfulton
[Java] Typemap changes for the Java proxy / typewrapper and enum classes. A new
typemap called javabody contains the essential support code for generation into the body
of these classes. There is also a new javabody_derived typemap which is used instead for
wrapped classes that have a wrapped base class. The code is basically, the getCPtr()
method and swigCPtr and swigCMemOwn member variables. These used to be hard coded
with no way to modify the code. The introduction of this typemap makes it possible for
the user to tailor nearly every aspect of the code generation.
The exception now is the code for director classes.
The javagetcptr and javaptrconstructormodifiers typemaps are deprecated and are
no longer used as the code that these generated can be put in the more flexible
javabody and javabody_derived typemaps.
*** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
The following macros contributed by Scott Michel may help you upgrade if you have used
the javagetcptr typemap:
/* Utility macro for manipulating the Java body code method attributes */
%define SWIGJAVA_ATTRIBS(TYPENAME, CTOR_ATTRIB, GETCPTR_ATTRIB)
%typemap(javabody) TYPENAME %{
private long swigCPtr;
protected boolean swigCMemOwn;
CTOR_ATTRIB $javaclassname(long cPtr, boolean cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = cPtr;
}
GETCPTR_ATTRIB static long getCPtr($javaclassname obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
%}
%typemap(javabody_derived) TYPENAME %{
private long swigCPtr;
CTOR_ATTRIB $javaclassname(long cPtr, boolean cMemoryOwn) {
super($moduleJNI.SWIG$javaclassnameUpcast(cPtr), cMemoryOwn);
swigCPtr = cPtr;
}
GETCPTR_ATTRIB static long getCPtr($javaclassname obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
%}
%enddef
/* The default is protected getCPtr, protected constructor */
SWIGJAVA_ATTRIBS(SWIGTYPE, protected, protected)
/* Public getCPtr method, protected constructor */
%define PUBLIC_GETCPTR(TYPENAME)
SWIGJAVA_ATTRIBS(TYPENAME, protected, public)
%enddef
/* Public getCPtr method, public constructor */
%define PUBLIC_BODYMETHODS(TYPENAME)
SWIGJAVA_ATTRIBS(TYPENAME, public, public)
%enddef
06/03/2004: wsfulton
[Java, C#] The contents of the class modifier typemaps and pragmas have changed.
They must now include the class type. Previously 'class' was hard coded.
This change enables flexibility into what type of class is generated,
for example the proxy class could be an interface instead of a class.
For Java this affects the javaclassmodifiers typemap and the jniclassclassmodifiers
and moduleclassmodifiers pragmas.
For C# this affects the csclassmodifiers typemap and the imclassclassmodifiers
and moduleclassmodifiers pragmas.
Unless you have overridden the default versions of these typemaps or pragmas, you
shouldn't be affected. However, if you have, upgrading is easy, for example
class Foo {};
%typemap(javaclassmodifiers) Foo "public final"
must now be:
class Foo {};
%typemap(javaclassmodifiers) Foo "public final class"
*** POTENTIAL INCOMPATIBILITY FOR C# MODULE ***
*** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
05/31/2004: wsfulton
Fix for C++ exception specifications that are references. Problem reported by
Oren Miller. Also improves the generated exception declarations in the
catch handler for pointers - a pointer is used instead of a reference to
a pointer. Added default throws typemaps for SWIGTYPE &, SWIGTYPE * and
SWIGTYPE[ANY] (Java and C#).
05/31/2004: wsfulton
[Java, C#] Some minor typesafe enum improvements, including storing the name of
the enum item. The toSring() / ToString() methods are overridden to return this name.
05/30/2004: wuzzeb (John Lenz)
[Chicken]
- Update how examples and the test suite are built.
- Symbol names are no longer converted to lower case
- Added union_runme.ss, which was copied and modified from the guile module
05/26/2004: lballabio (Luigi Ballabio)
Committed on behalf of Marcelo (who still has problems with
the SourceForge CVS.)
Added Python typemaps for FILE* with (Python-only) test.
5/24/2004: dancy
* Allegro CL module: Now using some macros (defined in
Lib/allegrocl/allegrocl.swg), swig-defconstant and swig-defun, for
defining constants and foreign functions. This makes the
generated file a bit neater.
Now strips a layer of parenthesis from constants.
Uses (* :void) instead of :foreign-address now.
05/20/2004: wsfulton
Unnamed enum global variables are now supported in addition
to the recently added support for unnamed enum member variables.
For example:
struct Foo {
enum { enum1, enum2 } MemberInstance;
};
enum { enum3, enum4 } GlobalInstance;
The int typemaps are used for wrapping the get/set accessor methods.
If the sizeof an enum is not the same size as an int then setting the
variable will silently do nothing as the casts cannot be easily and portably
generated. If you need to solve this highly obscure situation, write
the assignment using the %exception feature.
05/20/2004: wsfulton
[C#] C# enum wrapping mods. Similar to the Java module, enums can be wrapped using
one of 3 approaches:
1) Proper C# enums - use %include "enums.swg"
2) Typesafe enums - use %include "enumtypesafe.swg"
3) Simple constant integers (original approach) - use %include "enumsimple.swg"
See each of these files for further details. Each of these files use typemaps
and a new feature to control the generated code. The feature is:
%csenum(wrapapproach);
where wrapapproach should be one of: "proper", "typesafe", "typeunsafe" or "simple".
[No implementation deemed necessary for type unsafe enums].
The default approach is proper C# enums. Anonymous enums are always wrapped by
constant integers.
*** POTENTIAL INCOMPATIBILITY FOR C# MODULE ***
05/20/2004: wsfulton
[Java] Java enum support added. There are now 4 ways in which enums can be wrapped:
1) Proper Java enums - use %include "enums.swg"
2) Typesafe enums - use %include "enumtypesafe.swg"
3) Type unsafe enums (constant integers) - use %include "enumtypeunsafe.swg"
4) Simple constant integers (original approach) - use %include "enumsimple.swg"
See each of these files for further details. Each of these files use typemaps
and a new feature to control the generated code. The feature is:
%javaenum(wrapapproach);
where wrapapproach should be one of: "proper", "typesafe", "typeunsafe" or "simple".
The default typemaps will handle enums that may or may not have specified initial
values, for example ten is specified:
enum Numbers { zero, ten(10) };
However, the amount of generated Java code can be cut down, by modifying these typemaps
if none of the enums have initial values (proper Java enums and typesafe enums approach).
The default approach is typesafe enums. Anonymous enums are always wrapped by
constant integers.
*** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
05/11/2004: wsfulton
[Java, C#] Fix bug using %rename on enum items and when using
%javaconst(1) / %csconst(1)
For example, the following used to generate code that wouldn't compile:
%rename(Obj) Object;
enum Grammar { Subject, Object };
04/28/2004: wsfulton
[Java, C#] Minor fixes when using combinations of the
javainterfaces, javabase, csinterfaces and csbase typemaps.
05/18/2004: wsfulton
[Java] JVM link failure on some systems fixed when using std_vector.i.
Also adds default vector constructor for use from Java.
05/17/2004: mkoeppe (Matthias Koeppe)
[Guile] New runtime functions SWIG_PointerAddress,
SWIG_PointerType, SWIG_IsPointerOfType, SWIG_IsPointer.
[Guile] In -scm mode, wrap several SWIG runtime functions
and export them into the module (Swig swigrun). The
runtime module is now built with "module" linkage.
[Guile] GOOPS proxy objects now also print the pointer
address of the C object.
05/14/2004: lyle
Added Kou's patch for the Ruby %import directive so that modules
with "nested" names are handled properly. Consider an interface
file foo.i that has this %module declaration at its top:
%module "misc::text::foo"
Now consider another interface file spam.i that imports foo.i:
%import foo.i
Before this patch, this would result in the following code being
generated for spam_wrap.c:
rb_require("misc::text::foo");
With this patch, however, you'll get the correct path name
for the call to rb_require(), e.g.
rb_require("misc/text/foo");
See SourceForge Bug #928299.
05/12/2004: wsfulton
Patch for emitting directors when %feature("director") specified
for a class with no virtual methods, but does have a virtual destructor.
Submitted by Kevin Smith.
05/06/2004: mkoeppe (Matthias Koeppe)
New SWIG runtime function SWIG_TypePrettyName, which
returns an unmangled type name for a swig_type_info
object.
[Guile]: Use it for printing pointer objects.
05/03/2004: dancy (Ahmon Dancy)
* Lib/allegrocl/allegrocl.swg: Updated comments about identifer
conversion.
* Sources/Modules/allegrocl.cxx: Register /dev/null for "header"
target. Also, disregard "const" qualifiers during type
conversion.
05/02/2004: wuzzeb (John Lenz)
[Chicken] Fix bug 782468.
To fix this bug, the runtime code has been rewritten, and
pointers are now represented as a C_SWIG_POINTER_TYPE.
Chicken version > 1.40 is now required!
* Typemap incompatibility: typemaps no longer use chicken_words.
If a typemap needs some space, it should just call C_alloc
* argout typemaps no longer use the /* if ONE */ construct to
build an output list. A SWIG_APPEND_VALUE macro, exactly like
guile and mzscheme is now used.
04/25/2004: mkoeppe (Matthias Koeppe)
[Guile] In the generated GOOPS code, don't create methods
that would not specialize any arguments; simply re-export
the primitive functions. (This is a performance
optimization which reduces load time and execution time.)
[Guile] In -gh mode, fix the "too many initializers" error
which was caused by an incompatible swig_type_info layout.
[Guile] The typemap for FILE * in ports.i now also accepts
a regular FILE * pointer object. Also a bug with Scheme
file ports that are open for input and output has been
fixed.
04/25/2004: wsfulton
Change entry 03/21/2004 revoked. The change introduced another
inconsistency (reference typemaps beings used instead of
pointer typemaps for member variables as well as static
member variables and global variables for some languages,
but only for C++ and not C). This would break user's current
typemaps and introduce further inconsistencies. Alternative
solution required and being discussed.
04/10/2004: mmatus (Marcelo Matus)
Added the -directors flag. This enables the director
mode for the interface and all the classes that
don't set the "feature:nodirector" explicitly.
You can use this in your module if you want to use the
director feature in all your classes, but it is most
intended for testing purposes, like:
make check-python-test-suite SWIG="../../../swig -directors"
make check-ruby-test-suite SWIG="../../../swig -directors"
make check-java-test-suite SWIG="../../../../swig -directors"
These commands will run the entire test-suite using
directors, and not only the specific 'directors_*'
cases. This should be done from time to time.
04/10/2004: mmatus (Marcelo Matus)
[python] Added support for std::wstring and wchar_t,
for compiler and python versions that support them.
When needed, use
%inlcude std_string.i // 'char' strings
%inlcude std_wstring.i // 'wchar_t' strings
04/10/2004: mmatus (Marcelo Matus)
[python] Fix the default behaviour (seg. fault) when an
inplace operator (+=,-=,...) was wrapped, as reported by
Lucriz (lucriz@sitilandia.it), when the most common
form was used:
A& A::operator+=(int i) { ...; return *this; }
^^^^ ^^^^^^
ie, an object is returned and its contains the same 'this'
value than the input object, which is deleted after the
operation "a += b", leaving the result with no real
object, but a seg. fault.
To fix it, we needed to introduce a new feature and use an
old one:
%feature("self:disown") A::operator+=;
%feature("new") A::operator+=;
here, "self:disown" disable the ownership of the 'self'
or input object, and the "new" feature transfers the
ownership to the result object.
The feature/solution could also be used in other languages
that use gc and implement the inplace operators, or other
operators, in a similar way.
*** POTENTIAL INCOMPATIBILITY FOR Python MODULE ***
If you already are using the inplace operators in python,
and you implemented some kind of workaround to the problem
fixed here, it is possible you could end with 'free'
objects that never get deleted. If that is the case, and
you want to disable the current fix, use:
%feature("self:disown","") A::operator+=;
%feature("new","") A::operator+=;
04/07/2004: cheetah (William Fulton)
[C#] C++ enums are no longer wrapped by integers, they are now wrapped by
C# enums. For Example, given C++:
enum AnEnum { foo, bar };
typedef AnEnum AnEnumeration;
void something(AnEnum e, AnEnumeration f);
The following is generated:
public enum AnEnum {
foo,
bar
}
public static void something(AnEnum e, AnEnum f) {...}
Note that a global enum like AnEnum above is generated into its own
file called AnEnum.cs. Enums defined within a C++ class are defined
within the C# proxy class. Some of the typemaps for modifying C# proxy
classes also work for enums. For example global enums can use
%typemap(csimports) to add in extra using statements.
Global enums and class enums can use
%typemap(csclassmodifiers) to make the enum private, public etc.
%typemap(csbase) to change the underlying enum type (enum base)
If we add this for the above example:
%typemap(csclassmodifiers) AnEnum "protected"
%typemap(csbase) AnEnum "long"
the following is generated:
protected enum AnEnum : long {
foo,
bar
}
*** POTENTIAL INCOMPATIBILITY FOR C# MODULE ***
04/07/2004: cheetah (William Fulton)
Seg fault fix for empty enums, like
enum Foo {};
03/21/2004: mmatus
[Note: this change revoked on 04/25/2004]
[Python] Makes the following 'var' cases more uniform:
std::string ga;
struct A {
static std::string sa;
std::string ma;
};
now the three variables (ga, sa, ma) can be assigned as:
cvar.ga = "hello";
A.sa = "hello";
a.ma = "hello";
ie, now 'ma' will also use a std::string typemap 'in' if
defined, before it was only accepting a 'p_std_string'
pointer. Note, however, that 'ma' will not use the
'varin/varout' typemaps (that probably could be more
natural), but it will pick up the 'in' typemap for const
std::string& (which is easier).
The changes in cwrap.c and lang.cxx will probably fix the
behaviour in other languages that do not overload the
membervarHandler method "too much".
03/21/2004: mmatus
[Python] Disabling the default instantiations like:
%template() std::pair<int,int>;
for all the primitive types and STL containers/classes.
They are expensive, specially for pair and map, and the
previous behaviour also requires the user to perform
manual instantiations. Still, if the speed difference is
not important, it can be re-enabled by defining the macro
SWIG_STD_DEFAULT_INSTANTIATION (see std_common.i).
Also, normalizing the INPUT/OUTPUT/INOUT typemaps. Now
they use the same conversors than the rest of the
typemaps, and you can use them for std::pair, std::string
and all the other STL types, like in:
void p_inoutd(std::pair<double, double> *INOUT);
Added the attribute.i and implicit.i files with macros to
transform functions pairs like 'set_x'/'get_x'
(or 'T& x()'/'const T& x() const') into an attribute,
and allowing the use of implicit constructors in typemaps
(see the files for more details).
03/21/2004: mkoeppe
[Guile] Fix the documentation strings of functions with
anonymous arguments.
03/18/2004: mmatus
[Python] More general std_string.i interface.
Now you can wrap it using
%template(string) std::basic_string<char>;
and use the std::string as a base class:
struct A : std::string {
};
But more important, swig will recognize
both std::basic_string<char> and std::string as
the same type.
03/16/2004: mmatus
Previously added, but not mentioned before:
- friend declaration support, swig now emits a global
function in the same class scope.
- ref/unref features: to mix ref counting C++ classes
and native script ref counting mechanisms (like in python).
Use it like:
%feature("ref") RCObj "$this->ref();"
%feature("unref") RCObj "$this->unref();"
And the class RCObj, and all the derived ones, will
perform the right ref/unref calls when a new pointer
is returned to the target language, or when the target
language attempts to delete the object.
See the refcount.i file in the test-suite for more
details.
03/16/2004: mmatus
[Python] Using the new %fragment support, major rewrote
of the python swig library, including:
- Almost automatic template/typemap instantiation for
the STL components. For example, now you can write:
%template(vector_i) std::vector<int>;
and a specialized vector_i class is emitted with all
the needed typemaps. No need to use the old
'specialize_vector' macros.
Note you can also define
%template(matrix_i) std::vector<std::vector<int> >;
%template(vector_pii) std::vector<std::pair<int,int> >;
- The empty template instantiation
%template() std::vector<int>;
defines the vector typemaps, but no proxy class. For all the
fundamental types, the empty template instantiation are
defined, so, you can say
%include std_vector
int func(const std::vector<int>& a);
where the proper typemap is applied to 'a', but no
std::vector<int> proxy is generated.
- All the STL containers present a more uniform behavior and
more complete interface declaration. The following are
now supported:
std::vector<T>
std::list<T>
std::deque<T>
std::set<T>
std::multiset<T>
std::map<T>
std::multimap<T>
not a container, but also supported:
std::pair<T,U>
also, more typemaps are defined for all of them,
including varin, varout, typecheck, etc.
- Initial attempt to implement the STL containers
considering allocators, ie:
std::vector<T,A>
it is partially working, but it is just a workaround
while swig improves its template type support.
Please test with your particular setup. It seems to be
working with g++ 3.2.2, g++ 2.96, Intel icc and SGI CC
compilers, plus python 1.5.2, 2.0 and 2.3, but since
we are using templates, there is a chance you can find
some problems when using with an old C++ compiler.
03/16/2004: mmatus
- Allowing the empty %template directive, such as
%template() std::vector<int>;
to process the class "typedef"s and "typemap"s. Before
only the internal "typedef"s were processed.
This makes possible to emit the default in/out
typemaps without the need of wrapping an specialized
vector instance.
- Adding the preprocessor extension #@ which mangles the
following macro argument, like in:
#define macro(X) #@X
macro(int) -> int
macro(std::string) -> std_s_s_string
- Fragments can now be "type specialized", as the typemaps. The
syntax is as follows
%fragment("name","header")
{ /* a type independent fragment (old syntax) */ }
%fragment("name" {Type}, "header")
{ /* the fragment is type dependent */}
Now fragments can also be used inside templates:
template <class T>
struct A {
%fragment("incode"{A<T>},"header") {
/* 'incode' specialized fragment */
}
%typemap(in,fragment="incode"{A<T>}) {
/*
here we use the 'type specialized'
fragment "incode"{A<T>}
*/
}
};
03/11/2004: cheetah (William Fulton)
[Java] Director bug which meant that some virtual functions overridden in
Java were not being called on some operating systems. Bug reported and fixed
by Robert de Vries and Scott Michel.
03/02/2004: mkoeppe (Matthias Koeppe)
[Guile] In -scm mode, don't forget to check the type of string arguments.
02/24/2004: cheetah (William Fulton)
[C#] New commandline option -namespace <name>. This allows one to specify
a C# namespace into which all C# classes are generated.
02/23/2004: mkoeppe (Matthias Koeppe)
[MzScheme] Use FUNC_NAME rather than a bogus typemap variable for signalling
errors. Call scheme_wrong_type with a zero-based argument number.
Reported by Ondrej Pacovsky, SF #902621.
[Guile] Define FUNC_NAME also in the dispatch wrapper for overloaded
functions. Patch by John Lenz, SF #896255.
02/22/2004: mkoeppe (Matthias Koeppe)
[Guile] In -scm mode, don't try to invoke a null destructor function.
02/20/2004: cheetah (William Fulton)
Fixes so that the SWIG source will compile using the Digital Mars Compiler
(formerly Symantic compiler) on Windows. Submitted by Scott Michel.
02/13/2004: mkoeppe (Matthias Koeppe)
[MzScheme] New command-line argument -noinit. Use it for building
the runtime library, where we don't want to define the functions
scheme_initialize etc. Reported by Tim Brown, SF #891754.
[MzScheme] Don't produce invalid C code when invoked with the
-declaremodule option. Reported by Tim Brown, SF #891108.
[Guile] Build the runtime library with passive linkage, to rename
the SWIG_init function uniquely.
02/12/2004: cheetah (William Fulton)
[Java, C#] Patch submitted by Bill Hoffman which prevents SWIG from crashing
when a file for the typewrapper class cannot be opened.
02/11/2004: cheetah (William Fulton)
[Java, C#] Overloading changes:
- Methods which are overloaded in const only no longer generate Java
code that won't compile - the first method parsed is used and a
warning is displayed. Note that this behaviour is slightly different
to the scripting languages which always uses the non-const method.
- Warning messages 509 and 512 replaced by new warning number 516, which
is more relevant to these statically typed languages as the overloaded
methods aren't 'shadowed', they are ignored.
01/23/2004: mkoeppe (Matthias Koeppe)
[Guile] Replace the "known_classes" hash table by a node
attribute. Methods of classes in C++ namespaces now get
the proper specializer in the GOOPS declaration.
Reported by rm@mh-freiburg.de.
01/23/2004: mkoeppe (Matthias Koeppe)
[Guile] Uniquify the argument names in GOOPS shadow method
declarations. Reported by rm@mh-freiburg.de.
01/21/2004: sunshine (Eric Sunshine)
Revived the NextStep port of SWIG.
Fixed fatal problem in DohStrstr() caused by difference in strstr()
implementation which made %apply become entirely dysfunctional. On
NextStep, strstr("foo","") evaluates to NULL; whereas, on modern
platforms, it evaluates to "foo". %apply relies extensively upon
strstr("foo","") evaluating to non-NULL, therefore it failed
catastrophically when faced with NextStep's strstr().
Added `bool' check to configure.in since NextStep's C++ compiler
does not supply this type. swig.h now fakes up `bool' if needed.
Worked around NextStep C++ compiler bug in which C++ code is
disallowed inside extern "C" functions. This problem affected all
language modules, since they publish hook functions of the form:
extern "C" Language *swig_foo(void) { return new FOO(); }
Fixed by creating a C++ wrapper:
static Language *new_swig_foo() { return new FOO(); }
extern "C" Language *swig_foo(void) { return new_swig_foo(); }
Ensured that Swig_copy_string() is used in place of strdup() since
NextStep does not supply strdup().
Fixed detection of Ruby library name and location in configure.in.
Problem 1: Assumed that library always resided in Ruby's "archdir",
which was correct for Ruby 1.6.x, but which is incorrect for Ruby
1.8.x, in which case the library normally resides in Ruby's
"libdir". Problem 2: Assumed that the library could always be
linked via "-l"+RUBY_INSTALL_NAME (where RUBY_INSTALL_NAME
typically is "ruby"), however this failed for platforms, such as
NextStep, which do not support shared libraries. In this case, the
static library name in 1.8.x is libruby-static.a, thus
-lruby-static is required. The new logic works correctly for
static and shared libraries for 1.6.x and 1.8.x.
Fixed detection of Perl CFLAGS in configure.in for NextStep.
Detection code extracted CFLAGS from Perl's %Config hash but
neglected to add a newline to the value before passing it through
`sed'. NextStep's ancient `sed' discards input which is not
terminated with a newline, thus Perl CFLAGS always evaluated to the
empty string.
01/16/2004: cheetah (William Fulton)
Tidy up in the exception handling code that is generated when
C++ exception specifications are wrapped with the throws typemap.
This redundant code is no longer generated:
catch(...) {
throw;
}
01/12/2004: wsfulton on behalf of mmatus (marcelo matus)
if a method uses %exception and the method requires the use
of the throws typemap, the code in a throws typemap will be
generated inside the try body. For example:
%exception method {
try {
// method action
$action
} catch (int i) {
// method int catch handler
} catch (...) {
// method generic catch handler
}
}
%typemap(throws) Except %{
// throws typemap Except catch handler
%}
%inline %{
class Except {};
void method(int i) throw (Except);
Will generate:
{
try {
// method action
try {
method(arg1);
}
catch(Except &_e) {
// throws typemap Except catch handler
}
} catch (int i) {
// method int catch handler
} catch (...) {
// method generic catch handler
}
}
As can be seen, the inner try catch block is for the throws typemaps.
Previously, this was reversed so that the inner try catch block
was the %exception code. In the example above, it would have been
impossible to catch Except as the catch all (...) would catch the
exception instead.
Version 1.3.21 (January 11, 2004)
=================================
01/10/2004: cheetah (William Fulton)
The output format for both warnings and errors can be selected for
integration with your favourite IDE/editor. Editors and IDEs can usually
parse error messages and if in the appropriate format will easily take you
directly to the source of the error. The standard format is used by
default except on Windows where the Microsoft format is used by default.
These can be overridden using command line options, for example:
$ swig -python -Fstandard example.i
example.i:4: Syntax error in input.
$ swig -python -Fmicrosoft example.i
example.i(4): Syntax error in input.
01/09/2004: beazley
Fixed [ 871909 ] simple namespace problem.
This was a problem using anonymous structures in a namespace.
For example:
namespace ns {
typedef struct {
int n;
} S;
};
Reported by Josh Cherry.
01/09/2004: beazley
Fixed some broken Perl examples.
12/28/2003: cheetah (William Fulton)
[Java and C#] Fixes for wrapping covariant (polymorphic) return types.
For example:
struct Base {
virtual ~Base();
virtual Base* copy() const = 0;
};
struct Derived : Base {
virtual Derived* copy() const;
};
The Derived::copy proxy method returns Base not Derived. A warning is issued
about this. Previously the pointer used by the proxy class was incorrectly
treated as a Base* instead of a Derived*.
12/18/2003: cheetah (William Fulton)
Fix so that Windows paths are displayed correctly when reporting errors.
An error previously would have been shown something like:
.?xample.i:14: Syntax error in input.
instead of:
.\example.i:14: Syntax error in input.
Version 1.3.20 (December 17, 2003)
==================================
12/17/2003: beazley
Last minute modifications. Perl5 module now generates shadow classes
by default like all of the other modules. PHP4 wrappers no longer
include "config.h".
12/14/2003: beazley
Weakened warning message related to constructor names so that an
unusual nested-class wrapping technique would work again (apparently
it worked in some older SWIG releases). For example:
class Scope {
class ClassA;
class ClassB;
};
class Scope::ClassA {
...
};
class Scope::ClassB {
...
}
Note: There is still some odd interaction with the SWIG symbol
table/type system that will need to be looked at in a future release.
Reported by Gustavo Niemeyer.
12/11/2003: cheetah (William Fulton)
[Java] Protected class methods are wrapped as protected Java methods
when using the dirprot director feature. This can be changed using
%javamethodmodifiers to something else should the need arise, for
example, private or package access.
12/11/2003: cheetah (William Fulton)
[Java, C#]
%javamethodmodifiers (Java) and %csmethodmodifiers (C#) operate slightly
differently. Previously this feature had to be present to set the method
modifiers. Now it is only used if it exists for the method being wrapped.
The default is "public" as previous however, when wrapping protected
director methods it is "protected". This change will not affect existing
use of the %javamethodmodifiers or %csmethodmodifiers.
12/11/2003: mmatus (Marcelo Matus)
This fix some recurring reports about keywords not been
properly identified and warned, and it solves the problem
of how to add a test file to the test-suite such that it
doesn't use any keyword of all the supported languages
(and doing it without compiling the test for all the
supported languages, thing that is not always possible,
and without requiring you to know all the supported
language keywords, thing that is always impossible).
So these are the changes globally speaking:
- Uniform the definition of the keyword warnings through
the supported languages: all the languages has now a
separate file that defines the keywords or bad names:
python/pythonkw.swg
chicken/chickenkw.swg
....
- Added keyword list for most of the languages that didn't
have one (using the new separated file).
- Added the "All keywords" warning support: -Wallkw option.
This option allows you to include all the known keywords
for all the supported languages, and can be used as:
swig -Wallkw ....
This will help to the process of adding a test-suite
file that can be compiled in all the swig supported
languages, and it will be also helpful for users who
want to create multi-language libraries.
And these are the detailed changes (mostly file addition):
- For the languages that already have some sort of keyword
warning list, move it to an external languagekw.swg
file, ie:
move keywords from python.swg -> pythonkw.swg
move keywords from chicken.swg -> chickenkw.swg
move keywords from tcl8.swg -> tclkw.swg
and re-include languagekw.swg from language.swg.
- For the language that didn't have a keyword list, and
for the ones that I could find a list, add the
languagekw.swg file, ie:
csharp/csharpkw.swg
java/javakw.swg
php4/phpkw.swg
pike/pikekw.swg
ruby/rubykw.swg
also add a line in language.swg to include
languagekw.swg, but now it is commented!!!, like in
java.swg:
/* java keywords */
/* please test and activate */
//%include "javakw.swg"
ie, there will be no change in how swig runs normally
until the language maintainer test and uncomment that
line.
So, please check each languagekw.swg file (I left the
link to the keyword list source for checking), and after
testing, uncomment the %include line.
- Added the file allkw.swg, which includes all the
languagekw.swg files.
For the languages that has no languagekw.swg file right
now, and if they need one, add the file into the
language directory, and add the corresponding include
line into the allkw.swg file.
- Added the -Wallkw that includes the allkw.swg file.
Note that the old -lallkw.swg option couldn't be used
since it include the file after it would be needed.
Hopefully, the -Wallkw option will be added to the default
rules in the related test-suite Makefiles, so, when
creating a new test, or adding a new swig library file
(like _std_deque.i), swig will warn you if you are using a
bad name, considering all the language where it needs to
run.
Right now you can test it by using:
make check-python-test-suite SWIG="swig -Wallkw"
or using your favorite target language, it doesn't matter.
And yes, there are several examples that are using
reserved keywords, specially from csharp.
*** Remember ****: the new keyword warning lists are not
included by default in any of language that before didn't
have one. To enable the keyword warnings as the default
behavior, the inclusion of the languagekw.swg file has to
be uncommented at each language.swg file.
So, all the language maintainers, please check the
keywords list.
Also, you can add buit-in names, and not only keywords, like
'True/False' in python. Remember that you can be more
specific and refer only to member names, like *::configure
or *::cget (see an example in the tcl8/tcl8kw.swg file),
or only global names, like ::range (see an example in the
python/pythonkw.swg file.
Just to be consistent, use the following codes:
- Use code 314 for keyword and/or fatal bad names.
- Use code 321 for buit-in and/or not fatal bad names.
so, they can't be disabled/enabled independently (see
python/pyhtonkw.swg for examples).
**** And don't add any new test file without checking it
with the -Wallkw option!! (that includes me) *****.
12/11/2003: cheetah (William Fulton)
SF bug #854634
Added support for accepting the Unix directory separator '/' on
Windows and the Mac in addition to the native one ( '\' on
Windows). This can be used in %import, %include and commandline
options taking a path, for example -I. On Cygwin, both the Windows
and Unix directory separator can now be used (was '/' only).
12/10/2003: mmatus (Marcelo Matus)
[python] Implementing the runtime "reprotected" director
members, if you have:
%feature("director") B;
class Bar {
public:
virtual ~Bar();
virtual int hello() { return do_hello();)
protected:
virtual int do_hi() {return 0;}
virtual int do_hello() {return 0;}
};
then, at the python side
import my_module
class Foo(my_module.Bar):
def do_hello(self):
return 1
pass
b = Bar() # Pure C++ Director class
f = Foo() # C++ Director + python methods
b.hello() # Ok, and it calls C++ Bar::do_hello()
f.hello() # Ok, and it calls Python Foo::do_hello()
b.do_hi() # RuntimeError, do_hi() is protected!!
f.do_hi() # RuntimeError, do_hi() is protected!!
b.do_hello() # RuntimeError, do_hello() is protected!!
f.do_hello() # Ok, since it its redefined in python.
Here Bar.do_hello is always protected, but Foo.do_hello
is "public", because it is redefined in python. Before,
all the 'do_hello' methods were public.
This seems to be a good compromise between C++ and python
philosophies, ie, all the director protected methods keep
protected at the user side (C++ way) until they are
redefined (python way, were all defined methods are always
public). And this is not only a good compromise, it also
seems to be the only way to do it :).
Now ruby has native director protected members, and python
pure runtime support. I guess these are the two possible
extreme cases. And hopefully, they could be used as
templates to modify the other languages that support
directors, so they can "reprotect" the protected director
members at the target language side.
This finished the director protected support for the
python language. Ocalm will need to add the
"reprotection" later.
12/10/2003: mmatus (Marcelo Matus)
The following case (reported by Lyle Johnson) was fixed:
%rename(x) Foo::y();
class Foo {
public:
void y();
protected:
int x;
};
swig warned that the symbol 'x' was already defined, and
the renaming fails. 'x' was not emitted, since it is
protected, but it was kept in the symbol table with too
much information.
Now swig works for all the cases (plain, director and
dirprot) again. This was fixed by allowing the parser.y to
decide much closer what to do with 'x'. Before all the
discarding or generation was resolved at the lang.cxx
stage. Also the changes in parser.y to implement the
director protected mode are now much more encapsulated, and
they get disabled if the mode is not enabled. Before the
deactivation was done at the generation stage (lang.cxx).
By the other hand, if the director mode is enabled, and
%rename is done, reusing a protected member name, there is
a pathological case:
%rename(x) Foo::y();
class Foo : public A {
public:
void y();
protected:
int x; /* works */
static int x; /* works */
static void x(); /* works */
typedef void x(); /* works */
virtual void x(); /* always fails, as it should, since
Foo::x() will be emitted in the
director */
void x(); /* always fails, but sometimes it shouldn't,
since the Foo::x() will not be emitted if
it is not virtual */
};
The last case is not always right because at the parser.py
stage it is not possible to decide if the protected member
Foo::x() could or not conflict with the renamed Foo::y(),
since Foo::x() could be virtual by inheritance.
I guess this just an intrinsic limitation, and no much can
be done about it without resorting into larger changes to
postpone, under certain conditions, the multiply symbol
detection (lang.cxx stage).
So, by now, it is just considered a well known "feature" in
the director protected mode. The good news is that it seems
to be a rare case, and it can be avoided by the user by
hiding 'x' before renaming 'y':
%rename(_x) Foo::x();
%rename(x) Foo::y();
12/08/2003: mmatus (Marcelo Matus)
The virtual method detections now properly
treats the following cases:
namespace foo { typedef int Int; }
struct A {};
typedef A B;
struct Foo {
virtual ~Foo() {}
virtual Foo* cloner() = 0;
virtual int get_value() = 0;
virtual A* get_class() = 0;
virtual void just_do_it() = 0;
};
struct Bar : Foo
{
Bar* cloner();
foo::Int get_value();
B* get_class();
void just_do_it();
};
All the Foo and Bar methods are virtual. A new attribute
"virtual:type" record the base polymorphic type. In the
previous cases we have:
type : Bar virtual:type : Foo
type : foo::Int virtual:type : int
type : B virtual:type : A
type : void virtual:type : void
This attribute is useful in languages (java+directors)
that could have problems redefining Bar* Bar::cloner().
If you never had code like the above, you will see no
effects. But if you have some code like that, you
will see some effects since some methods that
before were not properly treated as virtual,
will start to act like that. This could enlarge
your director classes.
12/08/2003: mmatus (Marcelo Matus)
The director protected member support (dirprot)
is disabled by default.
It can be enable by using '-dirprot' or by adding
the option to the module declaration, like:
%module(directors="1",dirprot="1") my_module
This module option was added to properly compile the
director_protected.i and director_nested.i examples.
The feature has been tested with python[2.2,2.3]
and ruby[1.6.7], both at compilation and runtime, and
java[j2sdk1.4.1_01], but only at compilation (my java
installation doesn't run any of the director examples,
olds nor news).
Please test for ocaml and java.
The errors reported by William and Scott were fixed,
except for a warning about SWIG_JavaThrowExecption()
multiply defined. I can't reproduce this error with my
examples. We will wait for Scott to send us a minimal
case.
12/07/2003: mmatus (Marcelo Matus)
The director protected member support has been
completly moved out from python.cxx, and now
resides in the common lang.cxx, emit.cxx and
allocate.cxx files.
This means it should work for all the other languages
that currently support directors, ie, python, java, ocalm
and ruby.
The change has been tested with python (compilation+runtime)
and java (just compilation).
Please add runtime tests for the missing languages
and test it.
The '-nodirprot' option was moved to the principal main,
and can be used from all the languages.
12/07/2003: cheetah (William Fulton)
[Java] Fixed and improved error checking of STRING_OUT typemaps in
various.i.
12/04/2003: mmatus (Marcelo Matus)
- Now the virtual members with no explicit declarator
are properly identified:
struct A {
virtual int f() = 0;
};
struct B : A {
int f();
};
Here, B::f() is virtual, and the director and the
virtual elimination mechanism now recognize that.
- [C#] This fix also fixes the problem where 'override' was not being
used on any overridden virtual method, so for struct B above,
this C# code is generated:
public class B : A {
...
public override int f() {
...
}
...
}
- Initial support for protected virtual methods. They are now
properly emitted when using with director (python only by
now).
%feature("director") A;
struct A {
protected:
virtual int f1() = 0;
};
%feature("director") B;
struct B : A{
protected:
int f1();
virtual f2();
};
This can be dissabled by using the '-nodirprot' option.
- The feature 'nodirector' is working now at the top level,
so, it must work for all the languages:
%feature("director") A;
%feature("nodirector") A::f2;
struct A {
virtual int f1();
virtual int f2();
};
in this case, only 'f1' is exported to the director class.
- Added director support for const TYPE& arguments (python).
12/02/2003: cheetah (William Fulton)
[Java] Fix for INOUT and OUTPUT typemaps in typemaps.i for when the JNI type
is bigger than the C type. For example, unsigned long (32bits on most systems)
is mapped to jlong (64bits). Returned value was incorrect. Bug reported by
Brian Hawley.
12/02/2003: cheetah (William Fulton)
[C# and Java] Better fix for entry dated 05/11/2003. Fixes the following
typemaps:
Java: javabase, javainterfaces, javaimports, javaclassmodifiers,
javaptrconstructormodifiers, javafinalize, javagetcptr & javacode.
C#: csbase, csinterfaces, csimports, csclassmodifiers,
csptrconstructormodifiers, csfinalize, csgetcptr & cscode.
It also fixes bug in using arrays of C structs with arrays_java.i
as reported Scott Michel.
12/02/2003: beazley
[Perl] Fixed [ 852119 ] recursive inheritance in output .pm, perl5.
Reported by William Dowling.
12/02/2003: beazley
[Tcl] Fixed [ 755382 ] calling func(const vector<T>& p) evaluates p[0] in interp.
The Tcl type checker was improperly handling the interpreter result when
type violations were supposed to be ignored.
Reported by Flaviu Popp-Nowak.
11/30/2003: cheetah (William Fulton)
Fixed [ 545058 ] configure's --with-tclincl has no effect
11/30/2003: cheetah (William Fulton)
[Java] Fixed [ 766409 ] missing symbol SWIG_JavaThrowException during module load
SWIG's internal functions are all static as there is no need for different SWIG
generated modules to share any code at runtime.
11/30/2003: beazley
[Tcl] Added support for C++ pointers to members.
11/28/2003: cheetah (William Fulton)
Fixed [ 848335 ] Directors: #include wrapper .h file - was incorrectly
adding a directory to the generated #include "foo_wrap.h" statement
in some situations.
11/28/2003: cheetah (William Fulton)
[Java] Fixed [ 849064 ] JAVA : Access modifier for derived class wrong.
The delete() method is always public now. It used to be protected whenever a
destructor was non public. An UnsupportedOperationException runtime
exception is thrown instead of making delete() protected now.
11/28/2003: beazley
[Perl5] Added support for C++ pointers to members.
11/28/2003: beazley
Fixed [ 850151 ] PYVERSION with python2.3 in configure of SWIG 1.3.19 (Maybe).
11/28/2003: beazley
Fixed [ 850666 ] #include extra line added.
This should fix some problems with getting correct line numbers on
error messages.
11/26/2003: beazley
Fixed another one of Marcelo's evil template bugs (infinite
recursion). [ 849504 ] template and typedef -> inf. recursion.
11/26/2003: beazley
Fixed parsing problem with declarations like this:
int *x = &somearray[0];
11/25/2003: beazley
Fixed [ 756552 ] missing default argument class scope with "|".
This is really only a band-aid fix for use of class-enums in
expressions. For example:
class A {
public:
enum Flag { flag1 = 0x1, flag2 = 0x2 };
void foo(int x = flag1 | flag2);
};
Note: there are still some (more subtle) cases that are broken,
but hard to fix due to an issue with template expansion. Will
address later.
Reported by Dmitry Mironov.
11/25/2003: beazley
Incorporated [ 840878 ] support for %inline { ... } (PATCH).
This adds support for the following:
%inline {
... some code ...
}
The difference between this and %inline %{ ... %} is that the
enclosed text is processed by the SWIG preprocessor. This
allows special macros and other processing to be used in
conjunction with %inline.
Contributed by Salvador Fandino Garcia.
11/25/2003: beazley
Fixed [ 836903 ] C++ inconsistency (with void arguments).
SWIG was having difficulty with f() vs f(void) in C++ programs.
For instance:
class A {
public:
virtual void f(void) = 0;
};
class B {
public:
virtual void f(); // Not matched to f(void) correctly
};
The parser now normalizes all declarations of the form f(void)
in C++ classes to f(). This should fix a variety of subtle
problems with inheritance, optimizations, overloading, etc.
Problem reported by Partho Bhowmick.
11/25/2003: beazley
[Perl5] Incorporated [ 841074 ] better croaking (PATCH). This fixes some problems
with strings and provides some new error functions.
Contributed by Salvador Fandino Garcia.
11/25/2003: beazley
Fixed [ 791835 ] Default argument with cast: txt = (char *)"txt" syntax Error.
The parser should now accept things like this:
void foo(char *s = (char *) "Hello");
Problem reported by Claudius Schnorr.
11/24/2003: beazley
[Tcl] Fixed problem with cross module linking. Previously modules referred
to base classes through a global variable. Now, the module looks up base
classes through the type system itself---avoiding the need to link to a global
like before. Caveat: modules with base classes must be loaded before
modules with derived classes.
11/24/2003: mkoeppe (Matthias Koeppe)
[Guile] In -scm mode, use () to represent null pointers,
as it is done in -gh mode.
11/23/2003: mkoeppe (Matthias Koeppe)
Add a generated script "preinst-swig", which can be used
to invoke SWIG before it has been installed. It arranges
that the runtime libraries from the source directory are
used.
11/23/2003: mkoeppe (Matthias Koeppe)
[Guile] In -gh mode, don't forget to call SWIG_Guile_Init.
Add a SWIG_contract_assert macro.
11/23/2003: mkoeppe (Matthias Koeppe)
[MzScheme] Update the configure check for the dynext object to work
with MzScheme 205.
11/20/2003: mmatus
Fixed the include/import error reported by Kerim Borchaev,
where two files with names like
'dir1/hello.i'
'dir2/hello.i'
can not be include at the same time. Swig was including
just the first one, assuming the second one was not a
different one, since it was checking/keeping just the
basename 'hello.i'.
11/19/2003: beazley
Changes to the SWIG runtime library support.
- The -c command line option has been renamed to -noruntime
- New command line option: -runtime. When supplied, this
inserts the symbol SWIG_GLOBAL into the wrapper code. This,
in turn, makes all of the runtime support functions globally
visible.
- New library file: swigrun.i. Used to create modules
for runtime library (if needed).
11/18/2003: cheetah (William Fulton)
'make srcrpm' rpmbuild fix - patch from Joe Cooper
11/18/2003: mkoeppe (Matthias Koeppe)
[Guile] Change meaning of configure option --with-guile to
the name of the Guile executable. The new option --with-guile-prefix
can be used to specify the tree where Guile is
installed. (However, usually it suffices to use the
single option --with-guile-config.)
When running the run tests test-suite, make sure to use the
version of Guile that SWIG was configured for.
11/17/2003: mkoeppe (Matthias Koeppe)
[Guile] Improvements to object-ownership management in
"-scm" mode. (They do not apply to the default "-gh" mode.)
* Renamed the smob type that indicates that the object can
be garbage collected from "collected swig" to "collectable
swig", which is more precise.
* Export the destructor functions again. It is now
allowed to explicitly call destructors, even for
garbage-collected pointer objects. A pointer object
that has been passed to a destructor is marked in a
special way using a new smob type, "destroyed swig".
(This helps avoid nasty memory bugs, where references to
dead C objects are still held in Scheme. Moreover, the
garbage collector will not try to free a destroyed
object once more.)
* Destructor-like functions can also mark their arguments
as destroyed by applying the typemap SWIGTYPE *DESTROYED.
(It calls the function SWIG_Guile_MarkPointerDestroyed.)
* Functions that "consume" their objects (or that "own"
them after the call) can mark their arguments as
not garbage collectable. This can be done by applying
the typemap SWIGTYPE *CONSUMED. (It calls the function
SWIG_Guile_MarkPointerNoncollectable.)
* The macro TYPEMAP_POINTER_INPUT_OUTPUT from library
pointer-in-out.i creates additional typemaps
PTRTYPE *INPUT_CONSUMED, PTRTYPE *INPUT_DESTROYED.
They mark the passed pointer object likewise.
The typemap PTRTYPE *OUTPUT creates a garbage-collectable
pointer object, like %newobject does for a returned
pointer. Use the new typemap PTRTYPE *OUTPUT_NONCOLLECTABLE
to create a pointer object that will not be garbage collected.
11/17/2003: mkoeppe (Matthias Koeppe)
[Guile] Handle $input in "freearg" typemaps.
Never qualify GOOPS slot names with the class name.
Handle optional arguments properly in the GOOPS methods.
11/16/2003: cheetah (William Fulton)
Fixes for installation to work with the upcoming Automake-1.8.
mkinstalldirs was being used by a non-Automake makefile.
mkinstalldirs is being phased out and so was not being
created by Automake. install-sh used instead.
11/16/2003: cheetah (William Fulton)
[Java] Numerous director improvements, tweaks and bug fixes since
the initial implementation have been contributed by Scott Michel.
11/12/2003: beazley
[Python] When %feature("shadow") is used to add code to shadow
classes, the special variable $action expands to the name of the
underlying wrapper function that would have been called normally.
11/12/2003: beazley
[Python] When generating proxy class code, SWIG emits a few
default methods for __repr__() and other Python special
methods. Some of these methods are emitted after all of the
contents of a class. However, this makes it hard to override
the methods using %pythoncode and some other directives that
allow code to be inserted into a class. These special methods
are now emitted into the code *before* all of the other methods.
Suggested by Eric Jones.
11/11/2003: beazley
Preprocessor enhancement. For include statements like this:
%include "foo/bar.i"
the directory "foo" is now added to the search path while
processing the contents of bar.i. Thus, if bar.i includes other
files in the same directory, they will be found. Previously,
you would have to add additional directories using -I to make this
work correctly. Note: the C preprocessor seems to behave in
an identical manner on many (most? all?) systems.
Suggested by Kerim Borchaev.
11/11/2003: beazley
Configuration changes to make SWIG work on Mac OS X 10.3.x (Panther).
Tested with Python, Tcl, Perl, and Ruby---all of which seem to work.
11/08/2003: cheetah (William Fulton)
[Java] Fixed the typemaps in various.i which were mostly broken.
char **STRING_IN and char **STRING_RET typemaps replaced with
STRING_ARRAY. float *FLOAT_ARRAY_RETURN typemap removed.
11/08/2003: beazley
[Tcl] Tcl module now emits a safe module initialization function by
default. It can be removed by running 'swig -nosafe'.
11/04/2003: mkoeppe (Matthias Koeppe)
[Guile] Only use the SCM_ API when the function
`scm_slot_exists_p' exists (needed for GOOPS support).
This function was renamed during the Guile 1.5 series
from `scm_slots_exists_p'.
Report the right runtime library when invoked with
-scm -ldflags.
11/03/2003: mkoeppe (Matthias Koeppe)
[Chicken] Fix #782052. The --with-chickencfg configure
option (and others) were not accepted.
11/02/2003: mkoeppe (Matthias Koeppe)
[Guile] Merge new set of GOOPS changes by John Lenz.
GOOPS objects are now manipulated directly by the C code.
Some fixes to typemap-GOOPS interaction.
11/02/2003: mkoeppe (Matthias Koeppe)
[Guile] Remove the file argument to -scmstub and -goops.
The Scheme files are now always called MODULE.scm or
MODULE-primitive.scm, where MODULE is the module name and
"primitive" can be changed by the -primsuffix option.
The Scheme files are now placed in the directory given by
the -outdir option, or the current directory.
(Patch by John Lenz, slightly modified.)
*** INCOMPATIBILITY [Guile] ***
11/02/2003: mkoeppe (Matthias Koeppe)
Unify the pointer-conversion runtime API. The standard
functions are:
* SWIG_NewPointerObj (POINTER, TYPE, FLAGS)
-- Create an scripting object that represents a typed
pointer. FLAGS are language specific.
* SWIG_ConvertPtr (INPUT, RESULT, TYPE, FLAGS)
-- Get a pointer from the scripting object INPUT and
store it in the place RESULT. When a type mismatch
occurs, return nonzero.
* SWIG_MustGetPtr (INPUT, TYPE, ARGNUM, FLAGS)
-- Get a pointer from the scripting object INPUT and
return it. When a type mismatch occurs, throw an
exception. If ARGNUM > 0, report it as the
argument number that has the type mismatch.
[Guile]: No changes.
[MzScheme]: No changes.
[Perl]: Add the function SWIG_NewPointerObj.
The function SWIG_MakePtr is kept.
The function SWIG_MustGetPtr is currently not
supported.
[Python]: Add the function SWIG_MustGetPtr.
[Ruby]: Add the function SWIG_MustGetPtr.
[Tcl]: Remove the "interp" argument of
SWIG_NewInstanceObj, SWIG_ConvertPtr,
SWIG_ConvertPacked, and SWIG_ConvertPtrFromString.
The function SWIG_MustGetPtr is currently
not supported.
No changes to Pike because its pointer conversion code did
not look complete. No changes to PHP4, because I did not
understand its runtime code. No changes to Chicken
because major changes are expected soon anyway. No
changes to Java, OCaml, C# because they do not seem to
have a pointer-conversion runtime API.
*** INCOMPATIBILITY [Tcl] ***
11/02/2003: mkoeppe (Matthias Koeppe)
[Perl5, PHP4, Pike, Python, Ruby, Tcl]: Use the
preprocessor to rename external functions of the SWIG
runtime API to follow the naming convention
SWIG_<language>_<function>. This should allow linking
more than one interpreter into a program.
10/31/2003: cheetah (William Fulton)
[C#] Fix since introducing the exception and std::string delegates.
The fix overcomes linker errors when using more than one SWIG module.
Problem reported by Andreas Schörk.
10/31/2003: beazley
Incorporated patch: [ 823302 ] Incr Tcl support.
Contributed by Alexey Dyachenko.
Note: needs documentation.
10/31/2003: beazley
Incorporated patch: [ 829325 ] new Python Module options and features.
Robin Dunn writes:
This patch makes a number of changes to the SWIG python module.
1. Add -apply option, and change the default code
output to use the foo(*args, **kw) calling syntax
instead of using apply(). If the -apply option is
given then code is generated as before. This is very
similar to Patch #737281 but the new -modern option
makes the second half of that patch unnecessary so it
is not included here.
2. Add -new_repr option. This is the same as my Patch
#797002 which I will mark as closed since it is no
longer needed. When this new option is used then the
__repr__ methods that are generated for proxy classes
will be more informative and give details about the
python class and the C++ class.
3. Add %feature("addtofunc"). It allows you to insert
one or more lines of code inside the shadow method or
function that is already generated, instead of
replacing the whole thing like %feature("shadow") does.
For __init__ it goes at the end, for __del__ it goes
at the begining and for all others the code generated
is expanded out to be like
def Bar(*args, **kwargs):
val = _module.Foo_Bar(*args, **kwargs)
return val
and the "addtofunc" code is inserted just before the
return statement. If the feature is not used for a
particular method or function then the shorter code is
generated just like before.
4. A little bit of refactoring to make implementing
addtofunc a little easier.
5. Added a -modern command-line flag that will cause
SWIG to omit the cruft in the proxy modules that allows
it to work with versions of Python prior to 2.2. The
result is a simpler, cleaner and faster python proxy
module, but one that requires Python 2.2 or greater.
10/31/2003: beazley
Incorporated patch: [ 829319 ] XML module tweaks.
This adds a new command line option -xmllite that
greatly reduces the amount of emitted XML code by
eliminating some fields mostly used in SWIG's
internal processing. Contributed by Robin Dunn.
10/31/2003: beazley
Incorporated patch: [ 829317 ] Adds DohSplitLines function.
Contributed by Robin Dunn.
10/29/2003: beazley
Fixed [ 827907 ] argout objects not being wrapped properly (PATH).
Patch contributed by Salvador Fandiño García.
10/29/2003: beazley
Fixed [ 826996 ] perl type checking ignores perl subclasses.
This enhancement makes it so wrapped classes and structs can
be subclassed in Perl and used normally.
Patch contributed by Salvador Fandiño García.
10/16/2003: cheetah (William Fulton)
[C#] IntPtr marshalled with a void* instead of int in C function
declarations. The casts thus look more conventional, for example:
// old
DllExport double SWIGSTDCALL CSharp_get_Shape_x(int jarg1) {
...
Shape *arg1 = (Shape *) 0 ;
arg1 = *(Shape **)&jarg1;
...
}
// new
DllExport double SWIGSTDCALL CSharp_get_Shape_x(void * jarg1) {
...
Shape *arg1 = (Shape *) 0 ;
arg1 = (Shape *)jarg1;
...
}
10/14/2003: beazley
Fixed a subtle problem with overloaded methods and smart pointers.
If a class has overloaded methods like this:
class Foo {
public:
int bar(int x);
static int bar(int x, int y);
};
and the class is used as a smart pointer:
class FooPtr {
public:
Foo *operator->();
};
The SWIG would try to expose the static member Foo::bar
through FooPtr---resulting bogus wrapper code and a compiler
error.
Due to the way in which overloading is handled, it is
extremely difficult to eliminate the static method in
this case. Therefore, it is still exposed. However,
the generated code now compiles and works.
10/05/2003: mkoeppe (Matthias Koeppe)
[Guile, MzScheme, Chicken]: Remove symbol clashes between
the runtime libraries by renaming all extern common.swg
functions with the preprocessor.
10/05/2003: mkoeppe (Matthias Koeppe)
[Guile] Added basic GOOPS support, contributed by John Lenz.
See the documentation for details.
*** NEW FEATURE ***
10/04/2003: mkoeppe (Matthias Koeppe)
[Guile] New option, -only-setters, which disables
traditional getter and setter procedures for structure slots.
10/03/2003: mkoeppe (Matthias Koeppe)
[Guile] Added run test for reference_global_vars by John Lenz.
09/30/2003: beazley
Partial solution to [ 792180 ] C++ smart-pointer/namespace mixup revisited.
The problem is not easy to fix (at least it doesn't seem so), but is
related to the instantiation of qualified templates inside of other
namespaces. SWIG now generates an error message in this case rather
than generating broken wrappers.
09/30/2003: beazley
Fixed [ 800012 ] ENTER macro from CORE/scope.h clashes with libc search.h.
Reported by Britton Leo Kerin.
09/30/2003: beazley
Fixed [ 811518 ] Casting ints to doubles (w/ solution?)
Addresses a problem with overloading in the Perl module.
Reported by Gerald Dalley.
09/28/2003: mkoeppe
[Guile with -scm option] Fix typo in generated code for
procedures-with-setters. Reported by John Lenz.
09/26/2003: beazley
Fixed [ 812528 ] externs not correct when throw is in signature.
Reported by Joseph Winston.
09/23/2003: cheetah (William Fulton)
SWIG was generating a number of symbols that didn't comply with
the ISO C/C++ standard, in particular ISO/IEC 14882:1998(E) 17.4.3.1.2
where double underscores are forbidden as well as symbols starting with
an underscore followed by an upper case letter. Most of these have
been rooted out. See new section added to internals.html development
manual 'Symbol Naming Guidelines for Generated C/C++ Code'.
09/23/2003: cheetah (William Fulton)
Director typemap name changes:
inv => directorin
outv => directorout
argoutv => directorargout
*** POTENTIAL INCOMPATIBILITY ***
09/19/2003: mrose (Mark Rose)
[Python] Director constructors now default to __disown = 0,
which is the intended behavior and fixes the director_finalizer
test case under python.
09/12/2003: cheetah (William Fulton)
[C#] - Typemaps added for std::string and const std::string &.
- New delegate for creating a C# string given a char *. It
can be used by calling SWIG_csharp_string_callback as shown
in the std::string 'out' typemap. Useful if the return type is
mapped to a C# string and the calling function is responsible
for cleaning up memory as the C# garbage collector doesn't
free the memory created in C/C++ and then returned as a C# string.
- The exception delegates have moved into an inner class in the
intermediate class, thereby freeing up the static constructor.
09/11/2003: beazley
(Internals)
Major refactoring of iteration over lists and hashes. The
DOH library now uses iterators. They work like this:
List *l = (some list);
Iterator i;
for (i = First(l); i.item; i = Next(i)) {
// i.item contains the actual list item.
// i.item is NULL at end of list
...
}
Hash *h = (some hash);
Iterator j;
for (j = First(h); j.item; j = Next(j)) {
// j.item contains hash table item
// j.key contains hash table key
// Both j.item and j.key are NULL at end
...
}
The old iteration functions Firstitem(), Nextitem(), Firstkey(),
and Nextkey() are gone.
The new iterators are simpler, result in better memory use,
and may be faster. Also, there are no longer any problems
iterating over the same list/hash in multiple places at
the same time. For example, this is fine:
Iterator i,j;
for (i = First(l); i.item; i = Next(i)) {
for (j = First(l); j.item; j = Next(j)) {
...
}
}
(This never worked in previous versions).
*** POTENTIAL INCOMPATIBILITY ***. This will probably break
third party extensions to SWIG (or give them further encouragement
to join the SWIG CVS-tree :-).
09/10/2003: mkoeppe (Matthias Koeppe)
[Guile] Fix memory leaks in the "list-vector.i" typemaps.
09/09/2003: mkoeppe (Matthias Koeppe)
[Chicken] Use C_mk_bool rather than C_mkbool. This fixes
the wrapping of boolean values for Chicken 1.10 and newer.
Reported by Dave <hundo@yahoo.com> / Felix Winkelmann
<felix@proxima-mt.de>.
09/05/2003: cheetah (William Fulton)
[Java] Directors implemented for Java. In summary this is a big new feature
which supports upcalls from C++ to Java. Code is generated to support C++
callbacks to call into Java and true polymorphic behaviour for Java classes
derived from C++ classes. See java.html for details. Contributed by
Scott Michel.
09/05/2003: Tiger
Created contract example directory at /SWIG/Examples/contract
Added simple contract examples (simple_c & simple_cxx)
Modified contract module's output format
*** NEW FEATURE ***
09/01/2003: cheetah (William Fulton)
Test-suite build improvements:
- Multiple build directories working for the test suite, so it is now
possible to run configure in multiple subdirectories and run the test
suite in each of these sub directories.
- 'make distclean' fixed so it doesn't bomb out on the Examples directory
when using multiple subdiretory builds. Required the following directories
to be moved:
Examples/GIFPlot/Perl -> Examples/GIFPlot/Perl5
Examples/GIFPlot/Php -> Examples/GIFPlot/Php4
These new directories used to be symbolic links to the old directory.
Also the Examples/test-suite/Perl symbolic link has been removed.
- Running the test-suite, other than from the root directory, say
in Examples/test-suite/python will now display all the code being
executed.
- The following 3 C# compilers are detected during configure and work with
the test-suite: Mono, Portable.NET and Microsoft.
09/01/2003: Tiger
Added inheritance support for design by contract feature.
09/01/2003: beazley
Fixed [ 794914 ] Wrong types in template specialization.
SWIG was not handling arguments correctly in template
partial specialization. For example,
template<class T> class Foo<T *> {
public:
T *blah();
};
%template(FooInt) Foo<int *>;
in this class, the return type of blah was set to
'int **', but it should really be 'int *'. This has been
fixed, but it will affect all prior uses of partial
specialization.
09/01/2003: beazley
Fixed [ 786394 ] Patch for generated perl code does not compile under RedHat9.
Reported by Scott Finneran.
09/01/2003: beazley
Fixed [ 791579 ] (unsigned) long long handled incorrectly (Tcl).
This was an error in the Tcl typemaps.i file.
Reported by Kjell Wooding.
09/01/2003: beazley
Fixed [ 797573 ] no way to rename classes coming from C structures.
This problem relates to renaming of anonymous structures with a
typedef. For example:
%rename(Bar) Foo;
typedef struct {
...
} Foo;
Reported by Britton Leo Kerin.
09/01/2003: beazley
Fixed [ 797576 ] -help seems to imply that only tcl-specific options exist.
Added a comment to alert user to other options.
Reported by Britton Leo Kerin.
09/01/2003: beazley
Fixed [ 798205 ] Segfault in SWIG_ConvertPtr.
Reported by Prabhu Ramachandran.
08/30/2003: mrose (Mark Rose)
Modified the director typemaps in python/std_complex.i to use the
new-style macro and conversion functions, which eliminated some
redundant code. Fixed a few bugs in these typemaps as well, although
more testing is needed.
08/29/2003: mrose (Mark Rose)
Completed initial support for wrapping abstract classes with directors.
Constructor wrappers will be generated for abstract classes that have
directors, and instances of the director classes will be created regardless
of whether the proxy class has been subclassed in the target language.
No checks are made during construction to ensure that all pure virtual
methods are implemented in the target language. Instead, calls to
unimplemented methods will throw SWIG_DIRECTOR_PURE_VIRTUAL_EXCEPTION
exceptions in C++.
Integrated Prabhu Ramachandran's typemap patches, which provide director
typemap support for enums and std::size_t, and fix a couple bugs in the
director std::vector<> typemaps.
08/29/2003: cheetah (William Fulton)
[C#] Implemented exception handling for throwing C# exceptions from C/C++ code.
A few delegate functions are available for calling which then throw the C#
exception. Use the SWIG_CSharpThrowException function from C/C++ typemaps.
See the generated wrapper code or csharphead.swg for all available exceptions.
Example:
SWIG_CSharpThrowException(SWIG_CSharpException, "exception description");
The 'throws' typemaps are also now implemented, so code is automatically
generated to convert any C++ exception into a C# System.Exception when the C++
method declares an exception specification such as:
int foo() throw(Bar);
Also any parameters that are references to a C++ class or a class passed by value
and are passed as a C# null will now throw a C# NullReferenceException.
08/29/2003: cheetah (William Fulton)
[C#] Fix to match the calling convention of all pinvoke methods so that they
match the calling convention used by default in the C# 'static extern' declarations
(__stdcall is used on Windows).
08/19/2003: cheetah (William Fulton)
[Java] Reworked std::string typemaps. Fixes a number of string in std namespace
problems. For example %template vector<string>. The templated class' get method
wasn't returning a Java String, but a SWIGTYPE_p_string. Reported
by Zach Baum.
08/15/2003: beazley
Fixed [ 763522 ] 1.3.19 segfault in SwigType_add_pointer/DohInsertitem.
Related to problem with unnamed class handling in Perl module.
08/15/2003: beazley
Fixed [ 763563 ] Missing indication of optional arguments.
Tcl module. Reported by Krzysztof Kozminski.
08/15/2003: beazley
Fixed [ 787432 ] long param handled as int. Tcl module
now uses Tcl_GetLongFromObj to convert integer values.
08/11/2003: beazley
Fixed [ 775989 ] numeric template parameters. There were
some errors in template expansion related to the use of
arrays where the array dimension was a template parameter.
It should work now. Reported by Bryan Green.
08/10/2003: mrose (Mark Rose)
Added a director typemap (outv) for return by value and cleaned up up a few
of the commented director typemaps.
08/10/2003: mrose (Mark Rose)
Fixed constructor generation for director classes to ignore private
constructors. Protected constructors are also ignored for now, pending
a solution to the problem of wrapping classes that only define protected
constructors.
08/07/2003: cheetah (William Fulton)
New commandline option -outdir <dir> to specify where the language specific
files are to be generated. This is useful for target languages like Python,
Java etc which generate proxy files in the appropriate language.
This option does not apply to the C/C++ wrapper file.
08/07/2003: cheetah (William Fulton)
On Windows the generated files (other than the _wrap.c or _wrap.cxx files)
were sometimes incorrectly being generated into the current directory unless
the input file used the Unix path separator. The Windows path separator
should now be used. Bug reported by Robert Davies.
08/07/2003: beazley
Added array variable set typemap to Perl module.
08/07/2003: beazley
Fixed [ 775677 ] Array init causes codegen bug..
08/07/2003: beazley
Fixed [ 779062 ] Class"\n"::foo not supported. SWIG
should now correctly handle whitespace in between
namespace qualifiers. For example "A :: Foo :: Bar".
07/31/2003: cheetah (William Fulton)
Fixes for parameters which are classes that are passed by value and have
a default value. A copy constructor for SwigValueWrapper is required
(SF #780056). Also fixed memory leak in these circumstances. These mods
also fix SF #780054.
07/28/2003: beazley
Improved run-time error message for pointers in Python module.
Contributed by Zooko.
07/10/2003: ballabio (Luigi Ballabio)
[Almost all languages] Wrappers for std::pair added.
Typemaps for Python, Ruby, Guile and MzScheme.
07/01/2003: mkoeppe (Matthias Koeppe)
[Chicken] Handle the case of more than one argout typemap
per function.
06/29/2003: cheetah (William Fulton)
[Java, C#] SF #670949 request. The destructor wrapper function name is now
configurable. A new attribute called methodname in the
javadestruct/javadestruct_derived (Java) or csdestruct/csdestruct_derived (C#)
typemaps specifies the method name. For example in Java the destructor is
wrapped by default with the delete method:
%typemap(javadestruct, methodname="delete") SWIGTYPE {...}
06/27/2003: cheetah (William Fulton)
[Java, C#] The throws attribute for adding exception classes to the throws
clause also now works with the following typemaps:
newfree
javain, javaout (Java)
csin, csout (C#)
For example, the 'AnException' will be added to the throws clause in the
proxy function:
%typemap(javaout, throws="AnException") int {
int returnValue=$jnicall;
if (returnValue==0) throw new AnException("Value must not be zero");
return returnValue;
}
06/25/2003: mrose (Mark Rose)
[Python] Director typemap marshalling checks for null pointers when
walking the parameter list instead of relying soley on the parameter
count. Cures a segfault that occurred for multiple argument inv typemaps.
Someone with more Swig experience should probably review this code.
06/24/2003: mkoeppe (Matthias Koeppe)
[Chicken] Don't emit calls to "C_check_for_interrupt",
which may result in an endless loop. Patch by felix@proxima-mt.de.
06/20/2003: cheetah (William Fulton)
[C#] Finalizers now use destructor syntax as the override which was used in
the Finalize method is not in the ECMA standards, spotted by the MS compiler.
06/10/2003: cheetah (William Fulton)
[C#] A number of changes have been made to remove the Java naming
that was used in the C# module.
Typemap name changes:
jni -> ctype
jtype -> imtype
jstype -> cstype
javain -> csin
javaout -> csout
javainterfaces -> csinterfaces
javabase -> csbase
javaclassmodifiers -> csclassmodifiers
javacode -> cscode
javaimports -> csimports
javaptrconstructormodifiers -> csptrconstructormodifiers
javagetcptr -> csgetcptr
javafinalize -> csfinalize
Feature name changes:
javaconst -> csconst
javamethodmodifiers -> csmethodmodifiers
Pragma changes:
pragma(java) -> pragma(csharp)
jniclassbase -> imclassbase
jniclassclassmodifiers -> imclassclassmodifiers
jniclasscode -> imclasscode
jniclassimports -> imclassimports
jniclassinterfaces -> imclassinterfaces
Special variable name changes:
$javaclassname -> $csclassname
$javainput -> $csinput
$jnicall -> $imcall
This will break SWIG interface files that use these typemaps, features
and pragmas. Please update your code or use macros for backwards
compatibility.
*** POTENTIAL INCOMPATIBILITY FOR C# MODULE ***
06/10/2003: mkoeppe (Matthias Koeppe)
[MzScheme] Applied MzScheme module updates contributed by
John Lenz <jelenz@students.wisc.edu>.
- Updated mzscheme to use SWIG's common runtime type
system from common.swg.
- The Lib/mzscheme directory has been reorganized to
standardize names across the language modules:
mzscheme.i was moved to mzscheme.swg, mzscheme.swg and
mzschemedec.swg have been removed, mzrun.swg (which
contains the runtime code) has been added.
- The swig_proxy structure was renamed to swig_mz_proxy.
swig_mz_proxy now contains a pointer to a swig_type_info
structure.
- Added varin and varout typemaps for SWIGTYPE [] and
SWIGTYPE &.
- Garbage collection by calling scheme_add_finalizer() has
been added.
*** NEW FEATURE [MzScheme] ***
06/10/2003: cheetah (William Fulton)
[Java] New typemaps: javadestruct and javadestruct_derived
for the C++ destructor wrapper. The javadestruct version gets used by
classes at the top of an inheritance chain and the javadestruct_derived
version gets used by other classes.
[C#] cildispose and cildisposeoverride typemaps replaced by
csdestruct and csdestruct_derived typemaps. The delete()
method has been removed and its functionality put into these
typemaps designed for the Dispose() method.
- New typemaps csinterfaces and csinterfaces_derived replace
the javainterfaces typemap. Also fixes the peculiarity of all classes
in an inheritance chain individually deriving from the IDisposable
interface.
- New typemap csfinalize for finalizers. C++ destructors are now called
by garbage collector during finalization. Problem reported by
Andreas Schörk.
06/10/2003: Tiger
Modified contract code for error message output.
Contract code can now print out simple error message.
Modified contract code to prepare for inheritance
06/03/2003: mkoeppe
[Guile] Applied Guile module updates contributed by
John Lenz <jelenz@students.wisc.edu>.
- SWIG currently uses Guile's gh_ API, which is marked as
deprecated in Guile 1.6 and will be removed in Guile
1.9. This change introduces a command-line flag "-scm"
which causes SWIG to generate wrappers that use Guile's
SCM API instead; this requires Guile >= 1.6.
- The Lib/guile directory has been reorganized to
standardize names across language modules: guiledec.swg
and guile.swg have been moved into guile_gh_run.swg,
guile.i has been moved to guile_gh.swg, guile_scm.swg
and guile_scm_run.swg which contain the SCM API stuff
have been added
- ghinterface.i, which contains the defines from the gh_
functions to the scm_functions has been added
- The API for dealing with pointer objects is now
SWIG_ConvertPtr, SWIG_MustGetPtr, SWIG_NewPointerObj.
- Added varin and varout typemaps for SWIGTYPE [] and SWIGTYPE &
- Garbage collection has been added.
*** NEW FEATURE [Guile] ***
06/01/2003: cheetah (William Fulton)
Dimensionless arrays such as
int foo[] = {1, 2};
extern int bar[];
produce a warning that the variable is read-only. Depending on the target
language, this used to cause compile errors or generate a setter that
generated a runtime error. A setter cannot be automatically generated
because the array size cannot be determined by SWIG. A varin, globalin
or memberin typemap (depending on the target language) must be written
by the user.
05/29/2003: beazley
Refinement to default typemap matching and arrays. When an
array is declared like this:
int foo[4];
The default typemap now resolves to
SWIGTYPE [ANY]
If no match is found for that, it then resolves to
SWIGTYPE []
If no array dimension is specified in the original declaration,
the SWIGTYPE [] is used right away.
Note: This change has been made to resolve problems related to
arrays with and without dimensions. For example, sometimes SWIG
was generating setter functions for array variables with no dimensions
(an error). Likewise, SWIG sometimes made arrays with dimensions
read-only (also an error). This fixes the arrays_global test
problem.
05/28/2003: beazley
Fixed subtle type handling bug with references and pointers.
If you had functions like this:
typedef Foo Bar;
Foo *func1();
void func2(Bar &x);
Then func2() wouldn't accept objects returned by func1()
because of a type error. It should work now.
Reported by Brian Yang.
05/21/2003: cheetah (William Fulton)
Fixes to some of the Visual C++ example project files which would not
work with spaces in the paths held in the environment variables used to
point to the target language's library / include directory.
SF bug #740769
05/21/2003: songyanf (Tiger)
Added -contracts option.
First try of the idea of "Wrap by Contract":
build up realiable cross-language module by wrapping with SWIG.
Implemented basic assertion
(preassertion & postassertion & invariant)
for simple C/C++ functions.
Current format of contracts are:
%contract class_name :: func_name (paras...) {
require:
boolean exprs;
exprs;
ensure:
boolean expr;
exprs;
invariant:
boolean expr;
exprs;
}
*** NEW FEATURE ***
05/19/2003: cheetah (William Fulton)
Build tweaks. There were a few preprocessor definitions which were
specified in the Makefile for passing on the commandline when compiling.
These are now all defined in swigconfig.h. Autoconf doesn't normally
allow installation directories to be defined in this config header file,
but an autoconf archive macro enables this. This macro along with future
autoconf macros are going to be put in the Tools/config directory.
'swig -version' now reports the target build platform.
05/11/2003: cheetah (William Fulton)
[C# and Java] Fix to the following typemaps:
javabase, javainterfaces, javaimports, javaclassmodifiers,
javaptrconstructormodifiers, javafinalize, javagetcptr & javacode.
These are the typemaps for modifying/generating proxy classes.
Previously the typemaps would use the proxy class name and not the
C++ type, which was inconsistent with all other typemaps.
In most circumstances the proxy class name and the C++ class name/type
is the same except for classes in namespace, templated classes etc. so
this shouldn't affect most cases.
*** POTENTIAL INCOMPATIBILITY FOR JAVA and C# MODULES ***
05/09/2003: cheetah (William Fulton)
Visual C++ Project files have been added so that the runtime libraries
can be built on Windows (for Tcl, Perl, Python and Ruby).
05/01/2003: beazley
Fixed problem with return by value, const, and private constructors.
For example:
class B {
private:
B();
public:
B(const B&);
};
class A {
...
const B returnB() const;
...
};
Problem and patch suggestion reported by Bill Hoffman.
04/29/2003: cheetah (William Fulton)
Build changes:
- Single autoconf invocation - autoconf in the Tools directory has gone.
- Libtool bootstrapped when running autogen.sh. This requires anyone
using the cvs version of SWIG to have libtool installed on their
machine. Suggest version 1.4.2 or higher, preferably the latest - 1.5.
- Automake is now used to build the runtime libraries in conjunction
with libtool.
- Runtime libraries are now successfully built as DLLs on Cygwin.
- Skipping languages is no longer just determined in the top level
makefile but in configure.in. This info is used for building
the runtime libraries and for running the examples and test-suite.
- These changes have fixed multiple build directory builds, that is
building from directories other than the top level directory.
Installation from multiple build directories also working. An initial
configure in the top level directory is no longer needed as described
in 04/02/2003 entry. A 'make distclean' will be needed before building
in a directory other than the top level directory if the autotools
have been run from this top level directory at some point, but
autoconf will tell you this. Note that 'make check' only works from
the top level directory at the moment.
04/28/2003: beazley
Fixed [ 723471 ] Wrapper_print() fails with preprocessor directives.
04/28/2003: beazley
Minor refinement of const static member variable handling
described in CHANGES 08/11/2002. Previously, SWIG merely
checked to see if there was an initializer in the declaration.
Now, SWIG additionally checks to make sure the static member
is const.
04/25/2003: ljohnson (Lyle Johnson)
[Ruby] Added a kind of limited support for multiple inheritance,
activated using the -minherit command-line option. I've also updated
the "C++ Inheritance" section of the Ruby documentation to discuss
how this works, and its limitations. Also also modified the minherit.i
test case to run against this.
04/25/2003: ljohnson (Lyle Johnson)
[Ruby] Added the -globalmodule command-line option for the Ruby
module, for wrapping stuff into the global module (Kernel) instead
of a nested module. Updated documentation accordingly.
04/23/2003: mrose (Mark Rose)
Fixed symname error in director calls to Python methods
that extend C++ operators.
Stopped director destructor wrappers from calling __set_up,
which was leaving the director flag in an inconsistent state.
04/23/2003: beazley
Fixed problem with namespace resolution and nested namespaces.
Reported by Alfred Lorber (and Marcelo Matus).
04/16/2003: cheetah (William Fulton)
Patch for Java examples and test-suite to run on Mac OS X.
04/15/2003: ljohnson (Lyle Johnson)
[Ruby] Incorporated Nobu Nakada's patches for supporting the Ruby
1.8 allocation framework.
04/15/2003: ljohnson (Lyle Johnson)
[Ruby] Replaced all uses of the deprecated STR2CSTR() macro with the
safer StringValuePtr() macro. For more information, see ruby-talk:67059
and follow-ups to that post.
04/11/2003: beazley
Fixed problem with preprocessor macro expansion. For example:
#define min(x,y) ((x) < (y)) ? (x) : (y)
int f(int min);
Reported by Sebastien Recio.
04/10/2003: cheetah (William Fulton)
[Java] Added a runtime check to typemaps in arrays_java.i library to check
that the Java array passed in is the same size as the C array and throw an
exception if not.
Also fix to use delete instead of free for arrays created using new.
04/07/2003: cheetah (William Fulton)
Remove GCC3 warning when compiling the examples and test-suite:
cc1plus: warning: changing search order for system directory "/usr/include"
cc1plus: warning: as it has already been specified as a non-system directory
See SF patch #715531 submitted by Gerald Williams
04/03/2003: cheetah (William Fulton)
[C#] Improved wrapping of enums and constants. These were previously
wrapped as C# variables rather than constants. Either these are wrapped
as readonly (runtime) constants or compile time constants, depending on
the %javaconst directive (The directive is likely to change name soon).
For example wrapping:
%javaconst(0);
#define ABC 22
%javaconst(1) XYZ;
#define XYZ 33
is now:
public static readonly int ABC = examplePINVOKE.get_ABC();
public const int XYZ = 33;
04/03/2003: cheetah (William Fulton)
[Java] Global constants and enums are put in their own interface called
xxxConstants, where xxx is the module name. This is an improvement as
it is possible to derive (implement) a Java class from the xxxConstants
interface to improve the syntax; namely when wrapping:
enum {ONE=1, TWO, THREE};
accessing these from a Java class implementing xxxConstants is neater:
int number = ONE;
than the previous:
int number = xxx.ONE;
Patch submitted by Dave Dribin.
04/02/2003: cheetah (William Fulton)
Build improvements for multiple builds. This allows one to build
the SWIG executable and runtime libraries for different platforms/compilers
etc by running configure in different directories. This isn't 100% just
yet and won't be until libtool is better configured... a 'configure' and
'make distclean' needs to be run in the root directory before it all works.
For example:
$ ./configure
$ make distclean
$ mkdir config1; cd config1; ../configure CC=gcc CXX=g++; make; cd ..
$ mkdir config2; cd config2; ../configure CC=cc CXX=c++; make; cd ..
To be improved. A 'make check' does not work yet either.
04/01/2003: beazley
Fixed template partial specialization argument expansion bug.
This showed up when trying to use std_vector.i with vectors
of pointers.
03/31/2003: cheetah (William Fulton)
Fix for parallel make builds of SWIG, for example
make -j 4
Build failure reported by Bill Clarke.
03/28/2003: beazley
Released 1.3.19.
Version 1.3.19 (March 28, 2003)
===============================
03/28/2003: beazley
Variety of minor bug fixes to the 1.3.18 release including:
- Segmentation fault with %extend directive.
- Typemap variable substitution bug.
- Expression evaluation bug.
- Large memory leak with template expansion.
Version 1.3.18 (March 23, 2003)
===============================
03/21/2003: beazley
Fixed two problems with the %extend directive, overloading, and
template expansion. See the 'template_extend_overload' and
'template_extend_overload_2' tests in Examples/test-suite for
details.
03/20/2003: cheetah (William Fulton)
[C#] Added some typemaps as suggested by Andreas Schoerk for handling
parameters that are passed as pointers or by reference. These have
been put in typemaps.i.
03/20/2003: beazley
Fixed a C++ scoping bug related to code like this:
class Foo {
public:
int Foo::bar();
};
Previously, SWIG just tossed out the Foo::bar() declaration. Now,
the declaration is wrapped provided that the prefix is exactly the
same as the current scope (including any enclosing namespaces).
Reported by Bruce Lowery.
03/20/2003: beazley
Incorporated [ 696516 ] Enabling exception processing for data member access.
In some compilers, attribute access can generate exceptions. However,
SWIG ordinarily assumes that no exceptions will be raised. To disable this,
use the %feature("allowexcept"). For example:
%feature("allowexcept") Foo::x;
...
class Foo {
public:
int x; /* Exception handling enabled */
...
};
Patch contributed by Yakov Markovitch.
03/20/2003: beazley
Incorporated Patch. [ 701860 ] Improve Performance (python proxies).
Gives a performance boost to proxy class code and the management of the
.this and .thisown attributes. Contributed by Mike Romberg.
03/19/2003: cheetah (William Fulton)
[C# and Java] Added missing vararg support.
03/18/2003: mrose (Mark Rose)
Removed code related to tagging individual methods for directors.
The concept of having directors for some but not all virtual methods
of a class is deeply flawed. The %feature("nodirector") tag is also
gone.
Directors are off by default. To enable them for a class, issue
%feature("director") classname; which will create director methods
for every virtual method in the hierarchy of the class.
03/17/2003: beazley
Fixed a subtle problem with passing arguments of type function. For
example:
int foo(int x(int, int));
or
typedef int binop_t(int, int);
int foo(binop_t x);
In old versions, this would produce code that wouldn't compile. Now,
SWIG merely adds an extra pointer, making these declarations the same
as:
int foo(int (*x)(int, int));
typedef int binop_t(int, int);
int foo(binop_t *x);
Reported by Garth Bushell.
03/17/2003: mrose (Mark Rose)
Fixed the return statement for director base class calls that have no
return value.
03/15/2003: beazley
Fixed a problem with const smart-pointer wrapping. For example:
class Foo {
public:
int x;
void bar() const;
void spam();
};
class Blah {
...
const Foo *operator->();
...
};
In this case, only "x" and "bar" are visible from Blah (since application
of spam violates constness). Moreover, access to "x" is read-only.
03/15/2003: mrose (Mark Rose)
Cleaned up two signed versus unsigned comparisons in python/std_vector.i.
03/15/2003: cheetah (William Fulton)
[C#] Global variables are wrapped using properties instead of get and set methods.
Member variable wrapping bug fixes, for example wrapping pointers work now.
Typemaps are used for all variable wrapping to generate the property code.
03/13/2003: mrose (Mark Rose)
Fixed a bug in the virtual method unrolling for directors.
The order of unrolling is now from base to derived, to ensure
that the most derived implementation of a director method is
found.
Director methods for pure virtual methods now throw
DIRECTOR_PURE_VIRTUAL_EXCEPTION if _up is set.
03/12/2003: cheetah (William Fulton)
[C#] Polymorphism fix: virtual functions now use the appropriate
keyword in the C# proxy class, virtual or override.
Some 'using System;' statement fixes needed by the Mono compiler.
03/11/2003: beazley
Fixed subtle bug in the application of SwigValueWrapper<> to
template classes with default constructors. Reported by
Bruce Lowery.
03/11/2003: beazley
The $descriptor(type) variable is now expanded in code supplied to
%extend. This is useful for certain kinds of advanced wrapping
(especially container classes).
03/11/2003: luigi
Support for std::map.
(a) Integration with scripting language (a la std::vector) for
Python, Ruby, MzScheme, and Guile;
(b) Simple wrapper for other languages
03/10/2003: beazley
Fixed problem with escape sequences in string and character constants. SWIG
wasn't parsing certain octal codes correctly.
03/07/2003: beazley
Fixed a variety of subtle preprocessor problems reported by
Sebastien Recio.
(a) Empty preprocessor values no longer generate "bad constant
value" errors. For example:
#define FOO
#define FOO BAR
(b) Macro names can now span multiple lines (technically valid,
although questionable practice). For example:
#define A_LONG_MACRO_\
NAME 42
(c) Whitespace is no longer required before certain macro values.
For example:
#define FOO"Hello"
#define BAR\
"Hello"
03/07/2003: ljohnson (Lyle Johnson)
[Ruby] Added missing long long and unsigned long long typemaps
in the Lib/ruby/typemaps.i library file.
03/07/2003: mrose (Mark Rose)
Added Examples/python/callback to demostrate how directors can
be used to implement callbacks in Python
Added Examples/python/extend to demonstrate virtual method
calls from C++ to Python (really the same as the callback
example, just a different context).
Added four tests for very basic director functionality. These
have runtime tests under python.
The Python module now emits #define SWIG_DIRECTORS near the
top of the output file if directors are enabled. This is useful
for disabling parts of tests in target languages that don't
support directors.
03/06/2003: mrose (Mark Rose)
Added a section to Doc/Manual/Python.html on cross language
polymorphism (directors).
03/06/2003: mrose (Mark Rose)
The short-lived "-fdirectors" command line option has been
removed. To enable directors, instead use the extended %module
directive as follows:
%module(directors="1") modulename
03/06/2003: cheetah (William Fulton)
The long long typemaps have been rewritten so that they can be more
easily used with non ISO compilers, like Visual C++. For example
if you are wrapping the Windows 64 bit type __int64 the long long
typemaps can be used with %apply:
%apply long long { __int64 };
__int64 value1(__int64 x);
__int64 will now appear in the generated code instead of long long.
03/06/2003: beazley
*** DEVELOPER CHANGE ***
Swig module mutation has been changed slightly. When a language
class method wants to save node attributes, it now uses one of the
following functions:
Swig_require()
Swig_save()
The first argument to these functions is a namespace in which
saved attributes are placed. For example,this code
Node *n;
Swig_save("cDeclaration",n,"type","parms","name",NIL);
saves the attributes as "cDeclaration:type", "cDeclaration:parms",
and so forth. If necessary, a language module can refer to
old values by using this special namespace qualifier.
In addition to this, a special attribute "view" contains the name
of the last namespace used to save attributes. In the above
example, "view" would have the value "cDeclaration". The value
of "cDeclaration:view" would have the previous view and so forth.
Swig_restore(n) restores a node to the state before the last
Swig_require() or Swig_save() call.
Note: This change makes it easier for language modules to refer
to old values of attributes.
03/06/2003: mrose (Mark Rose)
Merged the cross-language polymorphism patch. When enabled, C++
"proxy" classes (called directors) are generated for each specified
C++ class. Directors pass method calls from C++ to Python, similar
to the way the usual proxy (shadow) classes pass method calls from
Python to C++. Together, these two types of proxies allow C++
classes that are extended in Python to behave just like ordinary
C++ classes and be used in C++ like native objects.
This feature is still very experimental and is disabled by default.
To enable director support, specify '-fdirectors' on the SWIG command
line or in the SWIG_FEATURES environment variable. In the interface
file, add %feature("director") to generate directors for all classes
that have virtual methods.
See http://stm.lbl.gov/~tm2/swig/ProxyDoc.html for more details.
03/03/2003: beazley
Fixed a small glitch in typemap local variable replacement. If you had
a typemap like this:
%typemap(in) type ($1_type temp) {
...
temp = ...;
...
}
and no occurrence of "$1_type" appeared in the body, then the local
variable type wouldn't be substituted.
03/03/2003: cheetah (William Fulton)
[C#] New version of the CSharp module which is typemap based.
It also uses ECMA C# and no longer uses Microsoft Visual C++.NET
glue. This means that it will work on non-Windows platforms.
Contributed by Neil Cawse.
02/27/2003: beazley
Fixed [ 653548 ] error parsing casting operator definition.
SWIG now ignores casting operators declared outside of a class.
For example:
inline A::operator char *() { ... }
Bug reported by Martin Casado.
02/27/2003: beazley
Added support for anonymous bit-fields. For example:
struct Foo {
int x : 4;
int : 4;
int y : 8;
};
Anonymous bit-fields are ignored by SWIG. Problem
reported by Franz Höpfinger.
02/26/2003: cheetah (William Fulton)
[Java] Better typemaps in the Examples/java/typemap example and also
fixes subtle bug when using the StringBuffer typemaps more than once.
02/26/2003: beazley
Fixed [ 642112 ] Constants char bug.
02/26/2003: beazley
Fixed [ 675337 ] Partial template specialization not entirely working.
There was a subtle problem related to the naming and ordering of
template partial specialization arguments. Matching worked okay,
the resulting templates weren't expanded correctly.
02/25/2003: beazley
Fixed problem with parsing (and generating code) for
references to arrays. For example:
int foo(int (&x)[10]);
02/25/2003: beazley
Fixed [ 635347 ] Compilation warning from libpy.c.
Reported by Daniel L. Rall.
02/25/2003: beazley
Fixed a subtle problem with virtual method implementation
checking and typedef.
typedef int *intptr;
struct A {
virtual int *foo() = 0;
};
struct B : public A {
virtual intptr foo() { };
};
SWIG was treating these declarations as different even though
they are the same (via typedef).
02/25/2003: ljohnson (Lyle Johnson)
[Ruby] Added range checking for the NUM2USHRT macro, per [ 675353 ].
02/24/2003: beazley
Fixed a subtle problem with the code that determined if a class is abstract
and can be instantiated. If you had classes like this:
struct A {
virtual int foo(int) = 0;
};
struct B : virtual A {
virtual int foo(int);
};
struct C : virtual A {
};
/* Note order of base classes */
struct D : B, C { }; /* Ok */
struct E : C, B { }; /* Broken */
then SWIG determined that it could instantiate D(), but not E().
This inconsistency arose from the depth-first search of the
inheritance hierarchy to locate the implementations of virtual
methods. This problem should now be fixed---SWIG will attempt
to locate any valid implementation of a virtual method by
traversing over the entire hierarchy.
02/22/2003: cheetah (William Fulton)
[Java] Fix for using enum typemaps. The Java final static variable type
can be set using the jstype typemap, enabling enums to be mapped to
something other than int. Bug reported by Heiner Petith.
02/21/2003: songyanf (Tiger)
Added CSharp (C#) module prototype
i.e. csharp.cxx & csharp.h at Source/Modules/.
They are for test usage only now and need improvement.
The interface also need to be modified.
*** NEW FEATURE ***
02/20/2003: songyanf (Tiger)
Fixed problem with typedef with -fvirtual.
Similar as beazley's modification today.
02/20/2003: beazley
Added support for gcc-style variadic preprocessor macros.
Patch [ 623258 ] GCC-style vararg macro support.
Contributed by Joe Mason.
02/20/2003: beazley
Fixed [ 605162 ] Typemap local variables.
Reported by Lyle Johnson.
02/20/2003: beazley
Fixed problem with abstract classes and typedef. For example:
class Foo {
public:
virtual void foo(int x) = 0;
};
typedef int Integer;
class Bar : public Foo {
public:
virtual void foo(Integer x);
};
SWIG was getting confused about the latter method---making Bar
abstract. Reported by Marcelo Matus.
02/19/2003: cheetah (William Fulton)
[Java] %javaconst(flag) can also be used on enums as well as constants.
This feature enables true Java compiler constants so that they can be
used in Java switch statements. Thanks to Heiner Petith for patches.
02/19/2003: songyanf (Tiger)
Modified -fcompact feature to deal with PP lines
02/18/2003: beazley
Fixed [ 689040 ] Missing return value in std_vector.i.
Reported by Robert H. de Vries.
02/18/2003: beazley
Fixed a few evil scoping problems with templates, namespaces, and the
%extend directive. Problem reported by Luigi Ballabio.
02/18/2003: cheetah (William Fulton)
[Ruby] Improved support for Visual C++ and other native Windows compilers.
It is no longer necessary to specify "/EXPORT:Init_<module>", where <module> is the
swig module name when linking using these native Windows compilers.
02/15/2003: songyanf (Tiger)
Added -fvirtual option.
Reduce the lines and size of the wrapper file
by omitting redifined virtual function in children classes.
Modified -compact option to -fcompact option
Added -small option.
-small = -fvirtual -fcompact
And it can be extended by future feature options,
which are used to reduce wrapper file szie.
Added SWIG_FEATURES environment variable check.
To dynamically set the feature options such as -fcompact & -fvirtual
*** NEW FEATURE ***
02/13/2003: lenz
Updated Doc/Manual/Perl5.html to talk about C++ compile problems
configure.in now checks for PERL5_CCFLAGS
Runtime/Makefile.in and Example/Makefile.in now use PERL5_CCFLAGS
Added Lib/perl5/noembed.h which contains all the known macro conflicts
02/12/2003: beazley
Fixed [ 685410 ] C++ Explicit template instantiation causes SWIG to exit.
Fixes a syntax error with declarations similar to this:
template class std::vector<int>;
SWIG now ignores the instantiation and generates a warning message.
We might do more later. Reported by Thomas Williamson.
02/11/2003: cheetah (William Fulton)
Rewrote bool typemaps to remove performance warning for compiling generated code
under Visual C++.
02/11/2003: cheetah (William Fulton)
Fix for wrapping reference variables (const non-primitive and all non-const types)
for example:
int& i;
Class& c;
const Class& c;
02/11/2003: beazley
Fixed more very subtle preprocessor corner cases related to recursive
macro expansion. For example:
#define cat(x,y) x ## y
cat(cat(1,2),3) // Produces: cat(1,2)3
#define xcat(x,y) cat(x,y)
xcat(xcat(1,2),3) // Produces 123
See K&R, 2nd Ed. p. 231.
02/10/2003: cheetah (William Fulton)
Fixed [ 683882 ] - patch submitted by F. Postma for SWIG to compile on HP-UX.
02/10/2003: beazley
Fixed subtle preprocessor argument expansion bug. Reported by Marcelo Matus.
02/10/2003: songyanf
Added -compact option.
Reduce the lines and size of the wrapper file
by omitting comments and combining short lines.
*** NEW FEATURE ***
02/07/2003: beazley
Fixed [ 651355 ] Syntax error with cstring.i
Reported by Omri Barel.
02/07/2003: beazley
Fixed [ 663632 ] incompatibility with standard cpp.
This is a refinement that fixes this problem:
// Some macro with an argument
#define FOO(x) x
int FOO; /* Not a macro---no arguments */
02/05/2003: beazley
Fixed [ 675491 ] parse error with global namespace qualification.
Submitted by Jeremy Yallop.
02/04/2003: beazley
Fixed bug in varargs processing introduced by the numinputs typemap parameter.
01/08/2003: ttn
[xml] Fix string-replacement ordering buglet.
Thanks to Gary Herron.
12/23/2002: cheetah (William Fulton)
Further build changes:
- The SWIG executable is now built using a single Makefile.
- This makefile is generated by Automake (Source/Makefile.am).
- Dependency tracking and tags support are in this makefile.
- Automake 1.7.2 and Autoconf 2.54 minimum versions are needed to build SWIG from CVS.
- Running ./autogen.sh now installs Autoconf/Automake support files into
Tools/config and these files are no longer stored in CVS.
- Bug fixes in 'make install' for systems using .exe executable extension and
./configure --with-release-suffix=whatever
12/16/2002: cheetah (William Fulton)
More build changes:
- Autoconf's AC_CANONICAL_HOST replaces proprietary approach for detecting build host.
- Autoconf support files moved to Tools/config.
12/16/2002: cheetah (William Fulton)
Modifications to run on MacOS, submitted by Bernard Desgraupes.
Mainly ensuring generated files are output in the appropriate directory for
some modules.
12/11/2002: cheetah (William Fulton)
Various build modifications and bug fixes:
- Simplification of version string. Use autoconf's PACKAGE_VERSION instead.
- Build time removed from SWIG version.
- Using standard autoconf config header generation.
- Updated old autoconf macros as reported by autoupdate.
- Removed $prefix in autoconf from search paths as autoconf won't expand them.
- Subtle bug fix where 'make prefix=/somewhere; make clean; make prefix=/somwhere/else'
produced an executable using the incorrect library directories.
- Added -ldflags commandline option for MzScheme, Ocaml, Pike and PHP.
- Fixed reporting of compiler used when using -version commandline option.
- SWIG web address added to -version commandline option.
12/11/2002: beazley
Minor fix to Tcl dynamic cast typemaps. Reported by
Kristopher Blom.
12/10/2002: beazley
Fixed subtle template argument replace bug. Reported by
Chris Flatley.
12/10/2002: beazley
Reverted CHANGES 09/03/2002, preprocessor argument evaluation. Arguments
are not evaluated during collection, K&R, p. 230.
12/06/2002: beazley
Fixed [ 649022 ] Compilation problems with KAI/KCC
12/02/2002: beazley
SWIG 'rel-1-3' CVS branch merged back into the main branch.
Version 1.3.17 (November 22, 2002)
==================================
11/19/2002: beazley
Fixed [ 613922 ] preprocessor errors with HAVE_LONG_LONG.
11/19/2002: beazley
Fixed [ 615480 ] mzscheme SWIG_MustGetPtr_.
11/19/2002: beazley
Fixed [ 635119 ] SWIG_croak causes compiler warning.
11/16/2002: cheetah (William Fulton)
[Java] Added typemaps for pointers to class members.
11/15/2002: cheetah (William Fulton)
[Java] Bug fix: Overloaded C++ functions which cannot be overloaded in Java
once again issue a warning.
11/14/2002: cheetah (William Fulton)
[Java] Handling of NULL pointers is improved. A java null object will now
be translated to and from a NULL C/C++ pointer by default. Previously when
wrapping:
class SomeClass {...};
void foo(SomeClass *s);
and it was called from Java with null:
modulename.foo(null)
a Java NullPointerException was thrown. Extra typemaps had to be written in
order to obtain a NULL pointer to pass to functions like this one. Now the
default wrapping will detect 'null' and translate it into a NULL pointer.
Also if a function returns a NULL pointer, eg:
SomeClass *bar() { return NULL; }
Then this used to be wrapped with a SomeClass proxy class holding a NULL
pointer. Now null is returned instead. These changes are subtle but useful.
The original behaviour can be obtained by using the original typemaps:
%typemap(javaout) SWIGTYPE {
return new $&javaclassname($jnicall, true);
}
%typemap(javaout) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] {
return new $javaclassname($jnicall, $owner);
}
%typemap(javagetcptr) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] %{
protected static long getCPtr($javaclassname obj) {
return obj.swigCPtr;
}
%}
*** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
11/12/2002: beazley
Fixed problem with abstract methods and signatures. For example:
class abstract_foo {
public:
virtual int meth(int meth_param) = 0;
};
class abstract_bar : public abstract_foo {
public:
int meth(int meth_param_1, int meth_param_2) { return 0; }
};
In this case, abstract_bar is still abstract.
Fixes [ 628438 ] Derived abstract class not abstract.
Reported and patched by Scott Michel.
11/11/2002: beazley
Fixed a matching problem with typemaps and array dimensions. For example, if you
had this:
typedef char blah[20];
and a typemap:
%typemap() char [ANY] {
... $1_dim0 ...
}
then $1_dim* variables weren't be expanded properly. It should work now.
Problem reported by Pankaj Kumar Goel.
11/07/2002: mkoeppe
Added an experimental new module that dumps SWIG's parse
tree as (Common) Lisp s-expressions. The module is
invoked with SWIG's -sexp command-line switch. The output
can be read into Common Lisp. There is (prototype)
example Lisp code that generates Foreign Function Interface
definitions for use with Kevin Rosenberg's UFFI.
*** EXPERIMENTAL NEW FEATURE ***
11/07/2002: mkoeppe
Removed duplicate declaration of "cpp_template_decl" in
parser.y; bison 1.75 complained.
11/06/2002: cheetah (William Fulton)
[Java] Default primitive array handling has changed like arrays of classes.
C primitive arrays are no longer wrapped by a Java array but with a pointer
(type wrapper class). Again the changes have been made for efficiency reasons.
The original typemaps have been moved into arrays_java.i, so the original
behaviour can be obtained merely including this file:
%include "arrays_java.i"
The array support functions are no longer generated by default. They are only
generated when including this file, thus this often unused code is only
generated when specifically requiring this type of array support.
*** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
11/05/2002: ljohnson (Lyle Johnson)
[Ruby] Added support for nested module declarations (as was
previously added for the Perl module). So a %module directive
of the form:
%module "Outer::Inner::Foo"
will nest everything as (in Ruby code):
module Outer
module Inner
module Foo
# stuff goes here
end
end
end
11/05/2002: mkoeppe
[MzScheme] Add an argument (-declaremodule) that generates
code to correctly declare a primitive module extension.
Patch submitted by Bruce Butterfield.
11/02/2002: cheetah (William Fulton)
[Java] Added patch submitted by Michael Cahill to remove unused parameter
warnings for the jenv and cls parameters. This patch also also allows one
to use "void" in the jni typemap for any type without code being generated
attempting to return a value.
10/29/2002: cheetah (William Fulton)
[Java] Array handling is different. Arrays of classes are no longer wrapped
with proxy arrays, eg wrapping
class X {...};
X foo[10];
used to be wrapped with these Java getters and setters:
public static void setFoo(X[] value) {...}
public static X[] getFoo() {...}
This approach is very inefficient as the entire array is copied numerous
times on each invocation of the getter or setter. These arrays are now
wrapped with a pointer so it is only possible to access the first array element
using a proxy class:
public static void setFoo(X value) {...}
public static X getFoo() {...}
Arrays of enums have also been similarly changed. This behaviour is now like the
other SWIG language's implementation and the array library should be used to
access the other elements. The original behaviour can be achieved using the
macros and typemaps in arrays_java.i, for example:
%include "arrays_java.i"
JAVA_ARRAYSOFCLASSES(X)
class X {...};
X foo[10];
*** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
10/29/2002: cheetah (William Fulton)
[Java] Two new typemaps javain and javaout for generating the proxy class
and type wrapper class method calls to the JNI class. The new typemaps are
really used for transforming the jstype (used in proxy class and type wrapper
classes) to the jtype (used in the JNI class) and visa versa. A javain typemap
is required whenever an in typemap is written and similarly javaout for an out
typemap. An example is probably best to show them working:
%typemap(javain) Class "Class.getCPtr($javainput)"
%typemap(javain) unsigned short "$javainput"
%typemap(javaout) Class * {
return new Class($jnicall, $owner);
}
%inline %{
class Class {};
Class * bar(Class cls, unsigned short ush) { return new Class(); };
%}
The generated proxy code is then:
public static Class bar(Class cls, int ush) {
return new Class(exampleJNI.bar(Class.getCPtr(cls), ush), false);
}
Some new special variables have been introduced in order to use these typemaps.
Here $javainput has been replaced by 'cls' and 'ush'. $jnicall has been replaced by
the native method call, 'exampleJNI.bar(...)' and $owner has been replaced by 'false'.
$javainput is analogous to the $input special variable. It is replaced by the parameter name.
$jnicall is analogous to $action in %exception. It is replaced by the call to the native
method in the JNI class.
$owner is replaced by either true if %newobject has been used otherwise false.
The java.swg file contains default javain and javout typemaps which will produce the same code
as previously. This change is only of concern to those who have written their own typemaps as
you will then most likely have to write your own javain and javaout typemaps.
The javaout typemap also makes it possible to use a Java downcast to be used on abstract
proxy base classes. See the Java documentation on dynamic_cast.
*** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
10/24/2002: ttn
[Methodology] Upgaded to libtool 1.4.3, presumably w/ better
support for newish platforms (like MacOS X).
10/21/2002: ttn
Fixed Runtime/Makefile.in bug -- thanks to Richard Calmbach.
10/18/2002: ttn
Fixed typo in doh.h -- thanks to Max Horn.
Version 1.3.16 (October 14, 2002)
=================================
10/13/2002: beazley
Fixed bug with %extend directive and %feature reported
by William Fulton.
10/13/2002: beazley
Added OpenVMS build directory (vms). Contributed by
Jean-François Pieronne.
10/09/2002: cheetah (William Fulton)
[Java] Added throws clause to the native functions in the JNI class.
The throws clause is the same as the one generated for proxy functions
and module class functions.
09/27/2002: beazley
Fixed some problems with the %import directive and classes that
were defined but not wrapped. Problem reported by Leslie Brooks,
Gerry Woods, and others.
09/23/2002: cheetah (William Fulton)
[Java] Some error checking added:
1) OutOfMemoryException check in the char * typemaps.
2) As SWIG treats pointers, references and passing by value all the
same, it is possible to pass a NULL pointer to a function that expects
an object passed by value or by reference. A NullPointerException is
now thrown under this scenario.
09/20/2002: ttn
[Methodology] Reworked "make clean" and "make install"
to be more table driven.
[Docs] Explain how to extend "make install" w/ extra-install.list.
09/15/2002: beazley
Deprecation of the "ignore" typemap. The "ignore" typemap has
been deprecated in favor of a generalization of the "in" typemap.
To ignore an argument, use something like this instead:
%typemap(in,numinputs=0) int *output (int temp) {
$1 = &temp;
}
This change fixes a number of subtle bugs related to the interaction
of the "in" and "ignore" typemaps (which were supposed to be
mutually exclusive).
The use of the numinputs argument is reserved for future expansion.
Currently, values >1 will generate an error. However, future
releases of SWIG may utilize that to support multi-input typemaps.
%typemap(ignore) still works, but generates a warning message and is
translated to %typemap(in,numinputs=0).
*** POTENTIAL INCOMPATIBILITY ***
*** NEW FEATURE ***
09/15/2002: beazley
Fixed segmentation fault for unnamed structures. For example:
typedef struct {
} *blah;
Reported by Roger Gibson.
Note: we might be able to generate wrappers in special cases.
09/13/2002: beazley
Minor modification to generated wrapper functions. Pointer arguments are now
always set to an initial value of 0. Simplifies typemap writing and cleanup
code (since you can rely on zero-value initialization). This also greatly
reduces the need to ever write an "arginit" typemap.
09/12/2002: beazley
Minor enhancement to smart-pointer support. If operator->()
is part of an ignored base class like this,
%ignore Bar;
class Foo {
public:
int blah();
};
class Bar { /* Ignored */
public:
...
Foo *operator->();
...
};
class Spam : public Bar { };
then methods from Foo are still available. For example,
>>> s = Spam()
>>> s.blah()
0
>>>
The only catch is that the operator->() itself is not available
(since it wasn't wrapped). Therefore, there won't be any
__deref__() operation unless it is explicitly added to Spam
(either using %extend or just placing operator->() in the
definition of Spam).
09/11/2002: ttn
[Methodology] Reworked "make check" to be more table driven.
[Docs] Docuemented methodology in Manual/Extending.html.
09/11/2002: ttn
[Docs] Prefixed Manual/*.html with "<!DOCTYPE html ...>" to
pander dotingly to (over-)sensitive editors.
09/10/2002: ttn
[Guile] Converted Examples/guile/simple "make check"
behavior to actually check execution results. Reduced
iteration counts so that the test doesn't take too long.
09/10/2002: beazley
SWIG-1.3.15 released.
Version 1.3.15 (September 9, 2002)
==================================
09/09/2002: beazley
Fixed nasty runtime type checking bug with subtypes and inheritance
and templates.
09/09/2002: cheetah (William Fulton)
[Java] Java exception classes for a method's throws clause can be generated by
specifying them in a comma separated list in the throws attribute in any one
of the following typemaps: in, out, check, freearg, argout and throws. A classic
example would be to convert C++ exceptions into a standard Java exception:
%typemap(throws, throws="java.io.IOException") file_exception {
jclass excep = jenv->FindClass("java/io/IOException");
if (excep)
jenv->ThrowNew(excep, $1.what());
return $null; // or use SWIG_fail
}
class file_exception {...};
void open(const char *filename) throw(file_exception);
The Java method will then be declared with a throws clause:
public static void open(String filename) throws java.io.IOException {...}
09/08/2002: mkoeppe
* [Guile] Improved the documentation system. The arglist no
longer gets cluttered with type specification, making it
more readable. (Also the ILISP function C-u M-x
`arglist-lisp' RET works better this way.) The types of
arguments are explained in an extra sentence after the
arglist.
There are now two documentation-related typemap arguments:
%typemap(in, doc="$NAME is a vector of integers",
arglist="$name") int *VECTOR { ... }
The "arglist" texts of all arguments of a function make up
its arglist in the documentation. The "doc" texts of all
arguments are collected to make a sentence that describes
the types of the arguments. Reasonable defaults are
provided.
As usual, $name is substituted by the name of the
argument. The new typemap variable $NAME is like $name,
but marked-up as a variable. This means that it is
upper-cased; in TeXinfo mode ("-procdocformat texinfo") it
comes out as @var{name}.
The directives %values_as_list, %values_as_vector,
%multiple_values now also have an effect on the
documentation. (This is achieved via the new pragmas
return_nothing_doc, return_one_doc, return_multi_doc.)
Documentation has also improved for variables that are
wrapped as procedures-with-setters (command-line switch
"-emit-setters").
* [Guile] Emit constants as _immutable_ variables. (This
was broken recently.)
09/07/2002: mkoeppe
[Guile] Updated the typemaps in list-vector.i.
09/07/2002: mkoeppe
Short-circuit the typechecks for overloaded functions.
(The changes in code generation are visible in the new
testcase "overload_complicated".)
09/06/2002: cheetah (William Fulton)
[Java] Solution for [ 596413 ]
New typemap so that the Java proxy classes and type wrapper classes
wrapper constructor modifier can be tailored by users. The default value is
protected. Normally SWIG generates a constructor like this which can only
be accessed within one package:
protected Bar(long cPtr, boolean cMemoryOwn) {
...
}
If you are using SWIG across multiple packages or want to use this constructor
anyway, it can now be accessed outside the package. To modify use for example:
%typemap(javaptrconstructormodifiers) SWIGTYPE "public"
to change to public for all proxy classes and similarly for all type wrapper classes:
%typemap(javaptrconstructormodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] "public"
09/06/2002: cheetah (William Fulton)
[Java] Added throws typemaps for the Java module. C++ exceptions get converted into
java.lang.RuntimeException Java exceptions.
Warning: This may change from java.lang.Runtime exception in the future.
09/05/2002: cheetah (William Fulton)
[Java] Fix for variables declared as references.
09/05/2002: beazley
Fixed [ 605162 ] Typemap local variables. Reported by Lyle Johnson.
09/05/2002: ljohnson (Lyle Johnson)
[Ruby] More updates to the Ruby module documentation, including
a new typemap example that demonstrates how to collect key-value
pairs from an argument list into a Hash.
09/05/2002: beazley
Fixed bug with template expansion and constructors.
template<class T> class Foo {
public:
Foo<T>() { }
};
The extra <T> in the constructor was carried through in the
name--causing runtime problems in generated modules.
Reported by Jordi Arnabat Benedicto.
09/05/2002: mkoeppe
[Guile] Support overloading.
09/04/2002: ljohnson (Lyle Johnson)
[Ruby] Updated typemaps for long long and unsigned long long types
to use Ruby 1.7 support for these types when available.
09/04/2002: ljohnson (Lyle Johnson)
[Ruby] Added output typemaps for const reference to primitive
types.
09/04/2002: mkoeppe
[Guile] Fix pass-by-value typemaps. Reported by Arno
Peters via Debian bugtracking (#156902), patch by Torsten
Landschoff <torsten@debian.org>.
09/03/2002: samjam (Sam Liddicott)
Better reference support.
Functions that want a void** can take a NULL by reference and
the void* will be made for you and then passed-by-reference
Also all integer-class native types can be passed by reference
where an int* or int& etc is needed
09/03/2002: beazley
Changed the evaluation order of preprocessor macro arguments.
Arguments are now expanded by the preprocessor *before* they
are passed to macro expansion. This fixes a subtle expansion
bug reported by Anthony Heading.
09/03/2002: beazley
Fixed the file include order (again, apparently). See 2/27/99.
09/02/2002: beazley
[Perl] Better exception handling support. Since Perl error handling
relies on setjmp/longjmp, wrapper functions have been modified slightly
to provide an extra block scope:
XS(foo) {
char _swigmsg[SWIG_MAX_ERRMSG] = "";
const char *_swigerr = _swigmsg;
{
/* Normal wrapper function here */
...
SWIG_croak("An error occurred\n");
...
XSRETURN(argvi); /* Successful return */
fail:
/* cleanup code */
}
croak(_swig_err);
}
The macro SWIG_croak(x) sets the value of _swigerr to x and
executes a "goto fail". The whole wrapper function is enclosed
block scope to provide proper cleanup of C++ objects. Since
croak executes a longjmp(), there is no way to properly reclaim
resources if this executes in the same scope as the wrapper
function.
The _swigmsg[] variable is normally unused, but can be used
to store small error messages using sprintf or snprintf. It
has a capacity of at least 256 bytes (SWIG_MAX_ERRMSG).
09/02/2002: beazley
[Tcl] Added better support for exceptions. Instead of returning TCL_ERROR,
use the macro SWIG_fail to return with an error. This ensures that
arguments are properly cleaned up. Exception specifiers are now
handled by default.
09/02/2002: ljohnson (Lyle Johnson)
[Ruby] The type-checking system for the Ruby module has had a flaw
in that some types which should be considered equivalent
weren't. This bug was best demonstrated by the inherit_missing.i
test suite case, which defines a base class "Foo" that is
subclassed by "Bar". The "Foo" class isn't actually wrapped (i.e.
it's not directly accessible from Ruby) but we'd still like to be
able to pass "Bar" instances to functions expecting Foos and have
that work; it wasn't. The revised implementation (similar to that
used for some other language modules) adds a new instance variable
(__swigtype__) to each object that indicates its SWIG type;
that is, each "Bar" instance will now have a string instance
variable called "__swigtype__" whose value is "_p_Bar".
Unless developers were taking advantage of this low-level
implementation detail, they shouldn't notice any compatibility
problems; nevertheless, I'm marking it as a "potential
incompatibility".
*** POTENTIAL INCOMPATIBILITY ***
09/01/2002: ljohnson (Lyle Johnson)
[Ruby] Fixed SF Bug #603199.
08/08/2002: cheetah (William Fulton)
[Java] Added OUTPUT, INPUT and INOUT typemaps in typemaps.i for C++
references.
08/27/2002: mkoeppe
[Guile] Fixed error in "lib_std_vector" testcase and
compiler warning in "lib_cdata" testcase.
08/27/2002: ljohnson (Lyle Johnson)
[Ruby] Added the "%mixin" directive, which allows the user to
specify a comma-separated list of module names to mix-in to a
class. So, for example, if you'd like to specify that Ruby's
Enumerable module should be mixed-in to your class Foo, you'd
write:
%mixin Foo "Enumerable";
or to specify that the modules Fee, Fie and Fo should be mixed
in to Foo:
%mixin Foo "Fee,Fie,Fo";
*** NEW FEATURE ***
08/27/2002: ljohnson (Lyle Johnson)
[Ruby] Modified the %alias directive so that multiple aliases
can be specified for an instance method by using a comma-separated
list of aliases.
08/27/2002: ljohnson (Lyle Johnson)
[Ruby] Added "throw" typemaps for the Ruby module.
08/26/2002: beazley
Two new command line options for printing dependencies.
'swig -M' lists all file dependencies. 'swig -MM' lists
dependencies, but excludes files in the SWIG library.
Example:
% swig -M -python example.i
example_wrap.cxx: \
/u0/beazley/Projects/lib/swig1.3/swig.swg \
/u0/beazley/Projects/lib/swig1.3/python/python.swg \
example.i \
example.h
% swig -MM -python example.i
example_wrap.cxx: \
example.i \
example.h
*** NEW FEATURE ***
08/26/2002: beazley
Fixed [ 597599 ] union in class: incorrect scope.
Reported by Art Yerkes.
08/26/2002: beazley
Fixed [ 600132 ] Default argument with namespace.
Reported by Shibukawa Yoshiki.
08/24/2002: beazley
Automatic C++ exception handling enabled for all language modules. This is
pretty simple. If you have a class like this:
class Foo {
};
class Bar {
public:
void blah() throw(Foo);
}
then the generated wrapper code looks like this:
wrap_Bar_blah() {
...
try {
arg1->blah();
}
catch (Foo &_e) {
/* "throw" typemap code inserted. $1 = _e */
}
catch (...) {
throw;
}
}
The "throw" typemap can be used to raise an error in the target
language. It can do anything. Here is a very simple example:
%typemap("throw") Foo {
PyErr_SetString(PyExc_RuntimeError, "Foo exception");
return NULL;
}
To make this work in each language module, simply define a few default
"throw" typemaps for SWIGTYPE, SWIGTYPE *, int, const char *, and a
few common exception types. That's all there is to it.
Automatic exception handling can be disabled using -noexcept or
setting the NoExcept global variable to 1.
*** NEW FEATURE ***
08/23/2002: beazley
[ Python ]
Automatic translation of C++ exception specifications into error handling code.
For example:
class Foo {
};
class Bar {
public:
void blah() throw(Foo);
}
In this case, Foo is wrapped as a classic-style class (compatible
with exception handling). Furthermore, you can write Python code
like this:
b = Bar()
try:
b.blah();
except Foo,e: # Note use of exception class here!
# Handle Foo error
...
The object "e" in the exception handler is just a wrapped Foo
object. Access it like a normal object.
If an exception is not wrapped as a class, a RuntimeError
exception is raised. The argument to this exception is
the exception object. For example:
class Bar {
public:
void blah() throw(int);
}
b = Bar()
try:
b.blah();
except RuntimeError,e:
print e.args[0] # Integer exception value
Comments:
- If a class is used as an exception, it *must* be wrapped
as a Python classic-style class (new classes don't work).
- Automatic exception handling is compatible with %exception.
- Use -noexcept to turn off this feature.
- The newly introduced "throw" typemap is used to raise
Python errors (naturally).
*** EXPERIMENTAL NEW FEATURE ***
08/23/2002: beazley
Information from throw() specifiers is now stored in the parse
tree. For example:
class Foo {
public:
int blah() throw(spam,bar);
}
The stored information is fully corrected for namespaces and works
with templates. Uses will follow.
08/22/2002: beazley
Exception handling code is no longer applied to member access
function. For example, in this code
%exception {
try {
$action
} catch(whatever) {
...
}
}
class Foo {
public:
int x;
...
}
The exception handling code is not applied to accessor functions
for Foo::x. This should reduce the amount of extra code
generated.
Caveat: Exception handling code *is* used when attributes are
accessed through a smart-pointer or a synthesized attributed
added with %extend is used.
08/22/2002: beazley
Made more patches to hopefully eliminate problems when compiling SWIG
as a 64-bit executable.
08/22/2002: beazley
Fixed a bug with const reference members, variables, and static members.
For example:
class Foo {
public:
static const int &ref;
};
SWIG was trying to generate "set" functions which wouldn't compile.
08/21/2002: beazley
Made the warning message for "Class X might abstract" off by default.
Enable with -Wall.
08/21/2002: beazley
Refined handling of const and non-const overloaded methods. If
a class defines a method like this:
class Foo {
public:
int bar(int);
int bar(int) const;
}
Then the non-const method is *always* selected in overloading and
the const method silently discarded. If running with -Wall, a warning
message will be generated.
08/19/2002: beazley
Better support for using declarations and inheritance. Consider this:
class Foo {
public:
int blah(int x);
};
class Bar {
public:
double blah(double x);
};
class FooBar : public Foo, public Bar {
public:
char *blah(char *x);
using Foo::blah;
using Bar::blah;
};
Now SWIG wraps FooBar::blah as an overloaded method that uses all
accessible versions of blah(). See section 15.2.2 in Stroustrup, 3rd Ed.
SWIG also supports access change through using declarations. For example:
class Foo {
protected:
int x;
int blah(int x);
};
class Bar : public Foo {
public:
using Foo::x;
using Foo::blah;
};
Caveat: SWIG does not actually check to see if declarations imported
via 'using' are in the inheritance hierarchy. If this occurs, the
wrapper code won't compile anyways---not sure it's worth worrying about.
08/18/2002: beazley
Modified overloading dispatch to not include nodes with an "error" attribute.
A language module can set this if a node couldn't be wrapped and you don't want
it included in the dispatch function.
08/18/2002: beazley
Enhancement to overloaded function dispatch. The dispatcher is now aware of
inheritance relationships. For example:
class Foo { };
class Bar : public Foo { };
void spam(Foo *f);
void spam(Bar *b);
In this case, the dispatcher re-orders the functions so that spam(Bar *b) is
checked first---it is more specific than spam(Foo *f).
08/17/2002: beazley
Added -Werror command line option. If supplied, warning messages are treated
as errors and SWIG will return a non-zero exit code.
08/17/2002: beazley
Fixed [ 596135 ] Typedef of reference can't compile. For example:
typedef int &IntRef;
void foo(IntRef i);
SWIG-1.3.14 generated code that wouldn't compile.
Version 1.3.14 (August 12, 2002)
================================
08/11/2002: mmatus
Static const members initialized during declaration, and
only them, ie:
struct A
{
static const int a = 1 ; // this one
static const int b; // not this one
};
are emitted like constants (equivalent to enums or
explicit %constant).
This is because they cannot be added directly to 'cvar'
since they lack the needed reference (well, you can force
them to have a real reference, but in an ugly way which
goes completely again the original purpose of initialize
them during declaration, you also have to deal with extra
linking matters, and it take a while to figure out what is
the problem and how to solve it).
Please test it with your preferred target language, and
not only the code generation, but really run the example
in the test-suite (static-const-member-2.i) because the
problem and the solution cannot be "fully" appreciated
until you try to load the module and run it.
In some target languages (python specially), this can
produces a difference in the way that the static constant
members 'a' and 'b' are internally wrapped. Hopefully,
they still can be accessed in the same way.
08/11/2002: mmatus
[python] Now static const members can be accessed in a more
natural way, ie, if you have
struct A
{
typedef unsigned int viewflags;
static const viewflags forward_field = 0;
static const viewflags backward_field;
};
now you can do:
print A.backward_field
and also
a = A()
print a.forward_field
Note that if the static const members don't have an
initializer (like backward_field), still you can access
them in the same way in the python side, but the
implementation is a quite different: backward_field will
still appear in the cvar entity, and also, you are
responsible to initialize it in some code unit, and link it
properly. forward_field, by the other hand, will not
appear in the cvar entity but only as a A member, similar
to what happen with enum or %constant members.
08/11/2002: mmatus
[python] Common code in the __setattr__/__getattr__ now
goes to two "free" methods at the beginning of the proxy
file, from where each class use it. This change reduces
the size of the proxy file, specially if you wrap a lot of
small classes in one module (up to 33% in some cases),
making it faster to load too.
08/09/2002: beazley
[Perl5] If a function that returns char * returns NULL,
undef is returned to the Perl interpreter.
08/09/2002: beazley
Fix to conversion operators and namespaces. For example:
namespace ns {
struct Foo { };
struct Bar {
operator Foo*();
};
}
In the wrapper code, SWIG was using ->operator Foo*()
when it should have been using ->operator ns::Foo*().
Note: if using %rename with a conversion operator, you
might have to do this:
%rename(toFooPtr) ns::operator ns::Foo*();
// ^^^^ note extra qualifier
namespace ns {
...
08/09/2002: beazley
[Python] Minor enhancement to 'const' variable declarations.
Normally const declarations are wrapped as read-only variables
accessible only through the cvar attribute (see SWIG.html for
a discussion of why). However, in many programs, "const"
declarations may just be constants---making the cvar. access
awkward. To fix this, "const" declarations are now available
both through cvar. and as a simple name. For example:
const int FOO = 42;
In Python:
>>> print example.cvar.FOO
42
>>> print example.FOO
42
Note: There are cases where the value of a "const" variable
might change. For example:
char *const BAR = "Hello World";
In this case, the pointer itself can not change, but the
data being pointed to could be modified. In these situations,
cvar.BAR should be accessed to obtained the current value.
08/08/2002: beazley
[Python] Fixed generation of the proxy code (.py files) to more
closely follow the order of declarations as they appear in
the .i file. In the past, all of the class wrappers appeared
first, followed by function stubs, inserted Python code, and
other details.
08/08/2002: cheetah (William Fulton)
[Java] Proxy method _delete() changed to delete(). There shouldn't ever
be a wrapped function called delete() as it is a C++ keyword and there
is no such thing as a member function in C.
*** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
Backwards compatibility can be achieved by adding the function back in
for all proxy classes:
%typemap(javacode) SWIGTYPE %{
public void _delete() {
delete();
}
%}
Java backwards compatibility summary
------------------------------------
There are a number of changes that have been made in improving the Java module
for ver 1.3.14. If at all possible change your code to take advantages of the
improvements. If you were using proxy classes you may not notice any backwards
compatibility issues. Here is an example which will help with most backwards
compatibility problems where it is not possible to modify the code that uses
the generated output:
Replace:
%module modulename
With:
%module (jniclassname="modulename") modulename;
%typemap(javacode) SWIGTYPE %{
public long getCPtr$javaclassname() {
return swigCPtr;
}
public void _delete() {
delete();
}
%}
%pragma(java) jniclassclassmodifiers="public";
The proxy constructors that took parameters (long cPtr, boolean cMemoryOwn)
were public and are now protected. If you were making use of these then you'll
have to modify your code and the best solution would be to use the new type
wrapper classes.
The other main areas are the pragmas and global variable wrapping. Replace
the pragmas with one of the new directives or typemaps mentioned below and use
%rename on the variables.
If you were not using proxy classes, you will have to define a jstype typemap
as well as a jtype typemap.
08/08/2002: cheetah (William Fulton)
[Java] Fix for wrapping two dimension array variables.
08/07/2002: beazley
[Python,Tcl]
Object management now has a much better sense of ownership.
Ownership bits is changed whenever an object is stored in a
global variable or structure member. For example:
struct Foo {
int val;
Foo *next;
};
Now in Python
>>> f = Foo()
>>> f.thisown
1
>>> g = Foo()
>>> g.next = f # Assign a pointer
>>> f.thisown # Notice ownership change
0
>>>
This scheme is mostly a conservative heuristic designed to
provide segmentation faults. It could cause a memory leak
if ownership is changed unnecessarily. In this case, you can
either write a typemap (that doesn't change ownership), or
manually set the thisown attribute back to 1.
08/07/2002: beazley
[Tcl] Major usability improvements to the object interface.
Suppose you had code like this:
struct Foo {
int x;
int spam();
};
void blah(Foo *f);
In past versions of SWIG, you could create objects and use
them like this:
% Foo f
% f configure -x 3
% f spam
37
The only problem is that if you tried to call blah(), it didn't
work:
% blah f
Type Error. Expected _p_Foo
%
Instead, you had to do this:
% blah [f cget -this]
SWIG now automatically extracts the -this pointer, avoiding this
problem. This means that saying "blah f" is perfectly legal and
everything will still work normally.
Caveat: Since pointer strings start with a leading underscore (_),
don't use this in object names. For example:
% Foo _f
% blah _f # Potential crash
Objects now have a -thisown attribute that shows the ownership.
This builds upon the CHANGES 11/24/2001 entry.
08/07/2002: samjam, Sam Liddicott
Properly implemented pointer system using php resources.
Still need to work out whether or not to let script-users call
destructors directly
08/06/2002: beazley
Upgraded mzscheme module to support version 201 and added
overloading support.
08/05/2002: beazley
Added parsing support for extra grouping (in very limited cases).
For example:
typedef int (FuncPtr)(int, double);
*** EXPERIMENTAL ***
08/03/2002: ljohnson (Lyle Johnson)
[Ruby] Updates to typemaps.i as those done previously for Perl,
Python and Tcl modules. Now supports reference types with INPUT,
OUTPUT and INOUT typemaps.
08/02/2002: beazley
New library file cstring.i added. Provides macros for
manipulating char * data.
08/02/2002: beazley
Deprecated the %new directive. Use %newobject instead. For
example:
%newobject foo;
...
char *foo();
%newobject follows the same rules as %rename, %ignore, %feature,
etc.
*** POTENTIAL INCOMPATIBILITY ***
08/01/2002: cheetah (William Fulton)
[Java] New attribute 'jniclassname' for the module directive allows a way of
changing the JNI class name from the default which uses the modulename with JNI
appended after it.
%module (jniclassname="name") modulename
If 'name' is the same as 'modulename' then the module class name gets changed
from 'modulename' to modulenameModule.
08/01/2002: beazley
Fixed problem with file include order. Language specific
directories should take precedence over generic directories.
For example: "swig_lib/python/foo.i" should be loaded before
"swig_lib/foo.i". I thought this was the case already, but
apparently it has been broken for quite some time.
08/01/2002: beazley
Added std_deque.i library file. Work in progress.
08/01/2002: beazley
[Python,Tcl,Perl]
Improvements to typemaps.i. INPUT/INOUT typemaps perform better
error checking. Typemaps are now supplied for references like
int &OUTPUT, double &INOUT, etc.
08/01/2002: beazley
[Python] Deprecated the T_* and L_* typemaps in typemaps.i.
Multiple return values are always placed in a tuple. Deprecated
the BOTH typemaps. This is now INOUT (e.g., int *INOUT).
*** POTENTIAL INCOMPATIBILITY FOR PYTHON MODULE ***
08/01/2002: beazley
Deprecated the array.i, carray.i, and timer.i library files.
08/01/2002: beazley
Deprecated the pointer.i library file. Use cpointer.i instead.
*** POTENTIAL INCOMPATIBILITY ***
08/01/2002: cheetah (William Fulton)
[Java] For consistency the global variable getters and setters use the JavaBean
property design pattern like member variables always have. This means if you are
wrapping a variable called foo, the getter is called getFoo() and the setter is
called setFoo(). Before the recent changes to the Java module the getters and
setters were called get_foo() and set_foo(). If you really want the original
function names use the %rename directive like this: %rename(_foo) Foo;
07/31/2002: beazley
Fixed casting problem with multiple inheritance. If you had this,
class foo {};
class bar : public foo {};
class baz : public foo {};
class spam : public bar, public baz {};
then the wrappers wouldn't compile due to an ambiguous cast.
Reported by Art Yerkes.
07/30/2002: cheetah (William Fulton)
[Java] Due to new static typechecking all pointers held in a Java long are part of
the internal workings and this pointer value in the Java long has become abstracted
data. The type wrapper constructor and getCPtr() methods are as such protected.
If you need to mess around with pointers from Java or for example create a proxy
class or type wrapper class around a null pointer, add a function/constructor
to do so with the %javacode typemap. You can also make getCPtr() public again with
the %javagetcptr typemap.
07/30/2002: cheetah (William Fulton)
[Java] Fixes for %typemap(ignore). In particular when ignoring the last parameter
in a function. Also for all parameters in constructors. These mods have also fixed
multi-argument typemaps for proxy classes - SF 581791.
07/30/2002: cheetah (William Fulton)
[Java] %newobject (replacement for %new) now implemented for Java.
07/29/2002: beazley
Fixed problem with typemap copies, %apply, and %clear inside
C++ namespaces.
07/28/2002: cheetah (William Fulton)
[Java] The JNI class now has package access as the class modifier
has been changed from "public" to nothing. This has been done
as this class is now more for the internal workings of SWIG since the module
class has static type checking for all types.
*** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
Backwards compatibility can be achieved by using the %jniclassclassmodifier
pragma to change it back to "public".
07/28/2002: cheetah (William Fulton)
[Java] Proxy/Shadow classes are generated by default. The -proxy and
-shadow command line options are deprecated. If you want to use the
low-level functional interface then use the new -noproxy commandline option.
*** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
07/28/2002: cheetah (William Fulton)
[Java] Remaining pragmas shakeup. These were the remaining pragmas and their
new names where changed:
modulebase
modulecode
moduleclassmodifiers
moduleimport => moduleimports
moduleinterface => moduleinterfaces
The moduleimports works slightly differently to how the moduleimport pragma worked.
Now it actually takes code which gets placed before the class definition so the
whole import statement has to be given, for example:
%pragma(java) moduleimports=%{
import java.io.*;
import java.math.*;
%}
The moduleinterfaces is slightly different to the old moduleinterface in that if
more than one interface is required they must be comma separated in one use of
the pragma, for example:
%pragma(java) moduleinterfaces="Serializable, MyInterface"
These last two pragmas are consistent with the javainterfaces and javaimports
typemap.
A similar set of pragmas has been introduced, namely:
jniclassbase
jniclasscode
jniclassclassmodifiers
jniclassimport
jniclassinterface
These work in the same way as their module counterparts. Note that previously
the moduleXXX pragmas worked on the old module class which is now called the
JNI class (the class with the native functions). The jniclassXXX pragmas now
work on the new module class (the class that has all the global functions and
global variable getters and setters when using proxy classes, plus all other
remaining functions when using the low-level procedural interface).
In summary the contents of the pragmas make up a class like this:
<jniclassimports>
<jniclassmodifiers> class modulename extends <jniclassbase> implements <jniclassinterfaces> {
<jniclasscode>
... SWIG generated functions ...
}
}
*** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
07/28/2002: cheetah (William Fulton)
[Java] Deprecated modulemethodmodifiers pragma and replaced with
a better %feature based directive called %javamethodmodifiers.
A useful example would be for synchronisation in multi-threaded apps:
%javamethodmodifiers foo(int a) "public synchronized";
Changes this function from the default ("public") to "public synchronized".
*** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
07/26/2002: beazley
Several directives now allow optional configuration parameters.
These include:
%module(name="value", name="value", ...) modulename
%import(name="value", ...) "filename.i"
%extend(name="value", ...) classname {
...
}
These currently have no effect and are reserved for
future expansion.
07/26/2002: beazley
Enhancements to smart-pointer handling. SWIG only provides
extra support for a smart-pointer if operator->() returns
a proper pointer. For example:
Foo *operator->();
If operator->() returns an object by value or reference,
then SWIG examines the returned object to see if it also
implements operator->(). If so, SWIG chases operator->()
until it can find one that returns a pointer. This allows
cases like this to work:
class Foo {
public:
void blah();
};
class Bar {
...
Foo *operator->();
...
};
class Spam {
...
Bar operator->();
...
};
For example:
>>> s = Spam()
>>> s.blah() # Invokes Foo::blah()
The s.blah() call actually invokes:
((s.operator->()).operator->())->blah();
07/26/2002: beazley
Fixed a bug with typedef and references. For example:
typedef Foo & FooRef;
FooRef blah();
Previous versions of SWIG generated code that wouldn't
compile.
07/25/2002: beazley
Wrapping of static methods has been improved in proxy classes. In older
versions of SWIG, if you had this:
class Foo {
public:
static void bar();
};
The static method was only available as a function Foo_bar(). For example:
>>> Foo_bar()
Now, the static method can also be invoked through an instance like this:
>>> f = Foo()
>>> f.bar() # Invokes static method
This works with all versions of Python. Additionally, for Python-2.2,
the static method can be invoked as:
>>> Foo.bar()
The old-style function is still support for backwards compatibility. If
you care about making your code across different versions of Python,
either use Foo_bar() or access the method through an instance.
07/25/2002: beazley
Changes to the Python module. Proxy classes now utilize new Python-2.2
features including properties and static methods. However, these features
are supported in a way that provides backwards compatibility with older
Python versions. In other words, proxy classes work with all versions
of Python and only use new features when running on Python-2.2.
07/25/2002: beazley
Modified %extend so that overloaded methods can be added. For example:
%extend Foo {
void bar(int x) { };
void bar(char *s) { };
...
}
This works with both C++ *and* C.
07/24/2002: cheetah (William Fulton)
[Java] More new typemaps so that the Java proxy classes and type wrapper classes
can be further tailored by users. These are the default code for generating the
finalize() methods (proxy classes only) and the getCPtr() methods for proxy
classes and type wrapper classes:
%typemap(javafinalize) SWIGTYPE %{
protected void finalize() {
_delete();
}
%}
%typemap(javagetcptr) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] %{
public static long getCPtr($javaclassname obj) {
return obj.swigCPtr;
}
%}
The javagetcptr typemap will enable users to handle Java null by overriding
this typemap - a requested feature.
The -nofinalize commandline option has been deprecated. The javafinalize
typemap is more powerful as it will allow the removal of the finalize methods
for all or any one or more particular proxy class.
07/23/2002: cheetah (William Fulton)
[Java] The getCPtrXXX() function has been changed to a static function and
is now of the form:
protected static long getCPtr(XXX obj) {...}
This is a requested change which will allow Java null pointers to be used as null
can be passed in for obj. However, to achieve this the appropriate code must be
written using the new javagetcptr typemap directive.
*** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
Backwards compatibility can be achieved by adding this function back in using the
new javacode typemap:
%typemap(javacode) SWIGTYPE %{
// SWIG-1.3.12 and SWIG-1.3.13
public long getCPtr$javaclassname() {
return swigCPtr;
}
// SWIG-1.3.11 and earlier
public long getCPtr() {
return swigCPtr;
}
%}
07/23/2002: cheetah (William Fulton)
[Java] New directive to control constant code generation - %javaconst.
The default handling for handling constants is to get the value through
a JNI call, eg
#define YELLOW 5
#define BIG 1234LL
results in:
public final static int YELLOW = modulename.get_YELLOW();
public final static long BIG = modulename.get_BIG();
Earlier versions of the Java module initialised the value using the C value:
public final static int YELLOW = 5;
public final static long BIG = 1234LL;
This works in most cases, but the value for BIG won't compile as 1234LL is not
valid Java code and this is one of the reasons why the default is now to get the
values through a JNI call. The side effect is that these 'constants' cannot be used
in switch statements. The %javaconst directive allows one to specify the
way the constant value is initialised and works like other %feature
directives, eg
%javaconst(0); // all constants from this point on are initialised using the C value
%javaconst(1) BIG; // just BIG initialised using JNI call (must be parsed before BIG is defined)
07/23/2002: beazley
*** IMPORTANT CHANGES TO THE PYTHON MODULE ***
(1) The Python module now enables shadow/proxy classes by default.
This means that two files are always created by SWIG. For
instance, if you have this:
// file: foo.i
%module foo
...
Then swig generates two files "foo_wrap.c" and "foo.py".
(2) The name of the low-level C extension module has been changed
to start with a leading underscore. This means that you have
to compile the module as follows:
$ cc -c -I/usr/local/include/python2.2 foo_wrap.c
$ cc -shared foo_wrap.o $(OBJS) -o _foo.so
^^^^
note extra underscore
This naming scheme is consistent with other Python modules that
utilize extension code. For instance, the socket module consists
of "_socket.so" and "socket.py". In previous versions of SWIG,
the shared object file was named "foocmodule.so".
(3) A new directive can be used to insert Python code into
the corresponding .py file. For example:
%pythoncode %{
def foo():
print "Hello World"
%}
This directive allows you to create modules as a mix of C and Python.
Python code is seamlessly added to the module.
(4) The -shadow command line option is deprecated. This is turned on
by default.
(5) To disable the generation of the extra python file, use the "-noproxy"
command line option.
*** POTENTIAL INCOMPATIBILITY ***
This change will likely break the build environment of projects that
utilize shadow classes. To fix this, you probably only need to
change the name of the target .so file. For example, if you have
Makefile information like this:
TARGET = examplecmodule.so
Just change it to:
TARGET = _example.so
*** DOCUMENTATION UPDATE ***
The file Doc/Manual/Python.html has been updated to describe these changes.
07/23/2002: beazley
Added -noextern option. If supplied, SWIG will not generate
extra extern declarations. This is sometimes an issue on
non-unix platforms.
07/23/2002: beazley
Added a warning for ignored friend functions.
07/23/2002: beazley
Fixed [ 574498 ] -proxy and %include "pointer.i" clash.
Reported by David Creasy.
07/23/2002: beazley
Fixed [ 576103 ] global destruction warning with shadow.
Perl extensions should no longer report the warning
"Use of uninitialized value during global destruction."
when running with "perl -w". Reported by
Brett Williams.
07/23/2002: beazley
In C++ mode, SWIG now always defines namespace std. By default,
it's empty. However, this will silence errors from programs
that include statements such as "using namespace std;".
This fixes Bug [ 584017 ] using namespace std generates error.
Reported by Joseph Winston.
07/22/2002: beazley
Added a new warning message for %apply. If you use %apply but no typemaps
are defined, you will get a warning message. This should help with
problems like this:
%apply char *OUTPUT { ... };
In old versions of SWIG, this silently did nothing. Now you get an error like this:
file:line. Warning. Can't apply (char *OUTPUT). No typemaps are defined.
07/22/2002: cheetah (William Fulton)
[Java] Started Java pragma deprecation. Replacements use %typemap based
directives and enable proxy classes and the new type wrapper classes to be
tailored in various ways. These are the new typemaps:
%typemap(javabase) - base (extends) for Java class
%typemap(javaclassmodifiers) - class modifiers for the Java class: default is "public"
%typemap(javacode) - java code is copied verbatim to the Java class
%typemap(javaimports) - import statements for Java class
%typemap(javainterfaces) - interfaces (extends) for Java class
And these are the %pragma directives being deprecated:
allshadowbase
allshadowclassmodifiers
allshadowcode
allshadowimport
allshadowinterface
shadowbase
shadowclassmodifiers
shadowcode
shadowimport
shadowinterface
Note that it is possible to target a particular proxy class:
%typemap(javaimports) Foo "import java.util.*"
or a particular type wrapper class:
%typemap(javaimports) double* "import java.math.*"
Note that $javaclassname in these typemaps are substituted with either the proxy
classname when using proxy classes or the SWIGTYPE class name.
07/18/2002: cheetah (William Fulton)
[Java] Java module overhaul to implement static type checking of all
types.
1) Changes when using Java Proxy classes
----------------------------------------
Previously when wrapping global functions:
class SomeClass{};
void foo(SomeClass* s);
SomeClass* bar();
The native method prototypes used a long for pointers and looked like this:
public class modulename {
...
public final static native void foo(long jarg1);
public final static native long bar();
}
and unlike member functions of a C++ class there was no wrapper around the native calls
to make the use of them more user friendly. They would be used from Java like this:
SomeClass s = new SomeClass(modulename.bar(), false);
modulename.foo(s.getCPtrSomeClass());
Note that the following will have the same effect, but then it would not have
been possible to call any proxy member functions in SomeClass:
long s = modulename.bar();
modulename.foo(s);
Now wrapper functions are generated:
public class modulename {
public static void foo(SomeClass s) {
// calls the native function
}
public static SomeClass bar() {
// calls the native function
}
}
Which means these functions can now be used more naturally with proxy classes:
SomeClass s = modulename.bar();
modulename.foo(s);
2) Changes when not using Java Proxy classes
--------------------------------------------
The so called low-level interface was rather low-level indeed. The
new static type checking implementation makes it less so but it remains a
functional interface to the C/C++ world. Proxy classes are the obvious way to use
SWIG generated code, but for those who want a functional interface all non-primitive
types now have a simple Java class wrapper around the C/C++ type. Pointers and
references to primitive types are also wrapped by type wrapper classes. The type
wrapper classnames are based on the SWIG descriptors used by the other language
modules. For example:
C/C++ type Java type wrapper class name
---------- ----------------------------
int* SWIGTYPE_p_int
double** SWIGTYPE_p_p_double
SomeClass* SWIGTYPE_p_SomeClass
SomeClass& SWIGTYPE_p_SomeClass
SomeClass SWIGTYPE_p_SomeClass
Note that everything wrapped by SWIG is accessed via a pointer even when wrapping
functions that pass by value or reference. So the previous example would now be
used like this:
SWIGTYPE_p_SomeClass s = example.bar();
example.foo(s);
Note that typedefs that SWIG knows about are resolved, so that if one has
class Foo{};
typedef Foo Bar;
then any use of Bar will require one to use SWIGTYPE_p_Foo;
Some considerations:
Make sure you make a firm decision to use either proxy classes or the functional
interface early on as the classnames are different.
3) Pointers and non-parsed types
--------------------------------
Sometimes SWIG cannot generate a proxy class. This occurs when the definition of
a type is not parsed by SWIG, but is then used as a variable or a parameter.
For example,
void foo(Snazzy sds);
If SWIG has not parsed Snazzy it handles it simply as a pointer to a Snazzy.
The Java module gives it a type wrapper class around the pointer and calls it
SWIGTYPE_p_Snazzy. In other words it handles it in the same manner as types are
handled in the low-level functional interface. This approach is used for all
non-proxy classes, eg all pointer to pointers and pointers to primitive types.
4) Backwards compatibility
-----------------------
Backwards compatibility is not an issue if you have been using proxy classes and
no global variables/functions. Otherwise some changes will have to be made.
The native methods still exist but they are now in a JNI class, which is called
modulenameJNI. As this class is really part of the internal workings,
it should not be required so the class has become protected. Some pragmas/directives
will hopefully be added to help with backwards compatibility.
*** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
07/18/2002: beazley
Modified wrapping of uninstantiated templates returned by
value. Just to be safe, they are now wrapped by SwigValueWrapper<>
just in case they don't define a default constructor. This
would be used if you had code like this
Foo<int> blah();
void moreblah(Foo<int> x);
but you didn't instantiate Foo<int> using %template.
We should probably add a warning for this.
07/17/2002: beazley
Added an error check to detect shadowed template paramaters.
For example:
template<class T> class Foo {
public:
int T;
};
This results in an error, not a warning. This warning is
also needed to fix some rather insidious problems like
this:
struct T {
int blah;
};
template<class T> class Foo {
public:
typedef T Traits; // Which T is this????
};
In this case, the template parameter T shadows the outer
structure (which is what you want).
07/16/2002: beazley
Improved support for templates with integer arguments. SWIG is
much more aware of situations such as this:
const int Size = 100;
%template(Foo100) Foo<100>;
void bar(Foo<Size> *x); // Knows that Foo<Size> is the same as Foo<100>;
07/15/2002: beazley
Fixed bug with %feature/%ignore/%rename and namespaces.
For example:
%ignore Foo::Bar
namespace Foo {
class Bar {
...
};
}
Reported by Marcelo Matus.
07/09/2002: beazley
Added parsing support for constructors that try to catch
exceptions in initializers. For example:
class Foo {
Bar b;
public:
Foo(int x) try
: b(x) { ... }
catch(int) {
...
}
}
This has no effect on the generated wrappers. However, the try and catch
parts of the declaration are ignored. See Stroustrup, 3rd Ed, section
14.4.6.1 for details.
07/06/2002: beazley
Fixed bug in template symbol table management. This fixes
two bugs. First, mixing abstract methods, templates, and
inheritance no longer generates a failed assertion.
template <class T>
class A {
public:
virtual void foo() = 0;
};
template <class T>
class B : public A<T>
{
};
%template(A_int) A<int>;
%template(B_int) B<int>;
This fix also fixes a subtle problem with default values and
templates. For example:
template <class C>
struct B {
typedef unsigned int size_type;
static const size_type nindex = static_cast<size_type>(-1);
void foo(size_type index = nindex);
};
Bugs reported by Marcelo Matus.
07/05/2002: ljohnson (Lyle Johnson)
[Ruby] Changed the definition of the SWIG_ConvertPtr() function
for the SWIG/Ruby runtime support so that it looks like the
Python version. If the last argument (flags) is non-zero,
SWIG_ConvertPtr() will raise an exception for type mismatches
as before. If flags is zero, this function will return -1 for
type mismatches without raising an exception.
*** POTENTIAL INCOMPATIBILITY FOR RUBY MODULE ***
07/04/2002: beazley
Overloaded functions/methods/constructors now work in many language
modules. The support is completely transparent--just call the
function normally and SWIG will dispatch to the correct implementation.
There are a variety of issues associated with this. Please refer
to the overloading section of Doc/Manual/SWIGPlus.html for details.
*** NEW FEATURE ***
07/04/2002: beazley
Fixed a bug with namespaces, enums, and templates. For example:
namespace hello {
enum Hello { Hi, Hola };
template <Hello H>
struct traits
{
typedef double value_type;
};
traits<Hi>::value_type say_hi()
{
return traits<Hi>::value_type(1);
}
}
SWIG wasn't generating wrappers that properly qualified
traits<Hi>. Reported by Marcelo Matus.
06/30/2002: beazley
Supplied array variable typemaps for Tcl module. If you have a
variable like this:
int foo[10];
then a set function like this is generated:
void foo_set(int *x) {
memmove(foo,x,10*sizeof(int));
}
06/30/2002: beazley
New %fragment directive. When writing typemaps, it can be easy to
get carried away and write a lot of code. However, doing so causes
tremendous code bloat. A common way to solve this is to write
helper functions. For example:
%{
void some_helper_function() {
...
}
%}
%typemap(in) type {
some_helper_function(...);
}
The only problem with this is that the wrapper file gets polluted
with helper functions even if they aren't used. To fix this,
a new fragment directive is available. For example:
(corrected typo in line below - 06/26/2008)
%fragment("type_header","header") %{
void some_helper_function() {
...
}
%}
%typemap(in, fragment="type_header") type {
some_helper_function(...);
}
In this case, the code fragment is only emitted if the typemap is
actually used. A similar capability is provided for declaration
annotation and the %feature directive. For example:
%feature("fragment","type_header") SomeDeclaration;
The first argument to %fragment is the fragment name. The second argument
is the file section where the fragment should be emitted.
The primary use of this directive is for writers of language modules
and advanced users wanting to streamline typemap code.
*** EXPERIMENTAL NEW FEATURE ***
06/30/2002: beazley
Supplied memberin typemaps for all arrays in an attempt to eliminate
confusion about their use.
06/29/2002: beazley
Experimental support for smart-pointers. When a class defines
operator->() like this
class Foo {
...
Bar *operator->();
...
};
SWIG locates class Bar and tries to wrap its member variables and
methods as part of Foo. For example, if Bar was defined like this:
class Bar {
public:
int x;
int spam();
};
You could do this (in the target language):
f = Foo()
f.x = 4 # Accesses Bar::x
f.spam() # Accesses Bar::spam
The primary use of this feature is to emulate the behavior of C++
smart-pointers---which allow attributes to accessed transparently
through operator->.
This feature is supported automatically in SWIG---no special directives
are needed. To disable this behavior. Use %ignore to ignore
operator->.
*** NEW FEATURE ***
06/26/2002: beazley
Deprecated the %except directive. %exception should be used instead.
06/25/2002: beazley
Major cleanup of the modules directory. Eliminated most
header files, consolidated module code into single files.
06/24/2002: beazley
Reworked the instantiation of language modules. All language
modules must now define a factory function similar to this:
extern "C" Language *
swig_python(void) {
return new PYTHON();
}
This function is then placed in a table and associated with
a command line option in swigmain.cxx.
This approach has a number of benefits. It decouples the
SWIG main program from having to know about the class
definitions for each module. Also, by using a factory
function, it will be easier to implement dynamic loading
of modules (simply load the file and invoke the factory
function).
06/24/2002: beazley
Fixed syntax error for reference conversions. For example:
operator Foo &();
06/24/2002: beazley
Fixed syntax error for operator new[] and operator delete[].
06/24/2002: beazley
Fixed code generation problem for constants and default arguments
involving templates.
06/19/2002: ljohnson (Lyle Johnson)
[Ruby] Fixed a bug for the '-feature' command line argument;
that setting was effectively being ignored and so the feature
name was always set equal to the module name.
06/17/2002: beazley
Fixed problems with static members and enums in templates.
Version 1.3.13 (June 17, 2002)
==============================
06/16/2002: beazley
Fixed a bug with __FILE__ expansion in the preprocessor. On Windows,
the backslash (\) is now converted to (\\) in the string literal
used for __FILE__. Reported by Steve Glaser.
06/14/2002: beazley
Fixed warning message about 'name private in this context'. The
warning is only generated for public methods. Reported by
Scott Michel.
06/14/2002: beazley
Fixed some problems related to template instantiation
and namespaces. When SWIG expands a template, it does
so with fully resolved types. For example, if you have this:
template<class T> class foo { };
typedef double Double;
%template(foo_d) foo<Double>;
then, it is handled as foo<double> in the typesystem.
This fixes a number of subtle problems with inheritance
and templates.
06/14/2002: ljohnson (Lyle Johnson)
[Ruby] Added missing bool typemaps for INPUT, OUTPUT and
INOUT in Lib/ruby/typemaps.i.
05/29/2002: cheetah (William Fulton)
[Java] Fix for a couple of broken pragmas.
05/29/2002: cheetah (William Fulton)
Fix for unnecessary cast when wrapping global variable where
the type is not parsed by SWIG - Java variables example
failure as reported by Larry Virden.
06/10/2002: beazley
Modified %template to allow for empty instantiations.
%template() foo<int,int>;
This registers foo<int,int> with the type system, but
doesn't wrap it (same as %ignore). This may only be a
temporary measure. SWIG might be able to automatically
instantiate templates in certain cases.
06/10/2002: beazley
Fixed function prototype problems with Tcl 8.4
06/09/2002: beazley
Fixed problem with templates and location of base classes.
This one is a little mind-bending, but here is an example
that illustrates:
template <class ArgType, class ResType>
struct traits
{
typedef ArgType arg_type;
typedef ResType res_type;
};
template <class ArgType, class ResType>
struct Function
{
};
template <class AF, class AG>
struct Class : Function<typename traits<AF, AG>::arg_type,
typename traits<AF, AG>::res_type>
{
};
%template(traits_dd) traits <double, double>;
%template(Function_dd) Function <double, double>;
%template(Class_dd) Class <double, double>;
In this example, the base class of 'Class' is determined from
the Function template, but the types are obtained through typedefs.
Because of this, SWIG could not locate the wrapped base class
(Function<double,double>). Should be fixed in 1.3.13 even
though I can think of a million other things that might
also be broken.
06/07/2002: beazley
Fixed a problem with conversion operators. If you had an
operator like this,
operator double() const;
SWIG was ommitting the "const" qualifier. This affected
%rename and other directives. Reported by Zhong Ren.
06/07/2002: beazley
Lessened the strictness of abstract class checking. If
you have code like this:
class Foo {
public:
virtual int method() = 0;
};
class Bar : public Foo {
public:
Bar();
~Bar();
};
SWIG will go ahead and generate constructor/destructors
for Bar. However, it will also generate a warning message
that "Bar" might be abstract (since method() isn't defined).
In SWIG-1.3.12, SWIG refused to generate a constructor at all.
06/07/2002: beazley
Change to %template directive. If you specify something like this:
%template(vi) std::vector<int>;
It is *exactly* the same as this:
namespace std {
%template(vi) vector<int>;
}
SWIG-1.3.12 tried to instantiate the template outside of the namespace
using some trick. However, this was extremely problematic and full
holes. This version is safer.
06/07/2002: beazley
Fixed bug with scope qualification and templates. For example:
A<B::C>::DD
Before, this was separated as scopes A<B, C>, and DD. Fixed now.
06/06/2002: beazley
Allow the following syntax:
class A { };
struct B : A { ... };
A base class without a specifier is assumed to be public for a struct.
06/06/2002: beazley
Fixed syntax error with template constructor initializers.
Reported by Marcelo Matus.
06/06/2002: beazley
Fixed bug with default template arguments.
Reported by Marcelo Matus.
06/05/2002: beazley
Fixed subtle problems with %rename directive and template
expansion.
Code like this should now work:
%rename(blah) foo<double>::method;
...
template<class T> class foo {
public:
void method();
};
%template(whatever) foo<double>;
06/05/2002: beazley
Resolved some tricky issues of multi-pass compilation and
and inheritance. The following situation now generates
an error:
class Foo : public Bar {
...
};
class Bar {
...
};
The following code generates a warning about incomplete classes.
class Bar;
class Foo : public Bar { };
The following code generates a warning about an undefined class.
class Foo : public Bar { }; // Bar undefined
This fixes a failed assertion bug reported by Jason Stewart.
06/05/2002: ljohnson
[Ruby] Added a warning message for the Ruby module about the lack
of support for multiple inheritance. Only the first base class
listed is used and the others are ignored. (Reported by Craig
Files).
06/03/2002: beazley
Fixed a bug with struct declarations and typedef. For example:
typedef struct Foo Foo;
struct Foo {
...
};
A few other subtle struct related typing problems were
also resolved.
Version 1.3.12 (June 2, 2002)
=============================
05/30/2002: beazley
Fixed problem related to forward template class declarations and
namespaces. Bug reported by Marcelo Matus.
05/30/2002: beazley
Added 'make uninstall' target. Contributed by Joel Reed.
05/29/2002: beazley
Fixed rather insidious bug with %rename, %feature and template specialization.
For example:
%exception vector::__getitem__ {
... some exception ...
}
template<class T> class vector {
...
T __getitem__(int index); // Fine
...
};
template<> class vector<int> {
...
T __getitem__(int index); // Oops.
...
};
Now, the %exception directive (and other features) should correctly apply to
both vector and specializations.
05/29/2002: beazley
Subtle changes to %template() directive. Template arguments are now
reduced to primitive types in template matching. For example:
template<class T> class vector<T *> {
... partial specialization ...
}
typedef int *IntPtr; // Gross typedef
// Gets the above partial specialization
%template(vectorIntPtr) vector<IntPtr>;
This change is extremely subtle, but it fixes a number of potential
holes in Luigi's STL library modules. For example:
typedef int Integer;
%template(vectori) vector<int>;
05/29/2002: beazley
Fixed rather insidious typemap bug related to const. const
was being discarded through typedefs.
05/29/2002: ljohnson (Lyle Johnson)
[Ruby] Added input typemaps for const references to primitive
types (in Lib/ruby/ruby.swg).
05/29/2002: cheetah (William Fulton)
[Java] The java arrray support functions are enclosed by
a SWIG_NOARRAYS #define. Useful if not using arrays and
it is desirable to minimise the amount of compiled code.
05/29/2002: cheetah (William Fulton)
[Java] Enums were not renamed when using %name or %rename
fix.
05/28/2002: ljohnson
[Ruby] Modified the name of the wrapper functions for the
"new" singleton method and "initialize" instance method for
consistency with the other language modules. The wrapper name
for the function that implements "new" is alloc_classname and
the wrapper name for the function that implements "initialize"
is new_classname.
05/27/2002: beazley
Changes to runtime. Pointer conversion/creation functions
now almost always have an extra "flags" argument. For
example:
SWIG_ConvertPtr(obj, void **, swig_type_info *ty, int flags);
^^^^^^^^^^
This extra parameter is reserved for future expansion and will
be used for more control over pointers in future versions.
05/27/2002: beazley
Fix for C++ classes with private assignment operators. It
is now possible to safely return objects like this by value.
Caveat: the class must provide a copy constructor.
05/26/2002: beazley
-proxy option added to many language modules. This is the
same as -shadow. We are merely changing terminology.
05/26/2002: beazley
[perl] Fixed some inconsistencies in the -package option.
-package merely sets the package name to be used on the
wrappers. It does not change the name of the shared library
file or the name of the generated .pm file. This was
broken at some point, but works again now.
05/25/2002: beazley
[perl] Fixed [ 475452 ] memory leak in return-by-value.
Problem related to static member variables returning newly
allocated objects. Reported by Roy Lecates.
05/25/2002: beazley
[perl] Fixed [ 513134 ] %BLESSEDMEMBERS isn't always right.
Reported by Fleur Diana Dragan.
05/25/2002: beazley
Fixed [ 540735 ] -importall and the -I option.
05/25/2002: beazley
[guile] Fixed [ 532723 ] Default arg for char* can SegV.
Error in guile module. Reported by Brett Williams.
05/25/2002: beazley
Subtle change to typemap application code. The "freearg"
typemap must exactly match up with the "in" or "ignore"
typemap. For example:
%typemap(in) (char *data, int len) { ... }
%typemap(freearg) char *data { ... }
void foo(char *data, int len);
In this case, the "in" typemap is applied, but the
freearg typemap is not. This is because the freearg
typemap doesn't match up with the input argument sequence.
05/25/2002: beazley
Fixed [ 548272 ] Default argument code missing braces.
Reported by Brett Williams.
05/25/2002: beazley
Fixed [ 547730 ] SwigValueWrapper needed for constructors.
Reported by William Fulton.
05/25/2002: beazley
Undefined identifiers now evaluate to 0 when evaluating
preprocessor expressions. For example:
#if !FOO
...
#endif
where FOO is undefined or set to some non-numeric value.
Fixes [ 540868 ] #if defined whatever - not parsed.
Reported by Adam Hupp.
05/24/2002: beazley
SWIG now ignores the C++ 'export' keyword.
05/23/2002: beazley
Some refinement of type-name mangling to account for pointers, arrays,
references, and other embedded type constructs.