1 SWIG (Simplified Wrapper and Interface Generator)
3 See CHANGES.current for current version.
5 Version 1.3.39 (21 March 2009)
6 ==============================
9 [Python] Fix the memory leak related to Python 3 unicode and C char* conversion,
10 which can be shown in the following example before this fix:
12 from li_cstring import *
19 This fix affected SWIG_AsCharPtrAndSize() so you cannot call this function with
20 a null alloc and non-null cptr argument in Python 3, otherwise a runtime error
24 [C#] std::vector<T> wrapper improvements for .NET 2 and also providing the
25 necessary machinery to use the std::vector<T> wrappers with more advanced features such
26 as LINQ - the C# proxy class now derives from IEnumerable<>. The default is now to
27 generate code requiring .NET 2 as a minimum, although the C# code can be compiled
28 for .NET 1 by defining the SWIG_DOTNET_1 C# preprocessor constant. See the
29 std_vector.i file for more details.
31 *** POTENTIAL INCOMPATIBILITY ***
34 [Ruby] Fix #2676738 SWIG generated symbol name clashes.
37 [Python] Some fixes for Python 3.0.1 and higher support. In 3.0.1, the C API function
38 PyObject_Compare is removed, so PyObject_RichCompareBool is used for replacement.
39 Struct initilization of SwigPyObject and SwigPyObject_as_number changed to reflect
40 the drop of tp_compare and nb_long.
43 [Python] Fix SF#2583160. Now the importer in Python shadow wrapper take care of the
44 case that module already imported at other place.
47 [Python] Fix SF#2637352. Move struct declaration of SWIG_module in pyinit.swg before
48 the method calls, since some C compiler don't allow declaration in middle of function
52 [Allegrocl] Fix seg fault wrapping some constant variable (%constant) types.
55 [CFFI] Fix seg faults when for %extend and using statements.
58 Fix SF #2605955: -co option which broke in 1.3.37.
61 New %insert("begin") section added. Also can be used as %begin. This is a new
62 code section reserved entirely for users and the code within the section is generated
63 at the top of the C/C++ wrapper file and so provides a means to put custom code
64 into the wrapper file before anything else that SWIG generates.
67 'make clean-test-suite' will now run clean on ALL languages. Previously it only
68 ran the correctly configured languages. This way it is now possible to clean up
69 properly after running 'make partialcheck-test-suite'.
72 Extend attribute library support for structs/classes and the accessor functions use
73 pass/return by value semantics. Two new macros are available and usage is identical
74 to %attribute. These are %attributeval for structs/classes and %attributestring for
75 string classes, like std::string. See attribute.swg for more details.
78 Add support for %extend and memberin typemaps. Previously the memberin typemaps were
79 ignored for member variables within a %extend block.
82 Remove unnecessary temporary variable when wrapping return values that are references.
83 Example of generated code for wrapping:
86 std::string& refReturn();
91 std::string *result = 0 ;
94 std::string &_result_ref = (arg1)->refReturn();
95 result = (std::string *) &_result_ref;
100 std::string *result = 0 ;
102 result = (std::string *) &(arg1)->refReturn();
105 Change the SIZE mapped by %pybuffer_mutable_binary and %pybuffer_binary in pybuffer.i from
106 the length of the buffer to the number of items in the buffer.
109 Fix %feature not working for conversion operators, reported by Matt Sprague, for example:
110 %feature("cs:methodmodifiers") operator bool "protected";
113 [MzScheme] Apply #2081967 configure changes for examples to build with recent PLT versions.
114 Also fixes Makefile errors building SWIG executable when mzscheme package is installed
115 (version 3.72 approx and later).
118 [Perl] Fix SF#2564192 reported by David Kolovratnk.
119 SWIG_AsCharPtrAndSize() now handles "get" magic.
121 Version 1.3.38 (31 January 2009)
122 ================================
125 [Python] Fix SF#2552488 reported by Gaetan Lehmann. Now %pythonprepend
126 and %pythonappend have correct indentation.
129 [Python] Fix SF#2552048 reported by Gaetan Lehmann. The parameter list
130 of static member function in generated proxy code should not have the
134 Fix regression introduced in 1.3.37 where the default output directory
135 for target language specific files (in the absence of -outdir) was no
136 longer the same directory as the generated c/c++ file.
139 [Java, C#] Fix proxy class not being used when the global scope operator
140 was used for parameters passed by value. Reported by David Piepgrass.
143 [Perl] Fix seg fault when running with -v option, reported by John Ky.
145 Version 1.3.37 (13 January 2009)
146 ================================
149 [Lua] Added contract support for requiring that unsigned numbers are >=0
150 Rewrote much of Examples/Lua/embed3.
151 Added a lot to the Lua documentation.
154 Fix compilation error when using directors on protected virtual overloaded
155 methods reported by Sam Hendley.
158 [R] Fixed handling of integer arrays
161 [R] Fix integer handling in r to deal correctly with signed
165 Patch #1992756 from Colin McDonald - %contract not working for classes
169 Mark SWIGPERL5, SWIGPHP5, and SWIGTCL8 as deprecated in the source
170 code and remove documentation of them.
173 Bug #2430756. All the languages now define a macro in the generated C/C++
174 wrapper file indicating which language is being wrapped. The macro name is the
175 same as those defined when SWIG is run, eg SWIGJAVA, SWIGOCTAVE, SWIGCSHARP etc
176 and are listed in the "Conditional Compilation" section in the documentation.
179 [Java] Fix #2153773 - %nojavaexception was clearing the exception feature
180 instead of disabling it. Clearing checked Java exceptions also didn't work.
181 The new %clearjavaexception can be used for clearing the exception feature.
184 Fix #2432801 - Make SwigValueWrapper exception safe for when copy constructors
188 Apply patch #2440046 which fixes possible seg faults for member and global
189 variable char arrays when the strings are larger than the string array size.
192 The ccache compiler cache has been adapted to work with SWIG and
193 named ccache-swig. It now works with C/C++ compilers as well as SWIG
194 and can result in impressive speedups when used to recompile unchanged
195 code with either a C/C++ compiler or SWIG. Documentation is in CCache.html
196 or the installed ccache-swig man page.
199 Apply patch from Kalyanov Dmitry which fixes parsing of nested structs
203 Fix error message in some nested struct and %inline parsing error situations
204 such as unterminated strings and comments.
207 [PHP] Fix warnings when compiling generated wrapper with GCC 4.3.
210 [PHP] Deprecate %pragma(php4). Please use %pragma(php) instead.
211 The following two warnings have been renamed:
212 WARN_PHP4_MULTIPLE_INHERITANCE -> WARN_PHP_MULTIPLE_INHERITANCE
213 WARN_PHP4_UNKNOWN_PRAGMA -> WARN_PHP_UNKNOWN_PRAGMA
215 *** POTENTIAL INCOMPATIBILITY ***
218 [Python] Applied patch SF#2158938: all the SWIG symbol names started with Py
219 are changed, since they are inappropriate and discouraged in Python
220 documentation (from http://www.python.org/doc/2.5.2/api/includes.html):
222 "All user visible names defined by Python.h (except those defined by
223 the included standard headers) have one of the prefixes "Py" or "_Py".
224 Names beginning with "_Py" are for internal use by the Python implementation
225 and should not be used by extension writers. Structure member names do
226 not have a reserved prefix.
228 Important: user code should never define names that begin with "Py" or "_Py".
229 This confuses the reader, and jeopardizes the portability of the user
230 code to future Python versions, which may define additional names beginning
231 with one of these prefixes."
233 Here is a brief list of what changed:
236 PyObject_ptr -> SwigPtr_PyObject
237 PyObject_var -> SwigVar_PyObject
238 PySequence_Base, PySequence_Cont, PySequence_Ref ->
239 SwigPySequence_Base, SwigPySequence_Cont, SwigPySequence_Ref
242 We provided a pyname_compat.i for backward compatibility. Users whose code having
243 these symbols and do not want to change it could simply include this file
244 at front of your code. A better solution is to run the converting tool on
245 your code, which has been put in SWIG's SVN trunk (Tools/pyname_patch.py) and
246 you can download it here:
247 https://swig.svn.sourceforge.net/svnroot/swig/trunk/Tools/pyname_patch.py
249 *** POTENTIAL INCOMPATIBILITY ***
252 [Python] Apply patch #2143727 from Serge Monkewitz to fix importing base classes
253 when the package option is specified in %module and that module is %import'ed.
256 [UTL] Fix #2080497. Some incorrect acceptance of types in the STL, eg a double * element
257 passed into a vector<int *> constructor would be accepted, but the ensuing behaviour
258 was undefined. Now the type conversion correctly raises an exception.
261 Add -outcurrentdir option. This sets the default output directory to the current
262 directory instead of the path specified by the input file. This option enables
263 behaviour similar to c/c++ compilers. Note that this controls the output directory,
264 but only in the absence of the -o and/or -outdir options.
267 [ruby] Apply patch #2263850 to fix ruby/file.i ... rubyio.h filename change in
271 Apply patch #2319790 from Johan Hake to fix shared_ptr usage in std::tr1 namespace.
274 The use of the include path to find the input file is now deprecated.
275 This makes the behaviour of SWIG the same as C/C++ compilers in preparation
279 Fix -nopreprocess option to:
280 - correctly report file names in warning and error messages.
281 - use the original input filename that created the preprocessed output when
282 determining the C++ wrapper file name (in the absence of -o). Previously
283 the name of the input file containing the preprocessed output was used.
286 [Java] Add patch #2152691 from MATSUURA Takanori which fixes compiles using the
290 Add patch #2128249 from Anatoly Techtonik which corrects the C/C++ proxy
291 class being reported for Python docstrings when %rename is used.
294 Add the strip encoder patch from Anatoly Techtonik #2130016. This enables an
295 easy way to rename symbols by stripping a commonly used prefix in all the
296 function/struct names. It works in the same way as the other encoders, such as
297 title, lower, command etc outlined in CHANGES file dated 12/30/2005. Example
298 below will rename wxAnotherWidget to AnotherWidget and wxDoSomething to
301 %rename("%(strip:[wx])s") "";
303 struct wxAnotherWidget {
304 void wxDoSomething();
309 Lots of test-suite work.
310 - Fix ordering of wrapper output and %{ %} header output.
311 - Fix declarations of local vars in C wrappers.
312 - Fix declaration of defined constants in C wrappers.
313 - Fix declaration of EnumValues in C wrappers.
314 - add some const typemaps to allegrocl.swg
315 - add rename for operator bool() overloads.
318 [PHP5] Fill in typemaps for SWIGTYPE and void * (SF#2095186).
320 2008-09-22: mutandiz (Mikel Bancroft)
322 - Support wrapping of types whose definitions are not seen by
323 SWIG. They are treated as forward-referenced classes and if a
324 definition is not seen are treated as (* :void).
325 - Don't wrap the contents of unnamed namespaces.
326 - More code cleanup. Removed some extraneous warnings.
327 - start work on having the allegrocl mod pass the cpp test-suite.
330 [PHP5] Add typemaps for long long and unsigned long long.
333 [C#] Added C# array typemaps provided by Antti Karanta.
334 The arrays provide a way to use MarshalAs(UnmanagedType.LPArray)
335 and pinning the array using 'fixed'. See arrays_csharp.i library file
339 Document the optional module attribute in the %import directive,
340 see Modules.html. Add a warning for Python wrappers when the
341 module name for an imported base class is missing, requiring the
342 module attribute to be added to %import, eg
344 %import(module="FooModule") foo.h
347 [PHP5] Change the default input typemap for char * to turn PHP
348 Null into C NULL (previously it was converted to an empty string).
349 The new behaviour is consistent with how the corresponding output
350 typemap works (SF#2025719).
352 If you want to keep the old behaviour, add the following typemap
353 to your interface file (PHP's convert_to_string_ex() function does
354 the converting from PHP Null to an empty string):
356 %typemap(in) char * {
357 convert_to_string_ex($input);
358 $1 = Z_STRVAL_PP($input);
362 [PHP5] Fix extra code added to proxy class constructors in the case
363 where the only constructor takes no arguments.
366 [PHP5] Fix wrapping of a renamed enumerated value of an enum class
369 2008-09-17: mutandiz (Mikel Bancroft)
371 - Fix how forward reference typedefs are handled, so as not to conflict
372 with other legit typedefs.
373 - Don't (for now) perform an ffitype typemap lookup when trying to
374 when calling compose_foreign_type(). This is actually a useful thing
375 to do in certain cases, the test cases for which I can't currently
376 locate :/. It's breaking some wrapping behavior that is more commonly
377 seen, however. I'll readd in a more appropriate way when I can
378 recreate the needed test case, or a user complains (which means
379 they probably have a test case).
380 - document the -isolate command-line arg in the 'swig -help' output.
381 It was in the html docs, but not there.
382 - small amount of code cleanup, removed some unused code.
383 - some minor aesthetic changes.
386 [Python] Python 3.0 support branch merged into SWIG trunk. Thanks to
387 Google Summer of Code 2008 for supporting this project! By default
388 SWIG will generate interface files compatible with both Python 2.x
389 and 3.0. And there's also some Python 3 new features that can be
390 enabled by passing a "-py3" command line option to SWIG. These
393 - Function annotation support
394 Also, the parameter list of proxy function will be generated,
395 even without the "-py3" option. However, the parameter list
396 will fallback to *args if the function (or method) is overloaded.
397 - Buffer interface support
398 - Abstract base class support
400 For details of Python 3 support and these features, please see the
401 "Python 3 Support" section in the "SWIG and Python" chapter of the SWIG
404 The "-apply" command line option and support of generating codes
405 using apply() is removed. Since this is only required by very old
408 This merge also patched SWIG's parser to solve a bug. By this patch,
409 SWIG features able to be correctly applied on C++ conversion operator,
412 %feature("shadow") *::operator bool %{ ... %}
415 [Python] Commit patch #2089149: Director exception handling mangles
416 returned exception. Exceptions raised by Python code in directors
417 are now passed through to the caller without change. Also, remove
418 the ": " prefix which used to be added to other director exceptions
419 (eg, those due to incorrect return types).
422 [Python] Commit patch #1988296 GCItem multiple module linking issue when using
426 [C#] Support for 'using' and 'fixed' blocks in the 'csin' typemap is now
427 possible through the use of the pre attribute and the new terminator attribute, eg
430 pre=" using (CDate temp$csinput = new CDate($csinput)) {",
431 terminator=" } // terminate temp$csinput using block",
433 "$csclassname.getCPtr(temp$csinput)"
435 See CSharp.html for more info.
438 [CFFI] Commit patch #2079381 submitted by Boris Smilga - constant exprs put into
439 no-eval context in DEFCENUM
442 [Chicken,Allegro] Commit Patch 2019314
443 Fixes a build error in chicken, and several build errors and other errors
447 Fix building of Tcl examples/test-suite on Mac OSX reported by Gideon Simpson.
450 Fix SF #2019156 Configuring with --without-octave or --without-alllang
451 did not disable octave.
454 [Java, C#] Fix director typemaps for pointers so that NULL pointers are correctly
455 marshalled to C#/Java null in director methods.
458 [PHP] For std_vector.i and std_map.i, rename empty() to is_empty()
459 since "empty" is a PHP reserved word. Based on patch from Mark Klein
463 [PHP] The deprecated command line option "-make" has been removed.
464 Searches on Google codesearch suggest that nobody is using it now
468 [PHP] The SWIG cdata.i library module is now supported.
471 [PHP] The deprecated command line option "-phpfull" has been
472 removed. We recommend building your extension as a dynamically
476 [PHP4] Support for PHP4 has been removed. The PHP developers are
477 no longer making new PHP4 releases, and won't even be providing
478 patches for critical security issues after 2008-08-08.
481 [Python] Import the C extension differently for Python 2.6 and
482 later so that an implicit relative import doesn't produce a
483 deprecation warning for 2.6 and a failure for 2.7 and later.
484 Patch from Richard Boulton in SF#2008229, plus follow-up patches
485 from Richard and Haoyu Bai.
487 Version 1.3.36 (24 June 2008)
488 =============================
491 Remove deprecated -c commandline option (runtime library generation).
494 [PHP] Fix assertion failure when handling %typemap(in,numinputs=0)
495 (testcase ignore_parameter).
498 [PHP] Fix segfault when wrapping a non-class function marked with
499 %newobject (testcase char_strings).
502 [Java] Add a way to use AttachCurrentThreadAsDaemon instead of AttachCurrentThread
503 in director code. Define the SWIG_JAVA_ATTACH_CURRENT_THREAD_AS_DAEMON macro, see
504 Lib/java/director.swg.
507 [Ruby] Fix crashing in the STL wrappers (reject! and delete_if methods)
510 [Java, C#] C# and Java keywords will be renamed instead of just issuing a warning
511 and then generating uncompileable code. Warning 314 gives the new name when a
515 [R] Keyword handling added. R Keywords will be renamed as necessary.
516 Warning 314 gives the new name when a keyword is found.
519 [Lua] Added missing support for bool& and bool*. Added runtest for li_typemaps testcase.
523 Added test case keyword_rename, then made the keyword renaming works properly
524 by fixing Swig_name_make() for a incomplete condition checking.
527 [Java, C#] Fix enum wrappers when using -noproxy.
530 Added std::wstring into Lib/typemaps/primtypes.swg, since it is also a primitive
531 type in SWIG - fixed SF #1976978.
534 [Java, C#] Fix variable wrappers when using -noproxy.
537 [Python] Fixed a typo of %#ifdef in Lib/python/pycontainer.swg, which is related
538 to -extranative SWIG option - SF #1971977.
541 New partialcheck makefile targets for partial testing of the test-suite. These
542 just invoke SWIG, ie no compilation and no runtime testing. It can be faster
543 when developing by just doing a directory diff of the files SWIG generates
544 against those from a previous run. Example usage from the top level directory:
546 make partialcheck-test-suite
547 make partialcheck-java-test-suite
549 This change also encompasses more flexibility in running the test-suite, eg
550 it is possible to prefix the command line which runs any target language test
551 with a tool. See the RUNTOOL, COMPILETOOL and SWIGTOOL targets in the common.mk
552 file and makefiles in the test-suite directory. For example it is possible to
553 run the runtime tests through valgrind using:
555 make check RUNTOOL="valgrind --leak-check=full"
557 or invoke SWIG under valgrind using:
559 make check SWIGTOOL="valgrind --tool=memcheck"
562 [R] Fixed define that was breaking pre-2.7. Checked in
563 patch from Soren Sonnenburg that creates strings in
564 version independent way
567 [Java] Fix variable name clash in directors - SF #1963316 reported by Tristan.
570 Add an optimisation for functions that return objects by value, reducing
571 the number of copies of the object that are made. Implemented using an
572 optional attribute in the "out" typemap called "optimal". Details in
576 [PHP] Check for %feature("notabstract") when generating PHP5 class
580 Fix SF #1943608 - $self substitution in %contract, patch submitted by
584 [PHP] Fix char * typemaps to work when applied to signed char * and
585 unsigned char * (uncovered by testcase apply_strings).
588 Fix wrapping of char * member variables when using allprotected mode.
589 Bug reported by Warren Wang.
592 [PHP] Fix bad PHP code generated when wrapping an enum in a
593 namespace (uncovered by testcase arrays_scope).
596 [PHP] SWIG now runs the PHP testsuite using PHP5, not PHP4. PHP4
597 is essentially obsolete now, so we care much more about solid PHP5
601 STL fixes when using %import rather than %include and the Solaris Workshop
602 compiler and the Roguewave STL.
605 Fix wrapping of overloaded protected methods when using allprotected mode.
606 Bug reported by Warren Wang.
609 Commit patch #1956607 to add -MT support from Richard Boulton.
610 This patch mirrors the gcc -MT option which allows one to change the default
611 Makefile target being generated when generating makefiles with the -M family
612 of options. For example:
614 $ swig -java -MM -MT overiddenname -c++ example.i
620 [Lua] Removed generation of _wrap_delete_XXXXX (wrappered destructor)
621 which was unused and causing warning with g++ -Wall.
622 Removed other unused warning in typemaps.i and other places.
623 Added Examples/lua/embed3, and run tests a few test cases.
626 [Python] Fix generated code for IBM's C++ compiler on AIX (patch
627 from Goeran Uddeborg in SF#1928048).
630 Rename BSIZE in Examples/test-suite/arrays_scope.i to BBSIZE to
631 avoid a clash with BSIZE defined by headers on AIX with Perl
632 (reported in SF#1928048).
635 Add the ability to wrap all protected members when using directors.
636 Previously only the virtual methods were available to the target language.
637 Now all protected members, (static and non-static variables, non-virtual methods
638 and static methods) are wrapped when using the allprotected mode. The allprotected
639 mode is turned on in the module declaration:
641 %module(directors="1", allprotected="1") modulename
643 Version 1.3.35 (7 April 2008)
644 =============================
647 [Lua] Add missing pointer reference typemaps
650 Fix stack overflow when using typemap warning suppression, eg
651 %warnfilter(SWIGWARN_TYPEMAP_CHARLEAK_MSG)
654 [Python] Fix shared_ptr typemaps so that %pythonnondynamic can be used. Also corrects
655 display of the proxy class type. Reported by Robert Lupton.
658 [Python] Add %newobject reference to python memory management subsection of manual
659 (patch from mdbeachy in SF#1894610).
662 [Python] Fix shared_ptr typemaps where the pointer type is a templated type with
663 with more than one parameter. Reported by Robert Lupton.
666 [Lua] Added a typemap DISOWN for SWIGTYPE* and SWIGTYPE[], and support for %delobject feature.
667 Added Examples/lua/owner which demonstrates the use of the memory management.
670 [Java] Apply patch #1844301 from Monty Taylor to suppress enum constructor
674 [Python] Apply patch #1924524 from Casey Raymondson which ensures the
675 "No constructor defined" message is displayed when attempting to call a
676 constructor on a class that doesn't have a constructor wrapper, eg if
677 the C++ class is abstract.
680 [Python] Apply patch #1925702 from Casey Raymondson which removes warning 512
681 for std::vector wrappers.
684 [Python] Apply GCC 4.3 warnings patch from Philipp Thomas
688 [Python] Thread safety patch for STL iterators from Abhinandan Jain.
691 [Lua] Added %luacode feature to add source code into wrappers.
692 Updated documentation to document this.
693 Added Examples/lua/arrays to show its use (and typemaps)
696 Fix nonportable sed usage which failed on Mac OS X (and probably
697 other platforms). Fixes SF#1903612.
700 Fix memory leak in SWIG's parser (based on patch from Russell
701 Bryant in SF#1914023).`
704 Fix bug #1878285 - unnecessary cast for C struct creation wrappers.
707 [Python] Remove debugging info when using shared_ptr support
710 [Lua] Updated documentation for Lua exceptions.
711 Added Examples/lua/exception and Examples/lua/embed2.
712 Small updates to the typemaps.
715 [Java, C#] Add char *& typemaps.
718 Fix occasional seg fault when attempting to report overloaded methods as being ignored.
721 [Perl] Fix #1904537 Swig causes a Perl warning "x used only once" in Perl 5.10
722 reported by Ari Jolma
725 [Python] Add shared_ptr varin/varout typemaps for wrapping global variables.
728 Fix $wrapname to work in %exception (fixes some wrap:name assertions)
730 Version 1.3.34 (27 February 2008)
731 =================================
734 [R] Fix wrapping of global function pointer variables.
737 Add new special variables for use within %exception:
738 $wrapname - language specific wrapper name
739 $overname - if a method is overloaded this contains the extra mangling used on
740 the overloaded method
741 $decl - the fully qualified C/C++ declaration of the method being wrapped
742 without the return type
743 $fulldecl - the fully qualified C/C++ declaration of the method being wrapped
744 including the return type
747 [R] Now setting S4 flag in SWIG created objects. This
748 fixes R-SWIG for 2.6 and warning for 2.6 failure has been removed.
751 [Lua] Added a patch by Torsten Landschoff to fix the unary minus issue
752 Ran 'astyle --style=kr -2' across lua.cxx to neaten it up
755 Bump SWIG_RUNTIME_VERSION to 4. This is because of the recently introduced API
756 change in the conversion functions, ie change in definition of swig_converter_func.
757 Anyone calling SWIG_TypeCast must pass in a valid value for the new additional
758 (third) parameter and then handle the newly created memory if the returned value
759 is set to SWIG_CAST_NEW_MEMORY else a memory leak will ensue.
762 [Python] Experimental shared_ptr typemaps added. Usage is the same as the recently
763 added Java and C# shared_ptr typemaps. Two macros are available, although these
764 may well change in a future version:
766 For base classes or classes not in an inheritance chain:
767 SWIG_SHARED_PTR(PROXYCLASS, TYPE)
769 SWIG_SHARED_PTR_DERIVED(PROXYCLASS, BASECLASSTYPE, TYPE)
771 The PROXYCLASS is the name of the proxy class, but is only required for Java/C#.
774 %include "boost_shared_ptr.i"
776 SWIG_SHARED_PTR(Klass, Space::Klass)
777 SWIG_SHARED_PTR_DERIVED(KlassDerived, Space::Klass, Space::KlassDerived)
780 struct Klass { ... };
781 struct KlassDerived : Klass { ... };
784 Further details to follow in future documentation, but the following features
787 - Not restricted to boost::shared_ptr, eg std::tr1::shared_ptr can also be used.
788 - Available typemap groups:
789 (a) Typemaps for shared_ptr passed by value, reference, pointer and pointer
791 - (b) Typemaps for passing by raw value, raw pointer, raw reference, raw pointer
793 - The code being wrapped does not even have to use shared_ptr, SWIG can use
794 shared_ptr as the underlying storage mechanism instead of a raw pointer due to
795 the typemaps in group (b) above.
796 - No array support as shared_ptr does not support arrays.
797 - This works quite differently to the usual SWIG smart pointer support when
798 operator-> is parsed by SWIG:
799 - An additional smart pointer class is not generated reducing code bloat in
801 - Using smart pointers and raw pointers can be mixed seamlessly.
802 - Missing constructors for the smart pointers is no longer a problem and so
803 separate factory type functions do not have to be written and wrapped.
804 - The implicit C++ shared_ptr< derived class > to shared_ptr< base class >
805 cast also works in the target language. This negates the necessity to write
806 an explicit helper cast function providing the upcast which would need
807 calling prior to passing a derived class to a method taking a shared_ptr to
811 [Python] Add support for overriding the class registration function via a new
812 "smartptr" feature. This is a very low level of customisation most users
813 would never need to know. The feature will typically be used for intrusive
814 smart pointers along with additional typemaps. Example usage of the feature:
816 %feature("smartptr", noblock=1) Foo { boost::shared_ptr< Foo > }
819 The generated Foo_swigregister function will then register boost::shared < Foo >
820 (SWIGTYPE_p_boost__shared_ptrTFoo_t instead of SWIGTYPE_p_Foo) as the underlying
821 type for instantiations of Foo.
824 Features now supports the optional 'noblock' attribute for all usage of %feature.
825 When specified, the { } braces are removed from the feature code. This is identical
826 in behaviour to usage of 'noblock' in typemaps and is used when the preprocessor
827 is required to operate on the code in the feature and the enclosing { } braces
828 are not required. Example:
831 %feature("smartptr", noblock="1") { FOO::bar }
833 The preprocessor then reduces this as if this had been used instead:
835 %feature("smartptr") "foo::bar"
838 [Python] Fix format string bug (SF#1882220).
841 Additions to the %types directive. Now the conversion / casting code can be
842 overridden to some custom code in the %types directive, like so:
844 %types(fromtype = totype) %{
845 ... code to convert fromtype to totype and return ...
848 The special variable $from will be replaced by the name of the parameter of the
849 type being converted from. The code must return the totype cast to void *. Example:
853 Date &Time::dateFromTime();
855 %types(Time = Date) %{
856 Time *t = (Time *)$from;
857 Date &d = t->dateFromTime();
861 resulting in the conversion / casting code looking something like:
863 static void *_p_TimeTo_p_Date(void *x) {
865 Date &d = t->dateFromTime();
869 This is advanced usage, please use only if you understand the runtime type system.
872 Small update to documentation in Typemaps.html, to warn about use of local
873 variables in typemaps for multiple types.
876 [Java] Fix bug reported by Kevin Mills in ARRAYSOFCLASSES typemaps where any
877 changes made to an array element passed from Java to C are not reflected back
881 More updates to the configure script for detecting lua.
882 Also looks in /usr/include/lua*
883 Also changed typemaps.i not to check for NULL before freeing a pointer
886 [Python] For STL containers, SWIG no longer attempts to convert from one
887 STL container to another, eg from std::vector<int> to std::vector<double>
888 or std::list<int> to std::vector<int> or even std::vector<Foo> to
889 std::vector<Bar> as it previously did. In fact SWIG no longer attempts to
890 convert any SWIG wrapped C++ proxy class that is also a Python sequence,
891 whereas previously it would. Any non-SWIG Python sequence will still be
892 accepted wherever an STL container is accepted. Overloaded methods using
893 containers should be faster.
896 [C#] Add 'directorinattributes' and 'directoroutattributes' typemap attributes
897 for the imtype typemap. These should contain C# attributes which will
898 be generated into the C# director delegate methods.
901 Fix handling of byte value 255 in input files on platforms where
902 char is signed (it was getting mapped to EOF). Fixes SF#1518219.
905 Fix template member variables wrapped by a smart pointer. Bug reported
909 Substantial changes to configure script for detecting lua.
910 Code can now link to liblua.a, liblua50.a or liblua51.a
911 It's also a lot neater now.
914 [Perl] Backed out #1798728 - numbers can be passed to functions taking char *
917 Fix #1832613 - Templates and some typedefs involving pointers or function pointers
920 [Java] Fix #1632625 - Compilation errors on Visual C++ 6 when using directors.
923 [Perl] Fix #1798728 - numbers can be passed to functions taking char *.
926 Fix #1819847 %template with just one default template parameter
928 template<typename T = int> class Foo {...};
929 %template(FooDefault) Foo<>;
932 [Lua] Small correction on Lua.html
935 Apply patch #1838248 from Monty Taylor for vpath builds of SWIG.
938 [Lua] Fixes to remove gcc-4.2 warnings
941 Fix #1734415 - template template parameters with default arguments such as:
943 template<typename t_item, template<typename> class t_alloc = pfc::alloc_fast >
944 class list_t : public list_impl_t<t_item,pfc::array_t<t_item,t_alloc> > { ... };
947 [lua] Fix a bug in the class hierachy code, where the methods were not propagated,
948 if the name ordering was in a certain order.
949 Added new example programs (dual, embed) and runtime tests for test-suite.
952 Fix using statements using a base class method where the methods were overloaded.
953 Depending on the order of the using statements and method declarations, these
954 were previously generating uncompileable wrappers, eg:
956 struct Derived : Base {
961 Version 1.3.33 (November 23, 2007)
962 ==================================
965 [allegrocl] omit private slot type info in the classes/types
966 defined on the lisp side. Fix bug in mapping of C/++ types
967 to lisp types. Fix typo in modules generated defpackage form.
968 Have std::string *'s automatically marshalled between foreign
972 [Python] Fill in Python Dictionary functions list (patch from
973 Jelmer Vernooij posted to swig-devel).
976 Fixed a bug in the C scanner related to backslash characters.
979 [Perl] Fix broken compilation of C++ wrappers on some compilers.
982 [Python] Don't pass Py_ssize_t for a %d printf-like format as
983 that's undefined behaviour when sizeof(Py_ssize_t) != sizeof(int).
985 Version 1.3.32 (November 15, 2007)
986 ==================================
989 [R] Package name and dll name is now the same as the SWIG module
990 name. It used to be the module name with _wrap as a suffix. The package
991 and dll names can be modified using the -package and -dll commandline
994 *** POTENTIAL INCOMPATIBILITY ***
997 [R] Add support for Windows (Visual C++ 8 tested)
1000 [php] Fix makefile generated by -make (SF#1633679). Update
1001 documentation to mark "-make" as deprecated (none of the other
1002 SWIG backends seem to offer such a feature, it can't realistically
1003 generate a fully portable makefile, and the commands to build an
1004 extension are easy enough to write for the user's preferred build
1005 tool). Also recommend against the use of "-phpfull" (it's only
1006 really useful when static linking, and a dynamically loadable
1007 module is virtually always the better approach).
1010 Fix --help output to note that `export SWIG_FEATURES' is required.
1012 10/29/2007: wsfulton
1013 [R] Fix seg fault on Windows
1014 [R] Examples R scripts are now platform independent
1016 10/30/2007: mgossage
1017 [lua] fixed bug in template classes which cases template_default2
1018 and template_specialization_defarg to fail.
1019 Added several warning filters into the overload's test cases.
1020 Added runtime tests for several codes.
1021 You can now make check-lua-test-suite with no errors and only a few warnings.
1024 [guile] Fix the configure test to put GUILELINK in LIBS not LDFLAGS
1028 [guile] Fix the guile examples on 64-bit platforms.
1030 10/29/2007: wsfulton
1031 [C#] Fix member pointers on 64 bit platforms.
1034 [lua] Fix swig_lua_class instances to be static to allow multiple
1035 SWIG wrappers to be compiled into the same executable statically.
1036 Patch from Andreas Fredriksson (posted to the swig mailing list).
1039 [lua] Fix Examples/lua to pass SRCS for C tests rather than CXXSRCS.
1040 The code as it was happened to work on x86, but broke on x86_64 (and
1041 probably any other platforms which require -fPIC).
1043 10/28/2007: wsfulton
1044 [Java, C#] New approach for fixing uninitialised variable usage on error in director
1045 methods using the new templated initialisation function SwigValueInit().
1047 10/28/2007: wsfulton
1048 [Perl] Use more efficient SvPV_nolen(x) instead of SvPV(x,PL_na) if SvPV_nolen is
1052 [Chicken] Fix global variables of class member function pointers.
1053 Other minor fixes, so all tests in the chicken test suite now pass
1056 Fix UTL typecheck macro for a function taking char[] or const
1057 char[] (SF#1820132).
1060 [Guile] Filter out -ansi -pedantic from CFLAGS while compiling test programs for Guile
1061 in configure. This enables running the test suite for Guile if it is installed and
1065 [Guile -scm] Fix testcases apply_signed_char and apply_strings
1066 by adding explicit casts to the appropriate $ltype.
1068 10/22/2007: wsfulton
1069 [Java, C#] Fix uninitialised variable usage on error in director methods.
1071 10/19/2007: wsfulton
1072 [Java, C#] Bug #1794247 - fix generated code for derived classes when csbase or javabase
1073 typemaps are used with the replace="1" attribute.
1075 10/19/2007: wsfulton
1076 [Python] Docs updated to suggest using distutils. Patch #1796681 from Christopher Barker.
1079 [perl5] Clear errno before calls to strtol(), strtoul(), strtoll()
1080 and strtoull() which we check errno after to avoid seeing a junk
1081 value of errno if there isn't an error in the call.
1083 10/16/2007: wsfulton
1084 Deprecate %attribute_ref and replace with %attributeref. There is just an argument
1085 order change in order to maintain consistency with %attribute, from:
1087 %attribute_ref(Class, AttributeType, AccessorMethod, AttributeName)
1089 %attributeref(Class, AttributeType, AttributeName, AccessorMethod)
1092 [Tcl] Fix several ocurrences of "warning: deprecated conversion
1093 from string constant to 'char*'" from GCC 4.2 in generated C/C++
1097 [PHP] Fix many occurrences of "warning: deprecated conversion from
1098 string constant to 'char*'" from GCC 4.2 in generated C/C++ code
1099 when compiling with a new enough version of PHP 5 (tested with
1100 PHP 5.2.3, but PHP 5.2.1 is probably the minimum requirement).
1102 10/15/2007: wsfulton
1103 Patch #1797133 from David Piepgrass fixes %attribute when the getter has the same name
1104 as the attribute name and no longer generate non-functional setter for read-only attributes.
1107 [Tcl] Prevent SWIG_Tcl_ConvertPtr from calling the unknown proc.
1108 Add Examples/tcl/std_vector/ which this change fixes. Patch
1109 is from "Cliff C" in SF#1809819.
1111 10/12/2007: wsfulton
1112 [Java] Add DetachCurrentThread back in for directors. See entry dated 08/11/2006 and
1113 search for DetachCurrentThread on the mailing lists for details. The crashes on Solaris
1114 seem to be only present in jdk-1.4.2 and lower (jdk-1.5.0 and jdk-1.6.0 are okay), so
1115 anyone using directors should use a recent jdk on Solaris, or define (see director.swg)
1116 SWIG_JAVA_NO_DETACH_CURRENT_THREAD to the C++ compiler to get old behaviour.
1118 10/12/2007: wsfulton
1119 [Java] Ensure the premature garbage collection prevention parameter (pgcpp) is generated
1120 when there are C comments in the jtype and jstype typemaps.
1123 Added a testsuite entry for Bug #1735931
1126 Automatically rerun autogen.sh if configure.in is modified.
1129 Enhance check-%-test-suite rule and friends to give a more helpful
1130 error message if you try them for a language which doesn't exist
1131 (e.g. "make check-php-test-suite" rather than the correct
1132 "make check-php4-test-suite").
1135 Add make rule to regenerate Makefile from Makefile.in if it has
1139 [php] Fix long-standing memory leak in wrapped constructors and
1140 wrapped functions/methods which return an object.
1143 Fix Makefile.in to read check.list files correctly in a VPATH
1146 10/07/2007: wsfulton
1147 [C#, Java] Experimental shared_ptr typemaps added
1149 09/27/2007: mgossage
1150 [lua] added more verbose error messages for incorrect typechecks.
1151 Added a routine which checks the exact number of parameters passed to a function
1152 (breaks operator_overloading for unary minus operator, currently disabled).
1153 Reorganised the luatypemaps.swg to tidy it up.
1154 Added a lot of %ignores on the operators not supported by lua.
1155 Added support for constant member function pointers & runtest for member_pointer.i
1156 Added first version of wchar.i
1158 09/25/2007: wsfulton
1159 [C#, Java] throws typemaps for std::wstring using C# patch #1799064 from David Piepgrass
1161 09/24/2007: wsfulton
1162 [Tcl] Apply #1771313 to fix bug #1650229 - fixes long long and unsigned long long
1166 [Java] Eliminate some unnecessary uses of a temporary buffer
1167 allocated using new[]. SF#1796609.
1169 09/19/2007: wsfulton
1170 [C#] The $csinput special variable can be used in the csvarin typemap where it is always
1171 expanded to 'value'.
1173 09/19/2007: wsfulton
1174 [C#] Fix bug reported by Glenn A Watson and #1795260 where the cstype typemap used the 'ref'
1175 keyword in the typemap body, it produced uncompilable C# properties (variable wrappers).
1176 The type for the property now correctly comes from the 'out' attribute in the cstype typemap.
1178 09/19/2007: wsfulton
1179 [Java] Fix const std::wstring& typemaps
1181 09/19/2007: wsfulton
1182 [Java] Ensure the premature garbage collection prevention parameter (pgcpp) is generated
1183 where a parameter is passed by pointer reference, eg in the std::vector wrappers. The pgcpp
1184 is also generated now when user's custom typemaps use a proxy class in the jstype typemap
1185 and a 'long' in the jtype typemap.
1188 [php] Add typemaps for handling parameters of type std::string &
1189 which are modified by the wrapped function.
1192 [python] Split potentially long string literals to avoid hitting
1193 MSVC's low fixed limit on string literal length - patch from
1194 SF#1723770, also reported as SF#1630855.
1197 [ocaml] Fix renaming of overloaded methods in the method_table -
1198 my patch from SF#940399.
1201 [python] Simpler code for SWIG_AsVal_bool() which fixes a "strict
1202 aliasing" warning from GCC - patch from SF#1724581 by Andrew
1206 [perl5] Use sv_setpvn() to set a scalar from a pointer and length
1207 - patch from SF#174460 by "matsubaray".
1210 When wrapping C++ code, generate code which uses
1211 std::string::assign(PTR, LEN) rather than assigning
1212 std::string(PTR, LEN). Using assign generates more efficient code
1213 (tested with GCC 4.1.2).
1215 09/07/2007: wsfulton
1216 Fix %ignore on constructors which are not explicitly declared [SF #1777712]
1218 09/05/2007: wuzzeb (John Lenz)
1219 - Change r_ltype in typesys.c to store a hashtable instead of a single value.
1220 several very subtle bugs were being caused by multiple ltypes being mapped
1221 to a single mangled type, mostly when using typedefed template parameters.
1222 Now, r_ltype stores a hashtable of possible ltypes, and when generating the
1223 type table, all the ltypes are added into the swig_type_info structure.
1225 08/31/2007: wsfulton
1226 SF #1754967 from James Bigler.
1227 - Fix bug in turning on warnings that were turned off by default. Eg 'swig -w+309' will now
1228 turn on the normally suppressed warning 309.
1230 - New -Wextra commandline option which enables the extra warning numbers:
1231 202,309,403,512,321,322 (this is the list of warnings that have always been suppressed by
1232 default). By specifying -Wextra, all warnings will be turned on, but unlike -Wall,
1233 warnings can still be selectively turned on/off using %warnfilter,
1234 #pragma SWIG nowarn or further -w commandline options, eg:
1236 will turn on all warnings except 309.
1238 08/28/2007: wsfulton
1239 - New debugging options, -debug-module <n> and -debug-top <n> to display the parse tree at
1240 various stages, where <n> is a comma separated list of stages 1-4.For example, to
1241 display top of parse tree at stages 1 and 3:
1244 - Deprecate the following options which have equivalents below:
1245 -dump_parse_module => -debug-module 1
1246 -dump_module => -debug-module 4
1247 -dump_parse_top => -debug-top 1
1248 -dump_top => -debug-top 4
1250 - Renamed some commandline options for naming consistency across all options:
1251 -debug_template => -debug-template
1252 -debug_typemap => -debug-typemap
1253 -dump_classes => -debug-classes
1254 -dump_tags => -debug-tags
1255 -dump_typedef => -debug-typedef
1256 -dump_memory => -debug-memory
1259 [PHP5] Fix handling of double or float parameters with an integer
1263 [PHP5] Generate __isset() methods for setters for PHP 5.1 and later.
1265 08/20/2007: wsfulton
1266 [Java C#] Fix director bug #1776651 reported by Stephane Routelous which occurred when
1267 the director class name is the same as the start of some other symbols used within
1270 08/17/2007: wsfulton
1271 Correct behaviour for templated methods used with %rename or %ignore and the empty
1272 template declaration - %template(). A warning is issued if the method has not been
1275 08/16/2007: mutandiz (Mikel Bancroft)
1276 [allegrocl] Name generated cl file based on input file rather than by
1277 module name. It was possible to end up with a mypackage.cl and a test_wrap.c
1278 when parsing a test.i input file. Confusing. Also, include external-format
1279 templates for :fat and :fat-le automatically to avoid these being compiled
1282 08/15/2007: efuzzyone
1283 [cffi] Apply patch #1766076 from Leigh Smith adding support for newly introduced
1284 in cffi :long-long and :unsigned-long-long.
1286 08/10/2007: wsfulton
1287 [Java] Add documentation patch #1743573 from Jeffrey Sorensen. It contains a neat
1288 idea with respect to better memory management by the JVM of C++ allocated memory.
1290 08/10/2007: wsfulton
1291 [Perl] Apply patch #1771410 from Wade Brainerd to fix typedef XS(SwigPerlWrapper) in
1292 perlrun.swg for ActiveState Perl build 822 and Perl 5.8.9 and 5.10 branches.
1294 08/10/2007: wsfulton
1295 [Lua] const enum reference typemaps fixed.
1297 08/09/2007: wsfulton
1298 [C#] Added missing support for C++ class member pointers.
1300 08/09/2007: wsfulton
1301 [C#, Java] Add support for $owner in the "out" typemaps like in the the scripting
1302 language modules. Note that $owner has always been supported in the "javaout" / "csout"
1305 08/01/2007: wsfulton
1306 Fix smart pointer handling for classes that have templated methods within the smart
1307 pointer type. Problem reported by craigdo at ee.washington.edu.
1309 07/31/2007: efuzzyone
1310 [cffi] fixed memory access after being freed bug. thanks to Martin Percossi.
1311 package name clos changed to cl. thanks to Ralf Mattes
1313 07/24/2007: wsfulton
1314 Parallel make support added for the examples and test-suite for developers who have
1315 more than one CPU. Now parallel make can be used for checking in addition to building
1316 the SWIG executable. Some typical checking examples:
1319 make -j4 check-java-test-suite
1320 make -j2 check-java-examples
1322 07/19/2007: mgossage
1323 Fixed bug that stopped configure working on mingw (applied dos2unix to configure.in)
1325 07/10/2007: mgossage
1326 [lua] Extra compatibility with Lua 5.1 (updated SWIG_init, docs, examples, test suite)
1327 Removed name clash for static link of multiple modules
1329 07/05/2007: mgossage
1330 [lua] Fix a bug in SWIG_ALLOC_ARRAY()
1331 improved the error messages for incorrect arguments.
1332 Changed the output of swig_type() to use the human readable form of the type,
1333 rather than the raw swig type.
1335 07/03/2007: wsfulton
1336 [C#] Fix directors for some overloaded methods where the imtype resulted in identical
1337 methods being generated in the C# director class, eg void foo(int *) and void foo(double *)
1338 used to generated two of these:
1340 private void SwigDirectorfoo(IntPtr p) { ... }
1342 06/25/2007: wsfulton
1343 [Java, C#] Some parameter name changes in std_vector.i allowing better targeting
1344 of typemaps for method parameters (for memory management of containers of pointers).
1346 06/07/2007: mutandiz (Mikel Bancroft)
1348 fix foreign-type constructor to properly look for ffitype typemap
1349 bindings. fix inout_typemaps.i for strings.
1353 Use whichever of "long" or "long long" is the same size as "void*"
1354 to hold pointers as integers, rather than whichever matches off_t.
1355 Fixes compilation on OS X and GCC warnings on platforms where
1356 sizeof(void*) < sizeof(off_t) (SF patch #1731979).
1360 Fix handling of a particular case involving overloaded functions
1361 with default parameters.
1363 06/05/2007: mutandiz (Mikel Bancroft)
1365 Fix case where we'd pass fully qualified identifiers
1366 (i.e. NS1::NS2::FOO) to swig-insert-id. All namespaces
1369 Fix bug in TypedefHandler introduced by last fix.
1372 Fix reporting of filenames in errors after %include (patch from
1373 Leigh Smith in #1731040; also reported as #1699940).
1377 Fix "missing initialiser" warning when compiling generated C/C++
1378 wrapper code with Python 2.5 with warnings enabled (patch from
1379 bug#1727668 from Luke Moore).
1383 Split docstrings into separate string literals at each newline when
1384 generating C/C++ wrapper code (the C/C++ compiler will just combine
1385 them back into a single string literal). This avoids MSVC
1386 complaining that the strings are too long (problem reported by
1387 Bo Peng on the mailing list).
1391 Escape backslashes in docstrings.
1395 Fix autodoc generation of enums to be more consistent with how the
1396 enums are wrapped - patch #1697226 from Josh Cherry.
1400 Fix wrapping of methods and functions which return a pointer to a
1401 class (bug#1700788) and those which have overloaded forms returning
1402 both classes and non-classes (bug#1712717, thanks to Simon
1403 Berthiaume for the patch).
1405 05/25/2007: wsfulton
1406 Fixed %rename inconsistency in conversion operators as reported by Zhong Ren. The matching
1407 is now done on the operator name in the same way as it is done for parameters. For example:
1409 %rename(opABC) Space::ABC::operator ABC() const;
1410 %rename(methodABC) Space::ABC::method(ABC a) const;
1414 void method(ABC a) const {}
1415 operator ABC() const { ABC a; return a; }
1419 Note that qualifying the conversion operator previously may or may not have matched.
1420 Now it definitely won't, so this will not match:
1422 %rename(opABC) Space::ABC::operator Space::ABC() const;
1424 in the same way that this does not match:
1426 %rename(methodABC) Space::ABC::method(Space::ABC a) const;
1428 The documentation has been improved with respect to %rename, namespaces and templates.
1429 Conversion operators documentation too.
1431 *** POTENTIAL INCOMPATIBILITY ***
1433 05/16/2007: mutandiz
1435 Fix bad generation of local var ltype's in functionWrapper().
1436 Try to work better with the backward order in which swig
1437 unrolls nested class definitions.
1438 cleaned up a little unnecessary code/debug printf's.
1439 Remove warning when replacing $ldestructor for ff:foreign-pointer
1443 swig -python -threads now generates C/C++ code which uses Python's
1444 own threading abstraction (from pythread.h) rather than OS specific
1445 code. The old code failed to compile on MS Windows. (See SF patch
1450 Changed STL renames to be global renames. This fixes
1451 STL functions not being renamed when autorename is on.
1452 This is a not a totally perfect work-around, but better.
1453 Someone really needs to fix the template renaming code.
1458 Changed %rename("%(undercase)s") a little so that single
1459 numbers at the end of a function are not undercased. That is:
1460 getSomething -> get_something
1464 asFloat2 -> as_float2
1469 Made __swigtype__ => @__swigtype__ so it can be accessed
1470 from the scripting language (and follows Ruby's official
1471 documentation, just in case).
1472 Made tracking => @__trackings__ for same reason.
1473 Currently storing ivars without the @ seems valid, but
1474 the PickAxe says this is not correct, so just in case...
1478 Applied patch for -minherit bug and exception classes.
1479 This issue should be revisited more closely, as Multiple
1480 Inheritance in Ruby is still problematic.
1481 (patch/bug #1604878)
1485 Overloaded functions in ruby will now report to the user
1486 the possible prototypes when the user mistypes the number or
1487 type of a parameter.
1491 Forgot to document the bug fixing of an old bug regarding
1497 Fixed Ruby documentation to use the proper css styles for
1498 each section. Added autodoc section to Ruby's docs to
1499 document the features supported by Ruby in documenting its modules.
1500 Made rdoc documentation spit out the full name of the class +
1501 method name. Albeit this will make the current rdoc not recognize
1502 the method, this is still needed to disambiguate between different
1503 classes with similar methods (rdoc was created to document the
1504 ruby source which only contains one class per c file, unlike swig)
1505 I have patched rdoc to make it more friendly to swig. This
1506 patch needs to be merged in the ruby std library now.
1510 Changed flag -feature to be -init_name to better reflect its
1511 purpose and avoid confusion with -features.
1515 Improved autodoc generation.
1516 Added autodoc .swg files to Ruby library for easily adding
1517 documentation to common Ruby methods and STL methods.
1518 Fixed autodoc documenting of getters and setters and module.
1519 Made test suite always generate autodocs.
1523 Removed some warnings from STL and test suite.
1525 05/02/2007: mgossage
1526 [Lua] Fixed issues with C++ classes and hierachies across multiple
1527 source files. Fixed imports test case & added run test.
1528 Added Examples/imports.
1529 Added typename for raw lua_State*
1530 Added documentation on native functions.
1534 Docstrings are now supported.
1535 %feature("autodoc") and %feature("docstring") are now
1536 properly supported in Ruby. These features will generate
1537 a _wrap.cxx file with rdoc comments in them.
1541 STL files have been upgraded to follow the new swig/python
1542 Lib/std conventions.
1543 This means std::vector, std::set, std::map, set::multimap,
1544 std::multiset, std::deque and std::string are now properly
1545 supported, including their iterators, support for containing
1546 ruby objects (swig::GC_VALUE) and several other ruby
1548 std::complex, std::ios, std::iostream, std::iostreambuf and
1549 std::sstream are now also supported.
1550 std::wstring, std::wios, std::wiostream, std::wiostreambuf
1551 and std::wsstream are supported verbatim with no unicode
1554 std_vector.i now mimics the behavior of Ruby Arrays much more
1555 closely, supporting slicing, shifting, unshifting,
1556 multiple indexing and proper return values on assignment.
1558 COMPATABILITY NOTE: this changes the older api a little bit in
1559 that improper indexing would previously (incorrectly) raise
1560 exceptions. Now, nil is returned instead, following ruby's
1561 standard Array behavior.
1565 Changed the value of SWIG_TYPECHECK_BOOL to be 10000 (ie. higher
1566 than that of all integers).
1567 This is because Ruby allows typecasting
1568 integers down to booleans which can make overloaded functions on
1569 bools and integers to fail.
1574 Fixed a subtle bug in multiple argouts that could get triggered if
1575 the user returned two or more arguments and the first one was an
1580 Improved the documentation to document the new features
1581 added, add directorin/out/argout typemaps, etc.
1585 Added %initstack and %ignorestack directives for director
1586 functions. These allow you to control whether a director
1587 function should re-init the Ruby stack.
1588 This is sometimes needed for an embedded Ruby where the
1589 director method is used as a C++ callback and not called
1590 by the user from ruby code.
1592 Ruby's GC needs to be aware of the running OS stack in order to
1593 mark any VALUE (Ruby objects) it finds there to avoid collection
1594 of them. This allows the ruby API to be very simple and allows
1595 you to write code like "VALUE a = sth" anywhere without needing
1596 to do things like refcounting like python.
1597 By default, the start of the stack is set when ruby_init() is
1598 called. If ruby is inited within main(), as it usually is the
1599 case with the main ruby executable, ruby will be able to calculate
1600 its stack properly. However, when this is not possible, as when
1601 ruby is embedded as a plugin to an application where main is not
1602 available, ruby_init() will be called in the wrong place, and
1603 ruby will be incorrectly tracking the stack from the function
1604 that called ruby_init() forwards only, which can lead to
1605 all sorts of weird crashes or to ruby thinking it has run out of
1606 stack space incorrectly.
1607 To avoid this, director (callback) functions can now be tagged
1608 to try to reset the ruby stack, which will solve the issues.
1609 NOTE: ruby1.8.6 still contains a bug in it in that its function
1610 to reset the stack will not always do so. This bug is triggered
1611 very rarely, when ruby is called from two very distinct places
1612 in memory, like a branch of main() and another dso. This bug
1613 has now been reported to ruby-core and is pending further
1615 (bug #1700535 and patch #1702907)
1617 04/30/2007: wsfulton
1618 Fix #1707582 - Restore building from read-only source directories.
1622 Ruby will now report the parameter index properly on type
1623 errors as well as the class and value of the incorrect
1625 (feature request #1699670)
1629 Ruby no longer creates the free_Class function if the class
1630 contains its own user defined free function (%freefunc).
1635 Made directors raise a ruby exception for incorrect argout
1636 returned values if RUBY_EMBEDDED is set, instead of throwing
1637 an actual SwigDirector exception.
1638 This will prevent crashes when ruby is embedded and unaware
1639 of the SwigDirector exception.
1643 Removed the need for -DSWIGEXTERN.
1644 Changed swig_ruby_trackings to be a static variable, but also
1645 be kept within a hidden instance variable in the SWIG module.
1646 This allows properly dealing with trackings across multiple
1647 DSOs, which was previously broken.
1648 (bug #1700535 and improvement to patch #1702907)
1651 [Ruby] Fixed GC memory issues with trackings that could lead
1652 to segfaults when dealing, mainly, with static variables.
1653 (bug #1700535 and patch #1702907)
1657 Fixed String conversion using old ruby1.6 macros. Now
1658 StringValuePtr() is used if available. This removes warnings
1659 when converting strings with \0 in them.
1660 (bug #1700535 and patch #1702907)
1664 Fixed the argout count in directors for Ruby. Previously,
1665 ignored or "numinputs=0" typemaps would incorrectly not get
1666 counted towards the argout count.
1667 (bug/patch #1545585)
1671 Upgraded Ruby converter to recognize "numinputs=0". Previously,
1672 only the old "ignore" flag was checked (which would currently
1673 still work properly, but is deprecated).
1676 [Ruby - but should be made generic]
1678 %feature("numoutputs","0") added.
1680 This feature allows you to ignore the output of a function so
1681 that it is not added to a list of output values
1683 This should also become a feature of %typemap(directorout)
1684 as "numoutputs"=0, just like "numinputs"=0 exists.
1686 %feature("directors"=1)
1688 %include <typemaps.i>
1690 %feature("numoutputs","0") { Class::member_function1 };
1691 %typemap(out) MStatus { // some code, like check mstatus
1692 // and raise exception if wrong };
1695 typedef int MStatus;
1698 // one argument returned, but director out code added
1699 // MStatus is discarded as a return (out) parameter.
1700 virtual MStatus member_function1( int& OUTPUT );
1702 // two arguments returned, director out code added
1703 // MStatus is not discarded
1704 virtual MStatus member_function2( int& OUTPUT );
1710 Fix parsing of float constants with an exponent (e.g. 1e-02f)
1714 [Python] Fix lack of generation of docstrings when -O is used.
1715 Also, fix generation of docstrings containing a double quote
1716 character. Patch from Richard Boulton in bug#1700146.
1718 04/17/2007: wsfulton
1719 [Java, C#] Support for adding in Java/C# code before and after the intermediary call,
1720 specifically related to the marshalling of the proxy type to the intermediary type.
1721 The javain/csin typemap now supports the 'pre' and 'post' attributes to achieve this.
1722 The javain typemap also supports an optional 'pgcppname' attribute for premature garbage
1723 collection prevention parameter naming and the csin typemap supports an optional 'cshin'
1724 attribute for the parameter type used in a constructor helper generated when the type is used
1725 in a constructor. Details in the Java.html and CSharp.html documentation.
1728 Don't treat `restrict' as a reserved identifier in C++ mode
1732 [PHP5] Fix how zend_throw_exception() is called (bug #1700785).
1735 Define SWIGTEMPLATEDISAMBIGUATOR to template for aCC (reported on
1736 swig-user that this is needed).
1739 [PHP5] If ZTS is enabled, release <module>_globals_id in MSHUTDOWN
1740 to avoid PHP interpreter crash on shutdown. This solution was
1741 suggested here: http://bugs.php.net/bug.php?id=40985
1744 [PHP4] Add missing ZTS annotations to generated C++ wrapper code
1745 to fix compilation failures when using ZTS enabled SWIG (Linux
1746 distributions tend to disable ZTS, but notably the Windows build
1747 uses it by default).
1749 04/01/2007: efuzzyone
1750 [CFFI] Patch #1684261: fixes handling of unsigned int literals, thanks Leigh Smith.
1751 Also, improved documentation.
1754 Avoid generating '<:' token when using SwigValueWrapper<> on a type
1755 which starts with '::' (patch #1690948).
1757 03/25/2007: wuzzeb (John Lenz)
1758 [perl5] Add SWIG_fail to the SWIG_exception macro. Fixes a few problems reported
1759 on the mailing list.
1761 03/23/2007: wsfulton
1762 String copying patch from Josh Cherry reducing memory consumption by about 25%.
1764 03/21/2007: wsfulton
1765 [Java] Apply patch #1631987 from Ulrik Peterson - bool INOUT typemaps
1766 fail on big endian machines.
1768 03/16/2007: wsfulton
1769 Fix seg fault given dodgy C++ code: namespace abc::def { }
1771 03/16/2007: wsfulton
1772 [Java] Fixes so that ARRAYSOFCLASSES and ARRAYSOFENUMS in arrays_java.i can be applied
1776 [PHP5] When we know the literal numeric value for a constant, use
1777 that to initialise the const member in the PHP wrapper class.
1780 [PHP5] Fix PHP wrapper code generated for certain cases of
1781 overloaded forms with default arguments.
1783 02/26/2007: efuzzyone
1784 [CFFI] Patch #1656395: fixed hex and octal values bug, thanks to Arthur Smyles.
1786 02/22/2007: mgossage
1787 [Lua] Fixed bug in typemaps which caused derived_byvalue and rname test cases to fail.
1788 Updated derived_byvalue.i to explain how to find and fix the problem
1790 01/25/2007: wsfulton
1791 Fix #1538522 and #1338527, forward templated class declarations without a
1792 name for the templated class parameters, such as:
1794 template <typename, class> class X;
1796 01/23/2007: mgossage
1797 [Lua] Patch #1640862: <malloc.h> replaced by <stdlib.h>
1798 Patch #1598063 Typo in typemaps.i
1800 01/22/2007: mgossage
1801 [Lua] Added a lua specific carrays.i which adds the operator[] support.
1802 modified the main code to make it not emit all the class member functions & accessors
1803 Note: C structs are created using new_XXX() while C++ classes use XXX() (should be standardised)
1804 Updated test case: li_carrays
1805 Updated the documentation.
1807 01/12/2007: wsfulton
1808 [Php] Add support for newfree typemaps (sometimes used by %newobject)
1811 New command line option -macroerrors. When supplied, this will force
1812 the C scanner/parser to report proper location information for code contained
1813 inside SWIG macros (defined with %define). By default, SWIG merely reports
1814 errors on the line at which a macro is used. With this option, you
1815 can expand the error back to its source---something which may simplify
1819 [Internals] Major overhaul of C/C++ scanning implementation. For quite
1820 some time, SWIG contained two completely independent C/C++ tokenizers--
1821 the legacy scanner in CParse/cscanner.c and a general purpose scanner
1822 in Swig/scanner.c. SWIG still has two scanning modules, but the C parser
1823 scanner (CParse/cscanner.c) now relies upon the general purpose
1824 scanner found in Swig/scanner.c. As a result, it is much smaller and
1825 less complicated. This change also makes it possible to maintain all
1826 of the low-level C tokenizing in one central location instead of two
1829 ***POTENTIAL FLAKINESS***
1830 This change may cause problems with accurate line number reporting
1831 as well as error reporting more generally. I have tried to resolve this
1832 as much as possible, but there might be some corner cases.
1834 01/12/2007: mgossage
1835 [Lua] Added typemap throws for std::string*, typemap for SWIGTYPE DYNAMIC,
1836 changed the existing throws typemap to throw a string instead of making a copy of
1837 the object (updating a few test cases to deal with the change).
1838 fixed test case: dynamic_casts, exception_partial_info, li_std_string, size_t
1841 [Internals]. Use of swigkeys.c/.h variables is revoked. Please use
1842 simple strings for attribute names.
1845 Internal API functions HashGetAttr() and HashCheckAttr() have been revoked.
1846 Please use Getattr() to retrieve attributes. The function Checkattr() can
1847 be used to check attributes. Note: These functions have been revoked
1848 because they only added a marginal performance improvement at the expense
1851 12/26/2006: mgossage
1852 [Lua] Added more STL (more exceptions, map, size_t),
1853 fixed test case: conversion_ns_template.
1855 12/21/2006: mgossage
1856 [Lua] Update to throw errors when setting immutables,
1857 and allowing user addition of module variables.
1859 12/20/2006: wsfulton
1860 Fix typedef'd variable wrappers that use %naturalvar, eg, std::string.
1862 12/14/2006: wsfulton
1863 [C#] Add std::wstring and wchar_t typemaps
1866 [php] Fix bug #1613673 (bad PHP5 code generated for getters and
1869 12/02/2006: wsfulton, John Lenz, Dave Beazley
1870 Move from cvs to Subversion for source control
1873 Cleaned up swigwarnings.swg file not to use nested macro
1876 11/12/2006: wsfulton
1877 [Java, C#] Fix for %extend to work for static member variables.
1879 Version 1.3.31 (November 20, 2006)
1880 ==================================
1882 11/12/2006: Luigi Ballabio
1883 [Python] Alternate fix for Python exceptions bug #1578346 (the previous one broke Python
1884 properties in modern classes)
1886 11/12/2006: wsfulton
1887 -fakeversion commandline option now generates the fake version into the generated wrappers
1888 as well as displaying it when the -version commandline option is used.
1890 14/11/2006: mgossage
1891 [lua] update to typemap for object by value, to make it c89 compliant
1893 Version 1.3.30 (November 13, 2006)
1894 ==================================
1896 11/12/2006: wsfulton
1897 [java] Remove DetachCurrentThread patch from 08/11/2006 - it causes segfaults
1900 11/12/2006: wsfulton
1901 [python] Fix #1578346 - Python exceptions with -modern
1903 11/10/2006: wsfulton
1904 Fix #1593291 - Smart pointers and inheriting from templates
1906 11/09/2006: wsfulton
1907 Fix director operator pointer/reference casts - #1592173.
1909 11/07/2006: wsfulton
1910 Add $self special variable for %extend methods. Please use this instead of just 'self'
1911 as the C++ 'this' pointer.
1913 11/07/2006: mutandiz
1915 allegrocl.swg: swig-defvar updated to allow specifying of
1916 non-default foreign type (via :ftype keyword arg).
1917 allegrocl.cxx: Specify proper access type for enum values.
1919 11/03/2006: wsfulton
1920 [Java/C#] Fix const std::string& return types for directors as reported by
1923 10/29/2006: wsfulton
1924 [Java] Remove DeleteLocalRef from end of director methods for now as it is causing a
1925 seg fault when run on Solaris 8.
1927 10/29/2006: wuzzeb (John Lenz)
1928 [Guile] Patch from Chris Shoemaker to clean up some warnings in the generated code.
1930 10/29/2006: wsfulton
1931 [Java] Important fix to prevent early garbage collection of the Java proxy class
1932 while it is being used in a native method. The finalizer could destroy the underlying
1933 C++ object while it was being used. The problem occurs when the proxy class is no
1934 longer strongly reachable after a native call. The problem seems to occur in
1935 memory stress situations on some JVMs. It does not seem to occur on the
1936 Sun client JVM up to jdk 1.5. However the 1.6 client jdk has a more aggressive garbage
1937 collector and so the problem does occur. It does occur on the Sun server
1938 JVMs (certainly 1.4 onwards). The fix entails passing the proxy class into the native
1939 method in addition to the C++ pointer in the long parameter, as Java classes are not
1940 collected when they are passed into JNI methods. The extra parameter can be suppressed
1941 by setting the nopgcpp attribute in the jtype typemap to "1" or using the new -nopgcpp
1944 See Java.html#java_pgcpp for further details on this topic.
1946 10/24/2006: wsfulton
1947 [C#] Fix smart pointer wrappers. The virtual/override/new keyword is not generated
1948 for each method as the smart pointer class does not mirror the underlying pointer
1949 class inheritance hierarchy. SF #1496535
1951 10/24/2006: mgossage
1952 [lua] added support for native methods & member function pointers.
1953 fixed test cases arrays_dimensionless & cpp_basic. Added new example (functor).
1954 tidied up a little of the code (around classHandler).
1956 10/17/2006: wsfulton
1957 [C#, Java] directorout typemap changes to fall in line with the other director
1958 languages. $result is now used where $1 used to be used. Please change your typemaps
1959 if you have a custom directorout typemap.
1961 10/18/2006: wsfulton
1962 Some fixes for applying the char array typemaps to unsigned char arrays.
1964 10/17/2006: wsfulton
1965 [C#, Java] Add in const size_t& and const std::size_t& typemaps.
1967 10/15/2006: efuzzyone
1968 [CFFI] Suppress generating defctype for enums, thanks to Arthur Smyles. Patch 1560983.
1970 10/14/2006: wuzzeb (John Lenz)
1971 [Chicken] Minor fix to make SWIG work with the (as yet unreleased) chicken 2.5
1973 [Guile,Chicken] Fix SF Bug 1573892. Added an ext_test to the test suite to test
1974 this bug, but this test can not really be made generic because the external code must
1975 plug into the target language interpreter directly.
1976 See Examples/test-suite/chicken/ext_test.i and ext_test_external.cxx
1978 Added a %.externaltest to common.mk, and any interested language modules can
1979 copy and slightly modify either the chicken or the guile ext_test.i
1981 10/14/2006: mgossage
1982 [Lua] added OUTPUT& for all number types, added a long long type
1983 fixed several test cases.
1984 update: changed typemaps to use SWIG_ConvertPtr rather than SWIG_MustGetPointer
1985 started spliting lua.swg into smaller parts to make it neater
1987 10/13/2006: wsfulton
1988 [C#, Java] Marginally better support for multiple inheritance only in that you can
1989 control what the base class is. This is done using the new 'replace' attribute in the
1990 javabase/csbase typemap, eg in the following, 'Me' will be the base class,
1991 no matter what Foo is really derived from in the C++ layer.
1993 %typemap(javabase, replace="1") Foo "Me";
1994 %typemap(csbase, replace="1") Foo "Me";
1996 Previously it was not possible for the javabase/csbase typemaps to override the C++ base.
1998 10/12/2006: wsfulton
1999 [Java] Remove potential race condition on the proxy class' delete() method
2000 (it is now a synchronized method, but is now customisable by changing the
2001 methodmodifiers attribute in the the javadestruct or javadestruct_derived typemap)
2003 [C#] Remove potential race condition on the proxy class' Dispose() method,
2004 similar to Java's delete() above.
2006 *** POTENTIAL INCOMPATIBILITY ***
2008 10/12/2006: wsfulton
2009 [Ruby, Python] Remove redundant director code in %extend methods (%extend
2010 methods cannot be director methods)
2012 10/12/2006: wsfulton
2013 [Ruby, Python] Fix #1505594 - director objects not returned as director objects
2016 10/11/2006: wsfulton
2017 [Java] Fix #1238798 - Directors using unsigned long long or any other type
2018 marshalled across the JNI boundary using a Java class (where the jni typemap
2021 10/06/2006: wsfulton
2022 Fix #1162194 - #include/%include within a structure
2024 10/06/2006: wsfulton
2025 Fix #1450661, string truncation in String_seek truncating Java/C# enums.
2027 10/06/2006: mgossage
2028 [Lua] Fix #1569587. The name is now correct.
2030 10/04/2006: wsfulton
2031 Director fixes for virtual conversion operators
2034 [php] Fix #1569587 for PHP. Don't use sizeof() except with string
2035 literals. Change some "//" comments to "/* */" for portability.
2037 10/04/2006: mgossage
2038 [Lua] Partial Fix #1569587. The type is now correct, but the name is still not correct.
2040 10/03/2006: wsfulton
2041 [Ruby] Fix #1527885 - Overloaded director virtual methods sometimes produced
2042 uncompileable code when used with the director:except feature.
2044 10/03/2006: wsfulton
2045 Directors: Directors are output in the order in which they are declared in
2046 the C++ class rather than in some pseudo-random order.
2049 Fix #1486281 and #1471039.
2052 [Perl] Fix for handling strings with zero bytes from Stephen Hutsal.
2054 09/30/2006: efuzzyone
2055 [CFFI] Bitfield support and vararg support due to Arthur Smyles.
2056 C expression to Lisp conversion, thanks to Arthur Smyles for the initial
2057 idea, it now supports conversion for a whole range of C expressions.
2059 09/28/2006: wsfulton
2060 Fix #1508327 - Overloaded methods are hidden when using -fvirtual optimisation.
2061 Overloaded methods are no longer candidates for elimination - this mimics
2062 C++ behaviour where all overloaded methods must be defined and implemented
2063 in a derived class in order for them to be available.
2065 09/25/2006: wsfulton
2066 [Ruby, Python, Ocaml] Fix #1505591 Throwing exceptions in extended directors
2068 09/25/2006: wsfulton
2069 Fix #1056100 - virtual operators.
2072 Don't accidentally create a "<:" token (which is the same as "[" in C++).
2073 Fixes bug # 1521788.
2076 [Ruby] Support building with recent versions of the Ruby 1.9
2077 development branch. Fixes bug #1560092.
2080 Templates can now be instantiated using negative numbers and
2081 constant expressions, e.g.:
2083 template<int q> class x {};
2084 %template(x_minus1) x<-1>;
2085 %template(x_1plus2) x<1+2>;
2087 Also, constant expressions can now include comparisons (>, <, >=,
2088 <=, !=, ==), modulus (%), and ternary conditionals (a ? b : c).
2090 Fixes bugs #646275, #925555, #956282, #994301.
2092 09/22/2006: wsfulton
2093 Fix %ignore on director methods - Bugs #1546254, #1543533
2095 09/20/2006: wsfulton
2096 Fix %ignore on director constructors
2098 09/20/2006: wsfulton
2099 Fix seg faults and asserts when director methods are ignored (#1543533)
2101 09/20/2006: wsfulton
2102 Fix out of source builds - bug #1544718
2105 Treat a nested class definition as a forward declaration rather
2106 than ignoring it completely, so that we generate correct code for
2107 passing opaque pointers to the nested class (fixes SF bug #909387).
2110 *** POTENTIAL INCOMPATIBILITY ***
2111 [php] Overload resolution now works. However to allow this, SWIG
2112 generated wrappers no longer coerce PHP types (which reverts a change
2113 made in 1.3.26). So for example, if a method takes a string, you
2114 can no longer pass a number without explicitly converting it to a
2115 string in PHP using: (string)x
2117 09/18/2006: mgossage
2118 [ALL] fix on swiginit.swg, has been reported to crash on several test cases
2119 found and fixed problem in imports under python (mingw)
2121 09/16/2006: wsfulton
2122 [Python] Patch from Michal Marek for Python 2.5 to fix 64 bit array indexes on
2125 09/13/2006: wsfulton
2126 The explicitcall feature has been scrapped. This feature was introduced primarily
2127 to solve recursive director method calls. Director upcall improvements made instead:
2129 [Python, Ruby, Ocaml] The swig_up flag is no longer used. The required mutexes
2130 wrapping this flag are also no longer needed. The recursive calls going from C++
2131 to the target language and back again etc are now avoided by a subtlely different
2132 approach. Instead of using the swig_up flag in each director method to indicate
2133 whether the explicit C++ call to the appropriate base class method or a normal
2134 polymorphic C++ call should be made, the new approach makes one of these calls
2135 directly from the wrapper method.
2137 [Java, C#] The recursive call problem when calling a C++ base class method from
2138 Java/C# is now fixed. The implementation is slightly different to the other languages
2139 as the detection as to whether the explicit call or a normal polymorphic call is made
2140 in the Java/C# layer rather than in the C++ layer.
2142 09/11/2006: mgossage
2143 [ALL] updated swiginit.swg to allow multiple interpreters to use multiple
2144 swig modules at once. This has been tested in Lua (mingw & linux),
2145 perl5 & python (linux) only.
2147 09/11/2006: mgossage
2148 [lua] added support for passing function pointers as well as native lua object
2149 into wrappered function.
2150 Added example funcptr3 to demonstrate this feature
2153 [php] Rename ErrorCode and ErrorMsg #define-s to SWIG_ErrorCode
2154 and SWIG_ErrorMsg to avoid clashes with code the user might be
2155 wrapping (patch from Darren Warner in SF bug #1466086). Any
2156 user typemaps which use ErrorCode and/or ErrorMsg directly will
2157 need adjusting - you can easily fix them to work with both old
2158 and new SWIG by changing to use SWIG_ErrorMsg and adding:
2160 #ifndef SWIG_ErrorMsg
2161 #define SWIG_ErrorMsg() ErrorMsg()
2165 [php] Move constant initialisation from RINIT to MINIT to fix a
2166 warning when using Apache and mod_php. We only need to create
2167 PHP constants once when we're first initialised, not for every HTTP
2170 08/21/2006: mgossage
2172 Bugfix #1542466 added code to allow mapping Lua nil's <-> C/C++ NULL's
2173 updated various typemaps to work correctly with the changes
2174 added voidtest_runme.lua to show the features working
2176 08/19/2006: wuzzeb (John Lenz)
2177 [Guile] Add feature:constasvar to export constants as variables instead of functions
2178 that return the constant value.
2180 08/11/2006: wsfulton
2181 [Java] DetachCurrentThread calls have been added so that natively created threads
2182 no longer prevent the JVM from exiting. Bug reported by Thomas Dudziak and
2185 08/10/2006: wsfulton
2186 [C#] Fix director protected methods so they work
2188 07/25/2006: mutandiz
2190 more additions to std::string, some tweaks and small bug fixes
2193 07/21/2006: mgossage
2195 Bugfix #1526022 pdated std::string to support strings with '\0' inside them
2196 updated typemaps.i to add support for pointer to pointers
2198 07/19/2006: mutandiz
2200 - Add std_string.i support.
2201 - Add newobject patch submitted by mkoeppe (thanks!)
2202 - Fix type name mismatch issue for nested type definitions.
2203 specifically typedefs in templated class defns.
2205 07/18/2006: mgossage
2207 updated lua.cxx to support -external-runtime command
2209 07/14/2006: wuzzeb (John Lenz)
2210 Increment the SWIG_RUNTIME_VERSION to 3, because of the
2211 addition of the owndata member in swig_type_info.
2212 Reported by: Prabhu Ramachandran
2214 07/05/2006: wsfulton
2216 - Fix search path for library files to behave as documented in Library.html.
2217 - Fix mingw/msys builds which did not find the SWIG library when installed.
2218 - Windows builds also output the mingw/msys install location when running
2220 - The non-existent and undocumented config directory in the search path has
2223 07/05/2006: wsfulton
2224 Fix $symname special variable expansion.
2226 07/04/2006: wuzzeb (John Lenz)
2228 Add %feature("constasvar"), which instead of exporting a constant as a
2229 scheme function, exports the constant as a scheme variable. Update the
2230 documentation as well.
2232 07/04/2006: wsfulton
2233 [See entry of 09/13/2006 - explicitcall feature and documentation to it removed]
2234 New explicitcall feature which generates additional wrappers for virtual methods
2235 that call the method explicitly, not relying on polymorphism to make the method
2236 call. The feature is a feature flag and is enabled like any other feature flag.
2237 It also recognises an attribute, "suffix" for mangling the feature name, see
2238 SWIGPlus.html#SWIGPlus_explicitcall documentation for more details.
2241 The explicitcall feature is also a workaround for solving the recursive calls
2242 problem when a director method makes a call to a base class method. See
2243 Java.html#java_directors_explicitcall for updated documentation.
2245 06/28/2006: joe (Joseph Wang)
2246 [r] Initial support for R
2248 06/20/2006: wuzzeb (John Lenz)
2250 Minor fixes to get apply_strings.i testsuite to pass
2251 Remove integers_runme.scm from the testsuite, because SWIG and Chicken does
2255 [php] Add support for generating PHP5 class wrappers for C++
2256 classes (use "swig -php5").
2259 [php] Added some missing keywords to the PHP4 keyword list, and
2260 fixed __LINE__ and __FILE__ which were in the wrong category.
2261 Also added all the keywords new in PHP5, and added comments
2262 noting the PHP4 keywords which aren't keywords in PHP5.
2265 [php] Don't segfault if PHP Null is passed as this pointer (e.g.
2266 Class_method(Null)) - give a PHP Error instead.
2268 06/15/2006: mutandiz
2270 Add initial support for std::list container class.
2271 Fix a few bugs in helper functions.
2273 05/13/2006: wsfulton
2274 [Java] Replace JNIEXPORT with SWIGEXPORT, thereby enabling the possibility
2275 of using gcc -fvisibility=hidden for potentially smaller faster loading wrappers.
2277 05/13/2006: wsfulton
2278 Fix for Makefiles for autoconf-2.60 beta
2280 05/13/2006: wsfulton
2281 Vladimir Menshakov patch for compiling wrappers with python-2.5 alpha.
2283 05/12/2006: wsfulton
2284 Fix buffer overflow error when using large %feature(docstring) reported
2287 05/12/2006: wsfulton
2288 [Perl] Operator overload fix from Daniel Moore.
2290 05/25/2006: mutandiz
2292 Fix bug in generation of CLOS type declarations for unions
2293 and equivalent types.
2295 05/24/2006: mutandiz
2297 Don't require a full class definition to generate a CLOS wrapper.
2300 [php] GCC Visibility support now works with PHP.
2303 [php] Removed support for -dlname (use -module instead). Fixed
2304 naming of PHP extension module to be consistent with PHP
2305 conventions (no "php_" prefix on Unix; on PHP >= 4.3.0, handle Unix
2306 platforms which use something other than ".so" as the extension.)
2308 05/13/2006: wsfulton
2309 [C#] Director support added
2312 [php] Don't segfault if PHP Null is passed where a C++ reference
2316 [php] Fix wrappers generated for global 'char' variables to not
2317 include a terminating zero byte in the PHP string.
2319 05/03/2006: wsfulton
2320 Modify typemaps so that char * can be applied to unsigned char * or signed char *
2321 types and visa versa.
2323 05/03/2006: efuzzyone
2324 [cffi]Thanks to Luke J Crook for this idea.
2325 - a struct/enum/union is replaced with :pointer only if
2326 that slot is actually a pointer to that type. So,:
2327 struct a_struct { int x; } and
2328 struct b_struct { a_struct struct_1; };
2329 will be converted as:
2330 (cffi:defcstruct b_struct
2331 (struct_1 a_struct))
2332 - Other minor fixes in lispifying names.
2334 05/02/2006: wsfulton
2335 Fix possible redefinition of _CRT_SECURE_NO_DEPRECATE for VC++.
2337 04/14/2006: efuzzyone
2339 Thanks to Thomas Weidner for the patch.
2340 - when feature export is set (export 'foo) is
2341 generated for every symbol
2342 - when feature inline is set (declaim (inline foo)) is
2343 generated before every function definition
2344 - when feature intern_function is set
2345 #.(value-of-intern-function "name" "nodeType" package)
2346 is emitted instead of the plain symbol. A sample swig-lispify
2348 - every symbol is prefixed by it's package.
2350 04/13/2006: efuzzyone
2352 Fixed the generation of wrappers for global variables.
2353 Added the option [no]swig-lisp which turns on/off generation
2354 of code for swig helper lisp macro, functions, etc.
2356 Version 1.3.29 (March 21, 2006)
2357 ===============================
2359 04/05/2006: mutandiz
2361 Fix output typemap of char so it produces a character instead
2362 of an integer. Also adds input/output typemaps for 'char *'.
2364 add command-line argument -isolate to generate an interface
2365 file that won't interfere with other SWIG generated files that
2366 may be used in the same application.
2368 03/20/2005: mutandiz
2370 More tweaks to INPUT/OUTPUT typemaps for bool.
2372 Fix constantWrapper for char and string literals.
2374 find-definition keybindings should work in ELI/SLIME.
2375 Output (in-package <module-name>) to lisp wrapper
2376 instead of (in-package #.*swig-module-name*).
2378 slight rework of multiple return values.
2382 03/17/2005: mutandiz
2384 mangle names of constants generated via constantWrapper.
2386 When using OUTPUT typemaps and the function has a non-void
2387 return value, it should be first in the values-list, followed
2388 by the OUTPUT mapped values.
2390 Fix bug with boolean parameters, which needed to be
2391 passed in as int values, rather than T or NIL.
2393 03/15/2006: mutandiz
2395 Generate wrappers for constants when in C++ or -cwrap mode.
2396 Make -cwrap the default, since it is most correct. Users
2397 can use the -nocwrap option to avoid the creation of a .cxx
2398 file when interfacing to C code.
2400 When in -nocwrap mode, improve the handling of converting
2401 infix literals to prefix notation for lisp. This is very
2402 basic and not likely to be improved upon since this only
2403 applies to the -nocwrap case. Literals we can't figure out
2404 will result in a warning and be included in the generated
2407 validIdentifier now more closely approximates what may be
2408 a legal common lisp symbol.
2410 Fix typemap error in allegrocl.swg
2412 03/12/2006: mutandiz
2414 fix up INPUT/OUTPUT typemaps for bool.
2415 Generate c++ style wrapper functions for struct/union members
2416 when -cwrap option specified.
2418 03/10/2006: mutandiz
2420 Fix bug in C wrapper generation introduced by last allegrocl
2423 03/10/2006: wsfulton
2425 Commit #1447337 - Delete LocalRefs at the end of director methods to fix potential leak
2427 03/10/2006: wsfulton
2428 Fix #1444949 - configure does not honor --program-prefix.
2429 Removed non-standard configure option --with-release-suffix. Fix the autoconf standard
2430 options --program-prefix and --program-suffix which were being shown in the help,
2431 but were being ignored. Use --program-suffix instead of --with-release-suffix now.
2433 03/10/2006: wsfulton
2435 Fix #1446319 with patch from andreasth - more than one wstring parameter in director methods
2439 Fix for module names containing a "-" in non-"shadow" mode.
2440 Patch from Aaron VanDevender (#1441474).
2443 - Add -O to the main program, which now enables -fastdispatch
2447 - Add the -fastinit option to enable faster __init__
2448 methods. Setting 'this' as 'self.this.append(this)' in the python
2449 code confuses PyLucene. Now the initialization is done in the
2450 the C++ side, as reported by Andi and Robin.
2452 - Add the -fastquery option to enable faster SWIG_TypeQuery via a
2453 python dict cache, as proposed by Andi Vajda
2455 - Avoid to call PyObject_GetAttr inside SWIG_Python_GetSwigThis,
2456 since this confuses PyLucene, as reported by Andi Vajda.
2458 03/02/2006: wsfulton
2460 Removed extra (void *) cast when casting pointers to and from jlong as this
2461 was suppressing gcc's "dereferencing type-punned pointer will break strict-aliasing rules"
2462 warning. This warning could be ignored in versions of gcc prior to 4.0, but now the
2463 warning is useful as gcc -O2 and higher optimisation levels includes -fstrict-aliasing which
2464 generates code that doesn't work with these casts. The assignment is simply never made.
2465 Please use -fno-strict-aliasing to both suppress the warning and fix the bad assembly
2466 code generated. Note that the warning is only generated by the C compiler, but not
2467 the C++ compiler, yet the C++ compiler will also generate broken code. Alternatively use
2468 -Wno-strict-aliasing to suppress the warning for gcc-3.x. The typemaps affected
2469 are the "in" and "out" typemaps in java.swg and arrays_java.swg. Users ought to fix
2470 their own typemaps to do the same. Note that removal of the void * cast simply prevents
2471 suppression of the warning for the C compiler and nothing else. Typical change:
2474 %typemap(in) SWIGTYPE * %{ $1 = *($&1_ltype)(void *)&$input; %}
2476 %typemap(in) SWIGTYPE * %{ $1 = *($&1_ltype)&$input; %}
2479 %typemap(out) SWIGTYPE * %{ *($&1_ltype)(void *)&$result = $1; %}
2481 %typemap(out) SWIGTYPE * %{ *($&1_ltype)&$result = $1; %}
2485 Add typemaps for "long long"; whether the generated code compiles, however, depends
2486 on the version and configuration of Guile.
2488 03/02/2006: wsfulton
2490 Add support for inner exceptions. If any of the delegates are called which construct
2491 a pending exception and there is already a pending exception, it will create the new
2492 exception with the pending exception as an inner exception.
2494 03/02/2006: wsfulton
2496 Added support for Php5 exceptions if compiling against Php5 (patch from Olly Betts).
2499 Use the GCC visibility attribute in SWIGEXPORT.
2501 Now you can compile (with gcc 3.4 or later) using
2502 CFLAGS="-fvisibility=hidden".
2504 Check the difference for the 'std_containers.i' python
2509 3305432 _std_containers.so
2510 2383992 _std_containers.so.hidden
2512 Exported symbols (nm -D <file>.so | wc -l):
2514 6146 _std_containers.so
2515 174 _std_containers.so.hidden
2519 real 0m0.050s user 0m0.039s sys 0m0.005s _std_containers.so
2520 real 0m0.039s user 0m0.026s sys 0m0.007s _std_containers.so.hidden
2522 Read http://gcc.gnu.org/wiki/Visibility for more details.
2525 02/27/2006: mutandiz
2527 Add support for INPUT, OUTPUT, and INOUT typemaps.
2528 For OUTPUT variables, the lisp wrapper returns multiple
2533 [Ruby] add argcargv.i library file.
2539 %apply (int ARGC, char **ARGV) { (size_t argc, const char **argv) }
2542 int mainApp(size_t argc, const char **argv)
2548 then in the ruby side:
2550 args = ["asdf", "asdf2"]
2554 This is the similar to the python version Lib/python/argcargv.i
2556 02/24/2006: mgossage
2558 Small update Lua documents on troubleshooting problems
2562 Fix all the errors reported for 1.3.28.
2566 - fix 'const char*&' typemap in the UTL, reported by Geoff Hutchison
2567 - fixes for python 2.1 and the runtime library
2568 - fix copyctor + template bug #1432125
2569 - fix [ 1432152 ] %rename friend operators in namespace
2570 - fix gcc warning reported by R. Bernstein
2571 - avoid assert when finding a recursive scope inheritance,
2572 emit a warning in the worst case, reported by Nitro
2573 - fix premature object deletion reported by Paul in tcl3d
2574 - fix warning reported by Nitro in VC7
2575 - more fixes for old Solaris compiler
2576 - fix for python 2.3 and gc_refs issue reported by Luigi
2577 - fix fastproxy for methods using kwargs
2578 - fix overload + protected member issue reported by Colin McDonald
2579 - fix seterrormsg as reported by Colin McDonald
2580 - fix directors, now the test-suite runs again using -directors
2581 - fix for friend operator and Visual studio and bug 1432152
2583 - fix using + %extend as reported by William
2585 - fix for Py_NotImplemented as reported by Olly and Amaury
2586 - fix nested namespace issue reported by Charlie
2590 - allow director protected members by default
2591 - delete extra new lines in swigmacros[UTL]
2592 - cosmetic for generated python code
2593 - add the factory.i library for UTL
2594 - add swigregister proxy method and move __repr__ to a
2595 single global module [python]
2599 When using directors, now swig will emit all the virtual
2600 protected methods by default.
2602 In previous releases, you needed to use the 'dirprot'
2603 option to acheive the same.
2605 If you want, you can disable the new default behaviour,
2606 use the 'nodirprot' option:
2610 and/or the %nodirector feature for specific methods, i.e.:
2612 %nodirector Foo::bar;
2622 As before, pure abstract protected members are allways
2623 emitted, independent of the 'dirprot/nodirprot' options.
2627 Add the factory.i library for languages using the UTL (python,tcl,ruby,perl).
2629 factory.i implements a more natural wrap for factory methods.
2631 For example, if you have:
2633 ---- geometry.h --------
2640 virtual ~Geometry() {}
2641 virtual int draw() = 0;
2644 // Factory method for all the Geometry objects
2646 static Geometry *create(GeomType i);
2649 struct Point : Geometry {
2650 int draw() { return 1; }
2651 double width() { return 1.0; }
2654 struct Circle : Geometry {
2655 int draw() { return 2; }
2656 double radius() { return 1.5; }
2660 // Factory method for all the Geometry objects
2662 Geometry *Geometry::create(GeomType type) {
2664 case POINT: return new Point();
2665 case CIRCLE: return new Circle();
2669 ---- geometry.h --------
2672 You can use the %factory with the Geometry::create method as follows:
2674 %newobject Geometry::create;
2675 %factory(Geometry *Geometry::create, Point, Circle);
2676 %include "geometry.h"
2678 and Geometry::create will return a 'Point' or 'Circle' instance
2679 instead of the plain 'Geometry' type. For example, in python:
2681 circle = Geometry.create(Geometry.CIRCLE)
2684 where 'circle' now is a Circle proxy instance.
2688 [MzScheme] Typemaps for all integral types now accept the full range of integral
2689 values, and they signal an error when a value outside the valid range is passed.
2690 [Guile] Typemaps for all integral types now signal an error when a value outside
2691 the valid range is passed.
2693 02/13/2006: mgossage
2694 [Documents] updated the extending documents to give a skeleton swigging code
2695 with a few typemaps.
2696 [Lua] added an extra typemap for void* [in], so a function which requires a void*
2697 can take any kind of pointer
2699 Version 1.3.28 (February 12, 2006)
2700 ==================================
2703 Fix many issues with line counting and error reports.
2706 [Python] Better static data member support, if you have
2712 then now is valid to access the static data member, ie:
2720 02/11/2006: wsfulton
2722 Fixed code generation to work again with old versions of Perl
2723 (5.004 and later tested)
2726 [Python] Add the %extend_smart_pointer() directive to extend
2727 SWIG smart pointer support in python.
2729 For example, if you have a smart pointer as:
2731 template <class Type> class RCPtr {
2735 Type * operator->() const;
2739 you use the %extend_smart_pointer directive as:
2741 %extend_smart_pointer(RCPtr<A>);
2742 %template(RCPtr_A) RCPtr<A>;
2744 then, if you have something like:
2746 RCPtr<A> make_ptr();
2749 you can do the following:
2754 ie, swig will accept a RCPtr<A> object where a 'A *' is
2757 Also, when using vectors
2759 %extend_smart_pointer(RCPtr<A>);
2760 %template(RCPtr_A) RCPtr<A>;
2761 %template(vector_A) std::vector<RCPtr<A> >;
2769 ie, an 'A *' object is accepted, via implicit conversion,
2770 where a RCPtr<A> object is expected. Additionally
2774 returns (and sets 'x' as) a copy of v[0], making reference
2775 counting possible and consistent.
2777 %extend_smart_pointer is just a collections of new/old
2778 tricks, including %typemaps and the new %implicitconv
2781 02/02/2006: mgossage
2782 bugfix #1356577, changed double=>lua_number in a few places.
2783 added the std::pair wrapping
2785 01/30/2006: wsfulton
2786 std::string and std::wstring member variables and global variables now use
2787 %naturalvar by default, meaning they will now be wrapped as expected in all languages.
2788 Previously these were wrapped as a pointer rather than a target language string.
2789 It is no longer necessary to add the following workaround to wrap these as strings:
2791 %apply const std::string & { std::string *}
2793 *** POTENTIAL INCOMPATIBILITY ***
2797 Add typemaps for handling of member function pointers.
2800 - Better support for the %naturalvar directive, now it
2801 works with the scripting languages as well as
2804 Now, it can also be applied to class types:
2806 %naturalvar std::string;
2807 %include <std_string.i>
2809 that will tell swig to use the the 'natural' wrapping
2810 mechanism to all std::string global and member
2813 - Add support for the %allowexcept feature along the
2814 scripting languages, which allows the %exception feature
2815 to be applied to the variable access methods. Also, add
2816 the %exceptionvar directive to specify a distintic
2817 exception mechanism only for variables.
2820 - Add more docs for the %delobject directive to mark a method as a
2821 destructor, 'disowning' the first argument. For example:
2823 %newobject create_foo;
2824 %delobject destroy_foo;
2826 Foo *create_foo() { return new Foo(); }
2827 void destroy_foo(Foo *foo) { delete foo; }
2829 or in a member method as:
2831 %delobject Foo::destroy;
2835 void destroy() { delete this;}
2842 01/24/2006: mgossage
2844 - Removed the type swig_lua_command_info & replace with luaL_reg
2845 (which then broke the code), fixed this
2846 - added an additional cast in the typemaps for enum's
2847 due to the issue that VC.Net will not allow casting of
2848 a double to an enum directly. Therefore cast to int then to enum
2849 (thanks to Jason Rego for this observation)
2851 01/16/2006: mmatus (Change disabled... will be back in CVS soon)
2852 Add initial support for regexp via the external library
2853 RxSpencer. SWIG doesn't require this library to compile
2854 and/or run. But if you specify --with-rxspencer, and the
2855 library is found during installation, then swig will use
2858 - In %renames rules, via the new rxsmatch rules, for example:
2860 %rename("%(lowercase)",rxsmatch$name="GSL_.*") "";
2861 %rename("%(lowercase)",rxsmatch$nodeType="enum GSL_.*") "";
2863 rxsmatch is similar to the match rule, it just uses
2864 the RxSpencer regexp library to decide if there is a
2865 match with the provided regexp. As with the match
2866 rule, you can also use the negate rule notrxsmatch.
2868 - In the %rename target name via the rxstarget option, for example:
2870 %rename("%(lowercase)",rxstarget=1) "GSL_.*";
2872 where the target name "GSL.*" is now understood as a
2873 regexp to be matched.
2875 - In the new encoder "rxspencer", which looks like:
2877 %(rxspencer:[regexp][replace])s
2879 where "regexp" is the regular expression and "replace"
2880 is a string used as a replacement, where the @0,@1,...,@9
2881 pseudo arguments are used to represent the
2882 corresponding matching items in the reg expression.
2886 %(rxspencer:[GSL.*][@0])s <- Hello ->
2887 %(rxspencer:[GSL.*][@0])s <- GSLHello -> GSLHello
2888 %(rxspencer:[GSL(.*)][@1])s <- GSLHello -> Hello
2889 %(rxspencer:[GSL(.*)][gsl@1])s <- GSLHello -> gslHello
2891 Another example could be:
2893 %rename("%(lowercase)s",sourcefmt="%(rxspencer:[GSL_(.*)][@1])s",%$isfunction) "";
2895 which take out the prefix "GSL_" and returns all the
2896 function names in lower cases, as following:
2898 void GSL_Hello(); -> hello();
2899 void GSL_Hi(); -> hi();
2900 const int GSL_MAX; -> GSL_MAX; // no change, is not a function
2902 We use the RxSpencer as an initial test bed to
2903 implemention while we decide which library will be
2904 finally added to swig.
2906 You can obtain the RxSpencer library from
2908 http://arglist.com/regex (Unix)
2912 http://gnuwin32.sourceforge.net/packages.html (Windows)
2914 Once installed, use "man rxspencer" to get more info
2915 about the regexp format, or just google rxspencer.
2917 Since now you can enable the rxsmatch rules (see above),
2918 the simple or '|' support for the match rules
2919 (01/12/2006: mmatus) is disabled. Still, if you have
2920 problems with the rxspencer library, you can re-enable
2921 the simple 'match or' support using
2922 -DSWIG_USE_SIMPLE_MATCHOR.
2926 Change the %rename predicates to use the prefix '%$', as in:
2928 %rename("%(utitle)s",%$isfunction,%$ismember) "";
2930 to avoid clashings with other swig macros/directives.
2932 01/14/2006: cfisavage
2934 Added support for Ruby bang! methods via a new %bang feature.
2935 Bang methods end in exclamation points and indicate that the
2936 object being processed will be modified in-place as
2937 opposed to being copied.
2939 01/12/2006: cfisavage
2941 Updated the Ruby module to automatically convert
2942 method names to lower_case_with_underscores using the
2943 new %rename functionality.
2946 - Add aliases for 'case' encoders used with %rename/%namewarn
2948 %(uppercase)s hello_world -> HELLO_WORLD
2949 %(lowercase)s HelloWorld -> helloworld
2950 %(camelcase)s hello_world -> HelloWorld
2951 %(undercase)s HelloWorld -> hello_world
2955 - Add the -dump_parse_module and -dump_parse_top options,
2956 which are similar to -dump_module and -dump_top, but they
2957 dump the node trees just after parsing, showing only the
2958 attributes visible at the parsing stage, and not the added
2959 later in typemap.cxx, allocate.cxx, lang.cxx or elsewhere.
2961 Besides debugging porpuses, these options are very useful
2962 if you plan to use %rename in an "advance way", since it
2963 shows only and all the node's attributes you can use
2964 inside the match rules.
2968 - Add predicates to %rename, so, you don't need to
2969 remember, for example, how to match a member function.
2971 Now it is easy, for example to use the 'utitle' encoder
2972 in all the member methods, you type:
2974 %rename("%(utitle)s",%isfunction,%ismember) "";
2976 or to ignore all the enumitems in a given class:
2978 %rename("$ignore", %isenumitem, %classname="MyClass") "";
2980 Available predicates are (see swig.swg):
3016 These predicates correspond to specific 'match'
3017 declarations, which sometimes are not as evident as the
3021 - Add the or '|' operation in %rename match, for
3022 example to capitalize all the constants (%constant or
3025 %rename("%(upper)s",match="cdecl|constant",%isimmutable) "";
3029 01/12/2006: mgossage
3030 - Partial fixed of errors under C89, bug #1356574
3031 (converted C++ style comments to C style)
3032 - Added patches from neomantra@users.sf.net #1379988 and #1388343
3033 missing a 'return' statement for error conditions
3034 also updated the %init block bug #1356586
3037 - Add the 'utitle' encoder, as an example of how to add
3038 your own encoder. I added the encoder method in misc.c
3039 but developers can add others, the same way, inside any
3042 Well, 'utitle' is the reverse of 'ctitle', ie:
3044 %rename("%(ctitle)s") camel_case; -> CamelCase;
3045 %rename("%(utitle)s") CamelCase; -> camel_case;
3048 01/10/2006: cfisavage
3050 Updated Ruby Exception handling. Classes that are specified in throws clauses,
3051 or are marked as %exceptionclass, are now inherited from rb_eRuntimeError.
3052 This allows instances of these classes to be returned to Ruby as exceptions.
3053 Thus if a C++ method throws an instance of MyException, the calling Ruby
3054 method will get back a MyException object. To see an example,
3055 look at ruby/examples/exception_class.
3059 - Add the %catches directive, which complements the %exception
3060 directive in a more automatic way. For example, if you have
3062 int foo() throw(E1);
3064 swig generates the proper try/catch code to dispatch E1.
3078 ie, where there is no explicit exception specification in the decl, you
3088 which is very tedious. Well, the %catches directive defines
3089 the list of exceptions to catch, and from swig:
3091 %catches(E1,E2) barfoo(int i);
3096 int barfoo(int i) throw(E1,E2);
3098 Note, however, that the %catches list doesn't have to
3099 correspond to the C++ exception specification. For example, if you
3106 int barfoo(int i) throw(E1,E2);
3110 %catches(E) barfoo(int i);
3112 and swig will generate an action code equivalent to
3120 Of course, you still have to satisfy the C++ restrictions,
3121 and the catches list must be compatible (not the same)
3122 as the original list of types in the exception specification.
3124 Also, you can now specify that you want to catch the
3125 unknown exception '...', for example:
3127 %catches(E1,E2,...) barfoo(int);
3129 In any case, the %catches directive will emit the
3130 code to convert into the target language error/exception
3131 using the 'throws' typemap.
3133 For the '...' case to work, you need to
3134 write the proper typemap in your target language. In the
3135 UTL, this looks like:
3137 %typemap(throws) (...) {
3138 SWIG_exception(SWIG_RuntimeError,"unknown exception");
3141 01/09/2006: mutandiz
3144 Fixes a number of SEGVs primarily in the handling of
3145 various anonymous types. Found in a pass through the
3146 swig test-suite. Still more to do here, but this is a
3149 Adds -cwrap and -nocwrap as an allegrocl specific
3150 command-line argument. Controls generating of a C
3151 wrapper file when wrapping C code. By default only a
3152 lisp file is created for C code wrapping.
3154 Doc updates for the command-line arguments and fixes as
3155 pointed out on swig-devel
3157 01/05/2006: wsfulton
3158 [Java] Fix unsigned long long and const unsigned long long & typemaps
3159 - Bug #1398394 with patch from Dries Decock
3162 Add 'named' warning codes, now in addition to:
3168 %warnfilter(SWIGWARN_JAVA_MULTIPLE_INHERITANCE);
3170 just use the same code name found in Source/Include/swigwarn.h
3171 plus the 'SWIG' prefix.
3173 If a developer adds a new warning code, the Lib/swigwarn.swg file
3174 will be generated when running the top level make.
3176 01/05/2006: cfisavage
3178 Reimplemented object tracking for Ruby. The new implementation works
3179 by expanding the swig_class structure for Ruby by adding a trackObjects
3180 field. This field can be set/unset via %trackobjects as explained
3181 in the Ruby documentation. The new implementation is more robust
3182 and takes less code to implement.
3184 01/05/2006: wsfulton
3185 Fix for %extend and static const integral types, eg:
3190 static const int bar = 42;
3196 - Add info for old and new debug options:
3198 -dump_top - Print information of the entire node tree, including system nodes
3199 -dump_module - Print information of the module node tree, avoiding system nodes
3200 -dump_classes - Print information about the classes found in the interface
3201 -dump_typedef - Print information about the types and typedefs found in the interface
3202 -dump_tags - Print information about the tags found in the interface
3203 -debug_typemap - Print information for debugging typemaps
3204 -debug_template - Print information for debugging templates
3206 - Add the fakeversion. If you have a project that uses
3207 configure/setup.py, or another automatic building system
3208 and requires a specific swig version, let say 1.3.22
3211 SWIG_FEATURES="-fakeversion 1.3.22"
3215 swig -fakeversion 1.3.22
3217 and then swig -version will report 1.3.22 instead of the
3220 Typical use would be
3222 SWIG_FEATURES="-fakeversion 1.3.22" ./configure
3226 - Add option/format support to %rename and %namewarn.
3227 Now %namewarn can force renaming, for example:
3229 %namewarn("314: import is a keyword",rename="_%s") "import";
3231 and rename can also support format forms:
3233 %rename("swig_%s") import;
3235 Now, since the format is processed via swig Printf, you
3236 can use encoders as follows:
3238 %rename("%(title)s") import; -> Import
3239 %rename("%(upper)s") import; -> IMPORT
3240 %rename("%(lower)s") Import; -> import
3241 %rename("%(ctitle)s") camel_case; -> CamelCase
3243 This will allow us to add more encoders, as the
3244 expected one for regular expressions.
3246 - Add the above 'ctitle' encoder, which does the camel case:
3248 camel_case -> CamelCase
3250 - Also, while we get the regexp support, add the 'command' encoder,
3251 you can use it as follows
3253 %rename("%(command:sed -e 's/\([a-z]\)/\U\\1/' <<< )s") import;
3255 then swig will popen the command
3257 "sed -e 's/\([a-z]\)/\U\\1/' <<< import"
3259 see below for anonymous renames for better examples.
3261 - The rename directive now also allows:
3263 - simple match: only apply the rename if a type match
3266 %rename(%(title)s,match="enumitem") hello;
3269 hi, hello -> hi, Hello
3271 int hello() -> hello;
3273 - extended match: only apply the rename if the 'extended attribute' match
3274 occurred, for example:
3276 // same as simple match
3277 %rename(%(title)s,match$nodeType="enumitem") hello;
3280 hi, hello -> hi, Hello
3283 Note that the symbol '$' is used to define the attribute name in
3284 a 'recursive' way, for example:
3286 // match only hello in 'enum Hello'
3287 %rename(%(title)s,match$parentNode$type="enum Hello") hello;
3290 hi, hello -> hi, Hello // match
3294 hi, hello -> hi, hello // no match
3297 here, for Hello::hi, the "parentNode" is "Hello", and its "type"
3301 - Anonymous renames: you can use 'anonymous' rename directives, for example:
3303 // rename all the enum items in Hello
3304 %rename(%(title)s,match$parentNode$type="enum Hello") "";
3307 hi, hello -> Hi, Hello // match both
3311 hi, hello -> hi, hello // no match
3314 // rename all the enum items
3315 %rename(%(title)s,match$nodeType="enumitem") "";
3317 // rename all the items in given command (sloooow, but...)
3318 %rename(%(command:<my external cmd>)s) "";
3321 Anonymous renames with commands can be very powerful, since you
3322 can 'outsource' all the renaming mechanism (or part of it) to an
3325 // Uppercase all (and only) the names that start with 'i'
3326 %rename("%(command:awk '/^i/{print toupper($1)}' <<<)s") "";
3328 int imported() -> IMPORTED;
3329 int hello() -> hello
3331 Note that if the 'command' encoder returns an empty string, swig
3332 understands that no rename is necessary.
3334 Also note that %rename 'passes' the matched name. For example, in
3345 the external program only receives "foo" and "bar". If needed,
3346 however, you can request the 'fullname'
3348 %rename("%(command:awk 'awk '/ns1::/{l=split($1,a,"::"); print toupper(a[l])}'' <<<)s",fullname=1) "";
3353 - Mixing encoders and matching: of course, you can do mix commands
3354 and match fields, for example:
3356 %rename("%(<my encoder for fncs>)",match="cdecl") "";
3357 %rename("%(<my encoder for enums>)",match="enumitem") "";
3358 %rename("%(<my encoder for enums inside a class>)",match="enumitem",
3359 match$parentNode$parentNode$nodeType="class") "";
3361 Use "swig -dump_parse_module" to see the attribute names you can use to
3362 match a specific case.
3364 - 'sourcefmt' and 'targetfmt': sometimes you need to
3365 process the 'source' name before comparing, for example
3367 %namewarn("314: empty is a keyword",sourcefmt="%(lower)s") "empty";
3371 int Empty(); // "Empty" is the source
3373 you will get the keyword warning since 'Empty' will be
3374 lower cased, via the sourcefmt="%(lower)s" option,
3375 before been compared to the 'target' "empty".
3377 There is an additional 'targetfmt' option to process the
3378 'target' before comparing.
3380 - complementing 'match': you can use 'notmatch', for example
3382 %namewarn("314: empty is a keyword",sourcefmt="%(lower)s",notmatch="namespace") "empty";
3384 here, the name warning will be applied to all the symbols except namespaces.
3389 - Add initial support for gcj and Java -> <target language> mechanism.
3393 Examples/python/java
3397 to see how to use gcj+swig to export java classes into
3400 The idea is to put all the common code for gcj inside
3404 and localize specific types such as jstring, as can be found
3407 Lib/python/jstring.i
3411 Using the UTL, this is very easy, and the perl version for
3412 jstring.i will be next.
3416 - Add the copyctor feature/directive/option to enable the automatic
3417 generation of copy constructors. Use as in:
3430 Also, since it is a feature, if you just type
3434 that will enable the automatic generation for all the
3435 classes. It is also equivalent to
3437 swig -copyctor -c++ ...
3441 1.- The feature only works in C++ mode.
3443 2.- The automatic creation of the copy constructor will
3444 usually produce overloading. Hence, if the target
3445 language doesn't support overloading, a special name
3446 will be used (A_copy).
3448 3.- For the overloading reasons above, it is probably not
3449 a good idea to use the flag when, for example, you are
3450 using keywords in Python.
3452 4.- The copyctor automatic mechanism follows more or less
3453 the same rules as the default constructor mechanism,
3454 i.e., a copy constructor will not be added if the
3455 class is abstract or if there is a pertinent non-public
3456 copy ctor in the class or its hierarchy.
3458 Hence, it might be necessary for you to complete the
3459 class declaration with the proper non-public copy ctor
3460 to avoid a wrong constructor addition.
3462 - Fix features/rename for templates ctor/dtor and other
3463 things around while adding the copyctor mechanism.
3467 - Add the 'match' option to typemaps. Assume you have:
3469 %typemap(in) SWIGTYPE * (int res) {..}
3470 %typemap(freearg) SWIGTYPE * { if (res$argnum) ...}
3474 %typemap(in) A * {...}
3476 swig will 'overload the 'in' typemap, but the 'freearg'
3477 typemap will be also applied, even when this is wrong. The old
3478 solutions is to write:
3480 %typemap(in) A * {...}
3481 %typemap(freeag) A * "";
3483 overload 'freearg' with an empty definition.
3485 The problem is, however, there is no way to know you need
3486 to do that until you start getting broken C++ code, or
3487 worse, broken runtime code.
3489 The same applies to the infamous 'typecheck' typemap,
3490 which always confuses people, since the first thing you do
3491 is to just write the 'in' typemap.
3493 The 'match' option solves the problem, and if instead you write:
3495 %typemap(in) SWIGTYPE * (int res) {..}
3496 %typemap(freearg,match="in") SWIGTYPE * { if (res$argnum) ...}
3497 %typemap(typecheck,match="in",precedence...) SWIGTYPE * {...}
3499 it will tell swig to apply the 'freearg/typecheck'
3500 typemaps only if they 'match' the type of the 'in'
3501 typemap. The same can be done with other typemaps as:
3503 %typemap(directorout) SWIGTYPE * {...}
3504 %typemap(directorfree,match="directorout") SWIGTYPE * {...}
3508 - Add the 'naturalvar' option/mode/feature to treat member
3509 variables in a more natural way, ie, similar to the global
3512 You can use it in a global way via the command line
3514 swig -naturalvar ...
3516 or the module mode option
3518 %module(naturalvar=1)
3520 both forms make swig treat all the member variables in the
3521 same way it treats global variables.
3523 Also, you can use it in a case by case approach for
3524 specific member variables using the directive form:
3528 Then, in the following case for example:
3545 This is valid for all the languages, and the
3546 implementation is based on forcing the use of the
3547 const SWIGTYPE& (C++)/SWIGTYPE (C) typemaps for the
3548 get/set methods instead of the SWIGTYPE * typemaps.
3549 Hence, for 'naturalvar' to work, each target language
3550 must implement 'typemap(in/out) const Type&' properly.
3552 The 'naturalvar' option replaces or makes workarounds such as:
3554 %apply const std::string & { std::string *}
3558 Note1: If your interface has other kinds of workarounds to
3559 deal with the old 'unnatural' way to deal with member
3560 variables (returning/expecting pointers), the
3561 'naturalvar' option could break them.
3563 Note2: the option has no effect on unnamed types, such
3564 as unnamed nested unions.
3568 - Add more 'expressive' result states for the typemap
3571 In the past, for scripting languages, you would do checking something like:
3573 if (ConvertPtr(obj,&vptr,ty,flags) != -1) {
3579 Now the result state can carry more information,
3582 - Error state: like the old -1/0, but with error codes from swigerrors.swg.
3584 int res = ConvertPtr(obj,&vptr,ty,flags);
3585 if (SWIG_IsOK(res)) {
3588 SWIG_Error(res); // res carries the error code
3591 - Cast rank: when returning a simple successful
3592 conversion, you just return SWIG_OK, but if you need
3593 to do a 'cast', you can add the casting rank, ie:
3595 if (PyFloat_Check(obj)) {
3596 value = PyFloat_AsDouble(obj);
3598 } else if (PyInt_Check(obj)) {
3599 value = (double) PyInt_AsLong(obj);
3600 return SWIG_AddCast(SWIG_OK);
3603 later, the casting rank is used to properly dispatch
3604 the overloaded function, for example. This of course
3605 requires your language to support and use the new
3606 dispatch cast/rank mechanism (Now mainly supported in
3607 perl and python, and easily expandable to ruby and tcl).
3609 - [UTL] Add support for the new 'expressive' result states.
3612 - Add support for the C++ implicit conversion mechanism, which
3613 required some modifications in parser.y (to recognize
3614 'explicit') and overload.cxx (to replace $implicitconv as
3617 Still, real support in each target language requires each
3618 target language to be modified. Python provides an example,
3622 - Add support for native C++ implicit conversions, ie, if you
3632 explicit A(char *s) {ii = 4;}
3635 int get(const A& a) {return a.ii;}
3650 #implicit conversions
3653 get("hello") -> Error, explicit constructor
3655 Also, as in C++, now implicit conversions are supported in
3656 variable assigments, and if you have:
3668 cvar.ga = A("hello")
3669 cvar.ga = "hello" -> error, explicit constructor
3675 b.a = "hello" -> error, explicit constructor
3677 Note that the last case, assigning a member var directly,
3678 also requires the 'naturalvar' option.
3680 This support now makes the old '%implicit' macro, which
3681 was found in 'implicit.i' and it was fragile in many ways,
3682 obsolete, and you should use the new '%implicitconv'
3685 Note that we follow the C++ conventions, ie, in the
3686 following the implicit conversion is allowed:
3688 int get(A a) {return a.ii;}
3689 int get(const A& a) {return a.ii;}
3691 but not in these cases:
3693 int get(A *a) {return a->ii;}
3694 int get(A& a) {return a.ii;}
3696 Also, it works for director methods that return a by value
3697 result, ie, the following will work:
3699 virtual A get_a() = 0;
3704 but not in this case:
3706 virtual const A& get_a() = 0;
3707 virtual A& get_a() = 0;
3708 virtual A* get_a() = 0;
3712 - the implicitconv mechanism is implemented by directly
3713 calling/dispatching the python constructor, triggering a
3714 call to the __init__method. Hence, if you expanded the
3715 __init__ method, like in:
3718 def __init__(self,args):
3722 then 'my code' will also be executed.
3724 - Since the %implicitconv directive is a SWIG feature, if you type:
3728 that will enable implicit conversion for all the classes in
3731 But if you are worried about performance, maybe that will be
3732 too much, especially if you have overloaded methods, since
3733 to resolve the dispatching problem, python will efectively
3734 try to call all the implicit constructors as needed.
3736 - For the same reason, it is highly recommended that you use
3737 the new 'castmode' when mixing implicit conversion and
3740 - [python] The %implicit directive is declared obsolete, and
3741 you should use %implicitconv instead. If you include
3742 the implicit.i file, a warning will remind you of this.
3744 Note: Since %implicit is fragile, just replacing it by
3745 %implicitconv could lead to different behavior. Hence, we
3746 don't automatically switch from to the other, and the user
3747 must migrate to the new %implicitconv directive manually.
3750 12/26/2005: wsfulton
3752 Modify std::vector wrappers to use std::vector::value_type as this is
3753 closer to the real STL declarations for some methods, eg for push_back().
3754 Fixes some compilation errors for some compilers eg when the templated
3758 std::vector improvements - a few more methods are wrapped and specializations are
3759 no longer required. The specialize_std_vector macro is no longer needed (a
3760 warning is issued if an attempt is made to use it).
3762 12/26/2005: wsfulton
3764 Add in pointer reference typemaps. This also enables one to easily wrap
3765 std::vector<T> where T is a pointer.
3767 12/24/2005: efuzzyone
3768 [CFFI] The cffi module for SWIG:
3769 - Fully supports C, but provides limited supports for C++, in
3770 particular C++ support for templates and overloading needs to
3774 [python] Add the castmode that allows the python
3775 type casting to occur.
3777 For example, if you have 'int foo(int)', now
3780 def __init__(self,x):
3791 The castmode, which can be enabled either with the
3792 '-castmode' option or the %module("castmode") option, uses
3793 the new cast/rank dispatch mechanism. Hence, now if you
3794 have 'int foo(int); int foo(double);', the following works
3798 foo(1.0) -> foo(double)
3802 Note1: the 'castmode' could disrupt some specialized
3803 typemaps. In particular, the "implicit.i" library seems to
3804 have problem with the castmode. But besides that one, the
3805 entire test-suite compiles fine with and without the
3808 Note2: the cast mode can't be combined with the fast
3809 dispatch mode, ie, the -fastdispatch option has no effect
3810 when the cast mode is selected. The penalties, however,
3811 are minimum since the cast dispatch code is already based
3812 on the same fast dispatch mechanism.
3814 See the file overload_dispatch_cast_runme.py file for
3815 new cases and examples.
3818 Add the cast and rank mechanism to dispatch overloading
3819 functions. The UTF supports it now, but for each language
3820 it must be decided how to implement and/or when to use it.
3822 [perl] Now perl uses the new cast and rank dispatch
3823 mechanism, which solves all the past problems known
3824 in perl, such as the old '+ 1' problem:
3843 and when overloading foo(int) and foo(double);
3846 foo(1.0) -> foo(double)
3847 foo("1") -> foo(int)
3848 foo("1.0") -> foo(double)
3850 foo($n) -> foo(int) for good perl versions
3851 foo($n) -> foo(double) for old bad perl versions
3853 when overloading foo(int), foo(char*) and foo(double):
3856 foo(1.0) -> foo(double)
3857 foo("1") -> foo(char*)
3858 foo("1.0") -> foo(char*)
3859 foo("l") -> foo(char*)
3861 Note: In perl the old dispatch mechanism was broken,
3862 so, we don't provide an option to enable the old one
3863 since, again, it was really really broken.
3865 See 'overload_simple_runme.pl' for more cases and tests.
3867 PS: all the old known issues are declared resolved, any
3868 new "problem" that could be discovered is declared,
3869 a priori, as "features" of the new dispatch mechanism
3870 (until we find another solution at least).
3873 *** POTENTIAL INCOMPATIBILITY ***
3875 As with the introduction of the UTF, some things could
3876 now start to work as expected, and people used to deal or
3877 workaround previous bugs related to the dispatch
3878 mechanism, could see now a difference in perl behavior.
3881 - The '-nodefault' flag (pragma and feature) now generates
3882 a warning, and recommends to use the explicit
3883 -nodefaultctor and -nodefaultdtor options.
3885 The reason to split the 'nodefault' behavior is that, in
3886 general, ignoring the default destructor generates memory
3887 leaks in the target language. Hence, is too risky just to
3888 disable both the default constructor and destructor
3891 If you need to disable the default destructor, it is
3892 also recommended you use the directive form:
3894 %nodefaultdtor MyVerySpecialClass;
3896 for specific classes, and always avoid using the global
3897 -nodefault and -nodefaultdtor options.
3899 12/21/2005: wsfulton
3901 Fix incorrect code generation when the intermediary classname is changed
3902 in the module directive from its default. For example:
3904 %module(jniclassname="myimclassnewname") "mymodule" // Java
3905 %module(imclassname="myimclassnewname") "mymodule" // C#
3907 Add in new special variable $imclassname. See docs.
3911 - Add the -aliasobj0/-noaliasobj0 options to use with
3912 -fastunpack and/or -O and old typemaps that use 'obj0'
3915 So, if you compile your code using -O and get errors about
3916 the undeclared 'obj0' variable, run again using
3918 swig -O -aliasobj0 -python ....
3920 For new typemaps, never use 'obj0' directly, if needed,
3921 use the '$self' name that will be properly expanded to
3922 'obj0' (nofastunpack) or 'swig_obj[0]' (fastunpack).
3924 If you have no idea what I am talking about, better, that
3925 means you have no typemap with this problem.
3930 - Add the -fastunpack/-nofastunpack options to enable/disable
3931 the use of the internal UnpackTuple method, instead of
3932 calling the one from the python C API.
3934 The option -O now also implies -fastunpack.
3939 - Add the -proxydel/-noproxydel options to enable/disable
3940 the generation of proxy/shadow __del__ methods, even
3941 when now they are redundant, since they are empty.
3942 However, old interfaces could rely on calling them.
3944 The default behavior is to generate the __del__ methods
3945 as in 1.3.27 or older swig versions.
3947 The option -O now also implies -noproxydel.
3951 - Fix unneccessary calls to SWIG_TypeQuery for 'char *'
3952 and 'wchar_t *', problem found by Clay Culver while
3953 profiling the PyOgre project.
3957 - Add the -dirvtable/-nodirvtable to enable/disable
3958 a pseudo virtual table used for directors, avoiding
3959 the need to resolve the python method at each call.
3961 - Add the -safecstrings/-nosafecstrings options to
3962 enable/disable the use of safe conversions from PyString
3963 to char *. Python requires you to never change the internal
3964 buffer directly, and hence 'safectrings' warranties that
3965 but returning a copy of the internal python string buffer.
3967 The default, as in previous releases, is to return a
3968 pointer to the buffer (nosafecstrings), so, it is the user's
3969 responsibility to avoid its modification.
3971 - Add the -O option to enable all the optimization options
3972 at once, initially equivalent to
3974 -modern -fastdispatch -dirvtable -nosafecstrings -fvirtual
3978 - Add the -fastdispatch option (fastdispatch feature). This
3979 enables the "fast dispatch" mechanism for overloaded
3980 methods provided by Salvador Fandi~no Garc'ia (#930586).
3982 The resulting code is smaller and faster since less type
3983 checking is performed. However, the error messages you
3984 get when the overloading is not resolved could be
3985 different from what the traditional method returns.
3987 With the old method you always get an error such as
3989 "No matching function for overloaded ..."
3991 with the new method you can also get errors such as
3993 "Type error in argument 1 of type ..."
3995 See bug report #930586 for more details.
3997 So, this optimization must be explicitly enabled by users.
3999 The new mechanism can be used as:
4003 or using the feature form
4005 %feature("fastdispatch") method;
4007 %fastdispatch method;
4012 - Several memory and speed improvements, specially for
4013 templates. Now swig is up to 20 faster than before for
4014 large template interfaces, such as the std_containers.i
4015 and template_matrix.i files in the python test-suite.
4017 Memory footprint is also reduced in consideration of small
4020 - add commandline options -cpperraswarn and -nocpperraswarn" to force
4021 the swig preprocessor to treat the #error directive as a #warning.
4025 #pragma SWIG cpperraswarn=1
4026 #pragma SWIG cpperraswarn=0
4028 are equivalent to the command line options, respectively.
4032 [Python] The generated code is now more portable, especially
4033 for Windows. Following
4035 http://www.python.org/doc/faq/windows.html
4037 Py_None is never accessed as a structure, plus other
4038 tricks mentioned there.
4041 [Python] Added initial support for threads based in the
4042 proposal by Joseph Winston.
4044 The user interface is as follows:
4046 1.- the module thread support is enable via the "threads" module
4049 %module("threads"=1)
4051 2.- Equivalent to that, is the new '-threads' swig option
4053 swig -threads -python ...
4055 3.- You can partially disable thread support for a given
4058 %feature("nothread") method;
4062 also, you can disable sections of the thread support,
4065 %feature("nothreadblock") method;
4067 %nothreadblock method;
4069 %feature("nothreadallow") method;
4071 %nothreadallow method;
4073 the first disables the C++/python thread protection, and the
4074 second disables the python/C++ thread protection.
4076 4.- The current thread support is based in the PyGIL
4077 extension present in python version 2.3 or later, but
4078 you can provide the thread code for older versions by
4079 defining the macros in pythreads.swg.
4081 If you get a working implementation for older versions,
4082 please send us a patch.
4084 For the curious about performance, here are some numbers
4085 for the profiletest.i test, which is used to check the speed
4086 of the wrapped code:
4088 nothread 9.6s (no thread code)
4089 nothreadblock 12.2s (only 'allow' code)
4090 nothreadallow 13.6s (only 'block' code)
4091 full thread 15.5s ('allow' + 'block' code)
4093 i.e., full thread code decreases the wrapping performance by
4094 around 60%. If that is important to your application, you
4095 can tune each method using the different 'nothread',
4096 'nothreadblock' or 'nothreadallow' features as
4097 needed. Note that for some methods deactivating the
4098 'thread block' or 'thread allow' code is not an option,
4102 11/26/2005: wsfulton
4103 SWIG library files use system angle brackets everywhere for %include, eg
4104 %include "std_common.i"
4106 %include <std_common.i>
4108 11/26/2005: wsfulton
4110 Typesafe enums and proper enums have an extra constructor so that enum item values that
4111 are initialised by another enum item value can be wrapped without having to use %javaconstvalue/
4112 %csconstvalue for when using %javaconst(1)/%csconst(1). Suggestion by
4113 Bob Marinier/Douglas Pearson.
4125 Fixes for directors + pointers. This is an ugly problem without an easy
4126 solution. Before we identified this case as problematic:
4128 virtual const MyClass& my_method();
4130 but it turns out that all the cases where a pointer, array or
4131 reference is returned, are problematic, even for
4132 primitive types (as int, double, char*, etc).
4134 To try to fix the issue, a new typemap was added,
4135 'directorfree', which is used to 'free' the resources
4136 allocated during the 'directorout' phase. At the same
4137 time, a primitive garbage collector engine was added to
4138 deal with orphaned addresses, when needed.
4140 The situation is much better now, but still it is possible to have
4141 memory exhaustation if recursion is used.
4143 So, still you need to avoid returning pointers, arrays or
4144 references when using director methods.
4146 - Added stdint.i - typemaps for latest C99 integral types found in stdint.h.
4148 11/14/2005: wsfulton
4149 More types added to windows.i, eg UINT8, WORD, BYTE etc.
4150 Including windows.i will also enable SWIG to parse the __declspec Microsoft
4151 extension, eg __declspec(dllimport). Also other Windows calling conventions
4154 11/10/2005: wsfulton
4155 New library file for Windows - windows.i. This file will contain useful type
4156 information for users who include windows.h. Initial support is for the
4157 non ISO integral types: __int8, __int16, __int32, __int64 and unsigned versions.
4158 The unsigned versions previously could not be parsed by SWIG. SF #872013.
4160 11/09/2005: wsfulton
4161 [Java, C#] Portability warning for files which will overwrite each other on case
4162 insensitive file systems such as FAT32/NTFS. This will occur, for example, when two
4163 class names are the same barring case. The warning is issued on all platforms and
4164 can be suppressed with the usual warning suppression techniques. SF bug #1084507.
4166 11/09/2005: wsfulton
4167 ./configure --with-python --with-ruby --with-perl5 etc enable these languages,
4168 ie the --with-xxxx options, where no path is specified, work the same as if
4169 the option was not specified at all. Based on patches #1335042 #1329048 #1329047.
4174 Add C++ support to the Allegrocl module. Further
4175 enhances the C support as well. Some of the
4178 - MUCH better generation of foreign types based on
4179 the C/C++ types for use in defining the FFI on
4180 the lisp side. We don't pass everything as a (* :void)
4183 - Uses typemaps for better control of type conversions
4184 and code generation in the generated lisp and c++ wrapper
4187 - CLOS wrapping of pointers returned from foreign space
4188 makes it easier to differentiate pointers in user code.
4189 The wrapping objects can be passed directly to FF calls.
4191 - Defun wrapping of FF calls, allowing for more lispy
4192 interface. Conversion, GCing, of lisp objects to
4193 foreign objects can be done in the wrapping defun via
4194 the use of typemaps.
4196 - overload dispatching implemented on the lisp side
4197 using generic functions.
4199 - Templates and synonymous types supported.
4203 [Python] Adding proper support for multi-inheritance in
4204 the python side, ie, if you have two C++ wrapped class, Foo
4207 class MyPythonClass(Foo,Bar):
4210 will properly work, even with directors, and the
4211 deallocation of Foo.this and Bar.this will follow
4212 correctly. Before, a class could only have one 'this'
4213 instance (unlike C++), only the last base class was
4214 properly deleted, or detected with directors.
4216 Now 'self.this' can be a list, which will contain the C++
4217 instance pointers for all the base classes.
4219 Also, swig.this is responsible for deallocating the C++
4220 instance(s), and the __del__ method is not emitted unless
4221 the user preppend/append some code to it.
4223 - Swig can now detect memory leaks, ie, if you still
4224 don't use proxy/shadow classes, and type something like
4227 f = _example.new_Foo()
4229 and forget to call _example.delete_Foo(f), then swig will
4230 tell you that there is a memory leak.
4232 Otherwise, if you always use the proxy classes, you probably
4233 you will never ever see this warning unless there is
4234 something wrong inside the swig wrapping code.
4237 *** POTENTIAL INCOMPATIBILITY ***
4239 If you overloaded the __del__ method, and call the base
4240 one without a try block, as in
4242 class MyClass(SwigClass):
4246 SwigClass.__del__(self)
4248 python could complain that the method SwigClass.__del__ is
4249 undefined. Try to use instead:
4253 try: SwigClass.__del__(self)
4263 [Python] Adding more fun to STL/STD containers, now you
4266 %template(pyset) std::set<PyObject *>;
4267 %template(pyvector) std::vector<PyObject *>;
4268 %template() std::pair<PyObject *,PyObject *>;
4269 %template(pyvector) std::map<PyObject *,PyObject *>;
4272 The same applies to std::list, std::deque, std::multiset, etc.
4274 Then, at the python side you can do now:
4276 # C++ std::vector as native python sequence
4277 v = pyvector([1,"hello",(1,2)])
4283 # C++ std::set as native python sequence
4292 >>> (1, 'hello', (1, 2))
4294 # C++ std::map as native python sequence
4302 >>> {1: (1, 2), 'foo': 'hello'}
4304 ie, the STD/STL containers work as real native python
4305 container, with arbitrary item types and so.
4307 But since normal C++ containers do not properly ref/unref
4308 their items, you should use the safer versions:
4310 %template(pyset) std::set<swig::PyObject_ptr>;
4311 %template(pyvector) std::vector<swig::PyObject_ptr>;
4312 %template() std::pair<swig::PyObject_ptr, swig::PyObject_ptr>;
4313 %template(pyvector) std::map<swig::PyObject_ptr,swig::PyObject_ptr>;
4316 where swig::PyObject_ptr is a PyObject * envelope class provided
4317 to safely incref/decref the python object.
4319 So, now you can use all the STL/STD containers as native
4322 Note 1: std::map, std::set and the other 'ordered'
4323 containers will properly use PyObject_Compare for sorting,
4326 Note 2: all the STL/STD containers have a limit size of
4327 SIZE_MAX, ie, you can have manage containers larger than
4328 INT_MAX, the python limit.
4334 - add 'iterator()' method for all sequences and additionally
4335 'key_iterator()' for maps.
4337 'iterator()' will always return the native C++ iterator.
4338 Additionally, in maps, 'key_iterator()' will return a python
4339 iterator using only the map keys.
4341 In general the sequence method __iter__ will call
4342 'iterator()', returning the native C++ iterator, but in
4343 maps it will call 'key_iterator()', maintaining
4344 backward compatibility.
4346 Hence, for std::maps, you can play then with the native
4347 C++ iterator, which value is a (key, value) pair, by
4348 calling map.iterator(), as with map.begin(), map.end(), etc.
4350 The difference is that map.iterator() returns a safe
4351 'closed' iterator, while map.begin() and map.end() are
4354 A 'closed' iterator knows the begin and the end of the
4355 sequence, and it never can seg. fault. An 'open'
4356 iterator, as in C++, can seg. fault at the C++ side.
4358 # a closed iterator is safe in the following example.
4359 # the next() method will throw a StopIteration
4360 # exception as needed
4368 # an open iterator always need to be checked,
4369 # or it will crash at the C++ side
4371 current = seq.begin()
4373 while (current != end):
4374 sum += current.next()
4378 - Finally, when we call
4382 the construction is 'one-way'. Before construction was done
4385 Foo() (python) -> _new_Foo() (C++)
4386 new_Foo() (C++) -> FooPtr() (python)
4387 FooPtr() (python) -> Foo() (python)
4389 and returning a pointer was done like
4391 NewPointerObj() (C++) -> FooPtr() (python)
4392 FooPtr(python) -> Foo() (python)
4395 ie, we when going back and forward between the C++ and
4398 Now since there is no FooPtr the construction process is
4400 Foo() (python) -> _new_Foo() (C++)
4401 _new_Foo() (C++) -> NewPointerObj() (C++) (no shadow class)
4403 and returning a pointer is done
4405 NewPointerObj() (C++) (with shadow class) -> NewInstaceObj() (C++)
4407 where NewInstanceObj creates a new instance without
4408 calling __init__ and it doesn't go 'back' to python, is
4411 - With this change, and the other ones in the
4412 PySwigObject type, which now carries the thisown and
4413 swig_type_info pointer, the generated code should be as
4414 fast as boost::Python and/or the other python wrappers
4415 based in pure Python/C API calls.
4417 As a reference, the profiletest_runme.py example, which
4418 does a simple call function many times, such as this code:
4424 for i in range(0,1000000)
4428 where fn is defined as 'A* B::fn(A *a) {return a;}',
4429 produces the following times
4432 swig-1.3.26 19.70s 5.98s
4433 swig-CVS 0.99s 0.98s
4436 Clearly, there is a large improvement for the python
4437 'nomodern' mode. Still, the 'modern' mode is around
4438 6 times faster than before. For the same test, but
4439 using the non-shadow version of the module, we get
4441 _profiletest (non-shadow)
4445 Hence, now for practical purposes, the proxy overhead
4448 Note that the performance numbers we are showing is for
4449 a simple module (two types) and a simple function (one
4450 argument). For real situations, for modules with many
4451 more types and/or functions with many more parameters,
4452 you will see even better results.
4458 - Finally, no more ClassPtr proxy classes. You will see
4459 only a clean Class proxy class in the .py file.
4461 - No more 'real' thisown attribute either, the PySwigObject now
4462 carries the ownership info.
4464 You can also do something like
4466 print self.this.own()
4471 print self.this.own()
4476 print self.this.own()
4492 is supported, and python dispatches the proper method
4496 - Support for iterators in STL/STD containers, for example, if you have
4498 %template<set_string> std::set<std::string>;
4500 you can use the C++ iterators as:
4517 advance the iterator as in C++
4521 print current.value()
4524 now using the reverse operators
4535 or the 'previous' method
4546 or just as in a python fashion
4551 Note 1: Iterators in C++ are very powerful, but
4552 dangerous too. And in python you can shoot yourself in the foot
4553 just like in C++, so, be careful.
4555 Note 2: the iterators are 'light', ie, they do not
4556 convert sequence elements until you request to do so, via
4557 next(), value() or previous(). If you just increment/decrement one
4558 no conversion is performed, for example:
4569 only the iterator is modified, and not value wrapper
4570 is generated. Other typical C++ operations are also
4573 print s.end() - s.begin()
4582 etc. Of course, the 'find', 'insert', 'erase', and
4583 so on methods also supports iterators now, ie:
4593 *** POTENTIAL INCOMPATIBILITY ***
4595 There is no more 'thisown' attribute. If you use it, python
4596 will translate the following code as follows:
4598 if (self.thisown): ==> if (self.this.own()):
4599 self.thisown = 1 ==> self.this.own(1)
4600 self.thisown = 0 ==> self.this.own(0)
4602 Still, maybe in some unusual cases the translation will not be
4603 100% correct, so if you have a problem, please report it
4604 and/or use the new 'self.this.own()' accessor.
4607 *** POTENTIAL INCOMPATIBILITY ***
4609 There is no more ClassPtr classes in the python code. Hence,
4610 if in the past you needed to resort to some kind of trickery
4611 with them, or overcome their presence, it is no longer
4612 required, but the extra code you added could now break
4615 If needed, you can use the option -classptr, i.e.,
4617 swig -classptr -python ...
4619 to generate the old ClassPtr classes.
4623 [Guile] Make declared and defined linkage of SWIG_init consistent.
4624 Reported by Steven G. Johnson (SF patch 1315498).
4628 - Added the attribute.i file to the global library director.
4629 Now it can be used from other languages that do not use
4630 the unified typemap library as well.
4632 So, if you have something like:
4634 %include attribute.i
4636 %attribute(A, int, a, get_a, set_a);
4644 %attribute_ref(B, int, c);
4651 then in the target language the 'A.a' and 'B.c' attributes will
4652 be visible, ie, you can access them as plain variables:
4661 and the proper get/set methods will be dispatched. See
4662 attribute.i for more info.
4664 - More cleanups around and adding more test-cases. The
4665 DISOWN typemap now is tested and working in all the
4666 languages that use the unified typemap library, ie, tcl,
4667 ruby, perl and python.
4672 - Perl, complete the DISOWN typemap.
4674 - added the attribute.i file to the unified typemap
4675 library (before was only usable from python).
4677 - unify the names for the setter and getter methods in
4678 perl,tcl,ruby and python, so, the attribute.i library
4679 can work across them.
4681 - see the li_attribute.i test-case or the library file
4683 Lib/typemaps/attribute.swg
4685 for more info about how to use it.
4692 - Perl now uses the unified typemap library.
4694 - Changes in ruby to use the $track option in typemaps.
4696 - Changes in the unified typemap library to follow the
4697 convention that all macros that are not used in the
4698 C/C++ side starts with %, such as
4705 - Documenting fragments, see fragments.swg.
4707 - Cleaner way to use the unified typemap library, include
4708 just <typemaps/swigtypes.swg>.
4710 Check some of the supported languages: perl, tcl, ruby,
4713 Always start with the head file, such as
4720 and the principal file that invokes the unified library, such as
4722 python/pytypemaps.swg
4724 ruby/rubytypemaps.swg
4725 perl/perltypemaps.swg
4727 The file that provide the specialization for each
4728 language are the one that provides the basic types:
4730 python/pyprimtypes.swg
4731 ruby/rubyprimtypes.swg
4732 tcl/tclprimtypes.swg
4733 perl5/perlprimtypes.swg
4735 and the string manipulation:
4737 python/pystrings.swg
4738 ruby/rubystrings.swg
4740 perl5/perlstrings.swg
4743 The rest of the files, such as carray.i, are mostly one
4744 line files that include the proper typemap library
4747 *** POTENTIAL INCOMPATIBILITY in Perl ***
4749 Some missing/wrong typemaps could start working properly,
4750 and change the old expected behavior in Perl.
4754 + pointers to member functions finally work properly
4755 + add test of member function pointers to cpp_basic.i
4758 [allegrocl] Added C++ support. Large update, many changes. See
4759 newly added Allegro Common Lisp section in lisp.html
4764 - Uniform way to fail (label fail:), now finally
4765 SWIG_exception works across the three languages and all
4768 - Add proper cleanup code to ruby
4770 - More valgrind fixes
4772 - Simplify the inline use, it seems a small interface of
4773 20,000 lines (plus many many templates) can break
4776 - Finalize the typemaps library. All the old *.i files
4777 (carray.i, cpointer.i, exception.i) had been implemented
4778 in the new typemaps library.
4782 Update the Runtime Typemap documentation in Typemaps.html
4786 - Correctly handle %ignored classes
4787 - Correctly convert long, long long, unsigned long, etc
4788 to chicken primitives. (Thanks to Felix Winkelmann)
4789 - Using argout parameters when the return value was a
4790 wrapped pointer caused a memory corruption. The chicken
4791 garbage collector moved a pointer out from under us.
4792 This is now fixed by running all the proxy creation
4793 functions as continuations after the wrapper function
4794 returns. As part of this, we no longer need the
4795 chickenfastproxy flag on output typemaps.
4796 - using -proxy and -nocollection together works now
4797 Before, it was not exporting the destructor in the proxy
4802 Added the Unified Typemap Library (UTL). It unifies the typemaps for
4806 and in the process, fixes several problems in each of the three
4807 languages to work in a "canonical" way now established in
4812 The current status of the unification is that everything
4813 compiles and runs inside the test-suite and examples
4814 directories. And for the first time we have three
4815 languages than pass the primitive_types.i case.
4817 Also, we have a uniform way to treat the errors, for example
4818 if you do something like
4820 >>> from primitive_types import *
4821 >>> print val_uchar(10)
4823 >>> print val_uchar(1000)
4824 Traceback (most recent call last):
4825 File "<stdin>", line 1, in ?
4826 OverflowError: in argument 1 of type 'unsigned char'
4828 you get the same exception in all the three languages.
4830 And well, many more good things will come from this
4831 unification, for example, proper support of the STL/STD classes
4832 for all the languages, and hopefully, we can keep
4833 adding other languages.
4835 The hardest part, writing a common typemap library
4836 that suites the three different languages, is done,
4837 and adding another language should now be easy.
4839 Still the global unification is not complete, the STL/STD
4840 part is next, and probably as well as adding one or two more
4843 If you are curious, look at the python, ruby and/or tcl
4844 directories to see what is needed to support the new
4845 common typemaps library. Still, the final way to
4846 integrate a new language could change as we move to
4847 integrate the STD/STL.
4849 *** POTENTIAL INCOMPATIBILITY in Ruby/Tcl ***
4851 Some missing/wrong typemaps could start working properly,
4852 and change the old behavior, specially in ruby and tcl.
4854 Version 1.3.27 (October 15, 2005)
4855 =================================
4857 10/15/2005: wsfulton
4858 [Java] Fix for typesafe enum wrapping so that it is possible to
4859 overload a method with 2 different enum types.
4861 10/15/2005: wsfulton
4862 Fix for %feature("immutable","0") attempting to generate setters
4865 Restored %immutable and %makedefault to clear the feature as it
4866 behaved in SWIG-1.3.25 and earlier.
4869 Fix bug in anonymous typedef structures which was leading to
4873 Several minor changes:
4875 - Improve the wchar_t type support
4876 - Add a warning for when you define the 'in' typemap but
4877 you don't define the 'typecheck' one. Very common mistake.
4878 - Add proper default rule for function pointers, now you
4879 can define a typemap such as:
4881 %typemap(in) SWIGTYPE ((*)(ANY)) {...}
4883 That will apply to all the pointer to functions. The
4884 rule in C++ also apply to the function 'reference', ie,
4887 typedef int (*fptr)(int a);
4888 typedef int (func)(int a);
4890 This was needed since it seems to be 'illegal' in C++ to
4893 void *ptr = static_cast<void *>(fptr);
4895 and probably, as for member functions, it is not
4896 warrantied that the pointer sizes will match.
4898 - Add the #error/#warning directives to swig's cpp.
4900 - Add the noblock option for typemaps, which is used as
4901 follows: supposed you a typemap, like this
4904 %typemap(in,noblock=1) Hello {
4908 then the typemap will be inserted without the block
4909 imposed by the brackets, similar to
4911 %typemap(in) Hello "...";
4913 So, why you don't just use the quote style?, because:
4915 1.- The quote style doesn't get preprocessed, for example
4917 %typemap(in) Hello "$1= SWIG_macro($1);";
4919 here, SWIG_macro doesn't get expanded
4921 2.- Inside a quote typemap, you have to use
4924 %typemap(in) Hello "$1 = \"hello\" ";
4926 3.- You can't make emacs and/or other editors
4927 to indent inside a string!.
4930 So, why do you want to remove the block?, because an extra
4931 block when not needed (no local variables in it):
4933 1.- makes the code harder to read
4934 2.- makes the code larger
4935 3.- or in short, for the same reason we have the quote style.
4937 Version 1.3.26 (October 9, 2005)
4938 ================================
4940 10/08/2005: wsfulton
4941 [Php] Added 'throws' typemaps.
4943 10/08/2005: wsfulton
4944 Fixes for languages that don't support multiple inheritance. The
4945 first non-ignored class in the public base class list is used for inheritance.
4946 by the proxy class. Previously, if the first class in the list was ignored, then
4947 the proxy class wouldn't have any base classes.
4950 Update more features to follow new convention, including:
4956 All of them use not only the feature as a flag, but also
4957 as code value. To deal with those features, we use now
4958 GetFlagAttr, which is similar to GetFlag, but instead or
4959 returning 1 or 0, it returns the attr value, if happens
4960 to be different of "0" of course.
4962 Now there are also more uniform directive names for the
4963 ones based in features, for example, for the old
4964 %newobject directive now we have tree directives defined:
4967 #define %newobject %feature("new")
4968 #define %nonewobject %feature("new","0")
4969 #define %clearnewobject %feature("new","")
4971 and so on for all the other feature directives.
4973 *** POTENTIAL INCOMPATIBILITY ***
4975 09/30/2005: wsfulton
4976 Subtle change to some features. Previously it was not possible to disable many
4977 features once they had been enabled. This was for most features that behave as
4978 flags. These features now work as follows:
4980 %feature("name") // enables the feature
4981 %feature("name", "1") // enables the feature
4982 %feature("name", "0") // disables the feature
4983 %feature("name", "") // clears the feature
4985 In fact any non-empty value other than "0" will enable the feature (like C boolean logic).
4986 Previously "1", "0" or any other non-empty value would enable the feature and it would
4987 only be possible to disable the feature by clearing it (assuming there was no global enable).
4989 The following features are affected:
4996 exceptionclass (Python)
5000 java:downcast (Java)
5011 python:maybecall (Python)
5012 python:nondynamic (Python)
5013 modula3:multiretval (Modula3)
5018 It is now possible, for example to ignore all methods/classes in a header file, except for a
5019 few targetted methods, for example:
5021 %feature("ignore"); // ignore all methods/classes
5022 %feature("ignore","0") some_function(int, double); // do not ignore this function
5023 %feature("ignore","0") SomeClass; // do not ignore this Class
5024 %feature("ignore","0") SomeClass::method; // do not ignore this method
5025 %include "bigheader.h"
5027 Removed %pythondynamic - it never worked properly. Use %pythonnondynamic instead.
5028 Removed %feature("nokwargs") - it wasn't fully implemented - use %feature("kwargs","0") instead.
5030 *** POTENTIAL INCOMPATIBILITY ***
5033 [Guile] Add "throws" typemaps.
5035 09/24/2005: cfisavage
5036 [Ruby] Adds new %trackobjects functionality that maps C++ objects to
5037 Ruby objects. This functionality makes it much easier to implement
5038 mark functions for the garbage collector. For more information
5039 refer to the update documentation and examples.
5041 09/20/2005: wsfulton
5042 [Perl] Patch 1116431 from Josh Cherry. Fixes non member functions inadvertently
5043 being called instead of member functions.
5045 09/20/2005: wsfulton
5046 [Lua] Patch from Mark Gossage to add support for Lua-5.1, std::string,
5047 std::vector, std::exception and documentation.
5050 [Python] Add -nocppcast. Now the default behavior is to
5051 always use the cppcast operators. Before that was the case
5052 only when you used the -cppcast option.
5054 If this seems to break your code... your welcome!, it
5055 means it was broken before, and you never notice.
5057 If you thing the error is due to one of the SWIG typemaps,
5060 Use -nocppcast only with very old C++ compilers that
5061 do not support the cppcast operations.
5065 This change doesn't break compatibility, it was broken before.
5067 09/13/2005: wsfulton
5068 [Java] Fix for director methods when a class is passed by value as a
5072 Adding the module option to the %import directive. Now you
5075 %import(module="BigModule") foo.i
5077 where subfile could (or not) define the module name via
5078 the %module directive. The module option take precedence
5079 and it has the same effects than having the directive
5083 inside the imported file foo.i.
5085 You can use the option in mainly two cases:
5087 1.- You used the -module option when you generated the
5088 module to be imported, and hence the module name in
5089 the imported %module directive is not really useful.
5091 2.- The module you want to import is very large, and it
5092 has several .i/.h files. Then, if you just one to
5093 import a class or so from the module, says 'foo', and
5094 not the entire module via importing the main
5095 BigModule.i file, then you just do:
5097 %import(module="BigModule") foo.h
5101 %import(module="BigModule") foo.i
5103 where foo.i contains the 'foo' declaration and maybe a
5104 couple of extra %include directives, as needed.
5108 Fix bug #1282637, about the -module option not having effect
5109 in places where it was needed.
5111 09/11/2005: wsfulton
5112 When wrapping variables, ensure that none of the typemaps used for the
5113 set wrappers are used when generating the get wrappers. I doubt this was a
5114 problem for any languages except for the recently introduced null attribute
5115 in the out typemap (C# only).
5117 09/08/2005: wsfulton
5118 More descriptive error messages when files fail to open.
5122 Allow a %define a macro inside another %define macro, for example
5124 %define hello(name, Type)
5125 %define name ## a(Type)
5126 %typemap(in) Type "hello;";
5130 To learn how to use this new features in your own typemaps library, see
5131 python/cstring.i, python/cwstring.i and python/cwstrbase.i.
5133 [Python] Normalize the cstring.i implementation to use fragments, and add
5134 cwstring.i, which implements the same typemaps but for wchar_t strings.
5136 [Python] Bug fixed: 1247477, 1245591, 1249878 and others.
5138 08/18/2005: wsfulton
5139 [Ruby] Implement support for SWIGTYPE* DISOWN typemap (like in Python) for
5140 better control of memory management, eg when adding an object created in Ruby
5141 to a C++ container. Patch #1261692 from Charlie Savage.
5143 08/18/2005: wsfulton
5144 [Tcl] 64 bit platform fixes for the varargs handling in SWIG_GetArgs. This is an
5145 improved fix for bug #1011604 as suggested by Jeremy Lin.
5147 08/18/2005: wsfulton
5148 [Tcl] Bug #1240469 - %newobject support for Tcl. Patch from Bob Marinier.
5150 08/16/2005: wsfulton
5151 [Perl] Bug #1254494 - Fix for global namespace pollution by perl header files
5152 (bool define) prevented STL headers from being used on some systems, eg
5153 Windows with Visual Studio.
5155 08/16/2005: wsfulton
5156 [Java] Bug #1240937 - Redefinition of __int64 typedef for Intel compilers.
5158 08/15/2005: wsfulton
5159 [Xml] Bug #1251832 - C++ template may generate invalid XML file
5161 08/15/2005: wsfulton
5162 [Lua] Support added for Lua. Patch #1242772 from Mark Gossage.
5163 It supports most C/C++ features (functions, struct, classes, arrays, pointers,
5164 exceptions), as well as lots of documentation and a few test cases & examples.
5166 08/14/2005: wsfulton
5167 [Xml] Fix incorrect xml escaping in base class name when base class is a template.
5169 08/13/2005: efuzzyone
5170 [CLISP] Added support for handling enums. Does not adds the return type declaration
5171 to the function definition, if a function returns void.
5174 New language module, Common Lisp with UFFI, from Utz-Uwe Haus.
5177 Fix the Lisp s-expression output module; it no longer complains about "unknown targets".
5179 07/27/2005: wsfulton
5180 Modifications to STL wrappers so that it is possible for a user's %exception directive
5181 to be applied to the STL wrapper methods. Previously the following global %exception
5182 directive would not be used on the wrapper methods:
5188 // handle uncaught exceptions
5192 This has been implemented by replacing %exception directives for specific STL wrapper
5193 methods with an exception specification declared on the wrapper methods. throws typemaps
5194 are now supplied for handling the STL exception specification. These can also be easily
5195 overridden, for example the std::out_of_range exception, which is used a lot in the STL
5196 wrappers, can be customised easily:
5198 %include "std_vector.i"
5199 %typemap(throws) std::out_of_range {
5200 // custom exception handler
5202 %template(VectInt) std::vector<int>;
5204 07/22/2005: efuzzyone
5205 [CLISP] The clisp module for SWIG:
5206 - It can only handle C, clisp currently does not supports ffi bindings to C++.
5207 - It has two options, (a) -extern-all this will generate wrappers for all functions
5208 and variablestions, (b) -generate-typedef this will generate wrappers "def-c-type"
5209 wrappers for typedefs
5210 - Can handle pointers to functions, complex types such as n-dimensional arrays of
5212 - Generates wrappers for constants as well as variables
5213 - Correctly distinguishes between the declaration of variables in structures and functions
5214 - Creates a defpackage "declaration" with the module name as the package name, the created
5215 package exports both functions and variables
5216 - tries to guess when should a pointer variable be declared as c-ptr or c-pointer
5218 07/22/2005: wsfulton
5219 [C#] Changes to support C# structs returned by value. The changes required are:
5220 - Using an optional 'null' attribute in the out typemap. If this attribute is specified,
5221 then it is used for the $null special variable substitution.
5222 - The ctype used in the C/C++ wrappers is no longer initialised to 0 on declaration.
5223 Both of these changes fix the situations where an attempt was made to assign 0 to the
5224 returned struct. Marshalling structs as value types still requires user defined typemaps.
5225 See documentation for an example.
5227 07/22/2005: wsfulton
5228 [C#, Java] Fix SWIG_exception usage to work with compilers that don't support empty macro
5229 arguments. Unfortunately this fix will stop usage of SWIG_exception being used within typemaps
5230 that use "" or %{ %} delimiters, but continues to work with typemaps using {} delimiters.
5231 Please use the SWIG_CSharpSetPendingExceptionArgument or SWIG_JavaThrowException methods instead
5232 as SWIG_exception is really intended as a platform independent macro for the SWIG library writers.
5235 [Allegro CL] Use specific foreign types rather than (* :void).
5236 Use *swig-identifier-converter*.
5238 06/27/2005: wsfulton
5239 Functions declared as 'extern' no longer have an additional function declaration added to the
5240 wrapper files. There are some cases where SWIG does not get this right, eg bug #1205859 (extern
5241 functions with default arguments declared in a namespace). Also SWIG cannot get non-standard
5242 calling conventions correct, eg Windows calling conventions are usually handled like this:
5245 #define DLLIMPORT __declspec(dllimport)
5246 #define STDCALL __stdcall
5251 DLLIMPORT extern STDCALL void function(int);
5254 SWIG incorrectly generates:
5256 extern void function(int);
5258 To which there is no solution as SWIG doesn't handle non-standard calling conventions. The extra
5259 'extern' function that SWIG generates is superfluous unless a user has forgotten to add the function
5260 declaration into the wrappers.
5262 The -noextern commandline argument is now redundant and a new commandline argument -addextern can
5263 be used to obtain the original behaviour. This shouldn't be necessary unless the header file
5264 containing the function declaration was inadvertently not added to the wrappers. To fix this
5265 add the function declaration into your wrappers, For example, replace:
5267 extern void foo(int);
5272 extern void foo(int);
5275 *** POTENTIAL INCOMPATIBILITY ***
5277 06/22/2005: wsfulton
5278 [C#, Java, Modula3, Ocaml]
5279 The intermediary function names have been changed when wrapping variables to
5280 match the other language modules so that %extend for a member variable works
5281 uniformly across all language modules, eg:
5288 void ExtendMe_Var_set(ExtendMe *, double) {...}
5289 double ExtendMe_Var_get(ExtendMe *) {...}
5292 The methods implementing the get/set used to be:
5295 void set_ExtendMe_Var(ExtendMe *, double) {...}
5296 double get_ExtendMe_Var(ExtendMe *) {...}
5299 This also changes the name of variable wrapper functions when using -noproxy.
5300 The original names can be generated with the -oldvarnames commandline option.
5302 *** POTENTIAL INCOMPATIBILITY ***
5304 Version 1.3.25 (June 11, 2005)
5305 ==============================
5308 [Guile] Fix handling of anonymous-enum variables.
5311 [Guile] Fix for function arguments that are passed by
5312 copy-of-value. Fix for global "const char *" variables.
5313 Fix testcases arrays_dimensionless, arrays_global.
5315 06/08/2005: wsfulton
5316 Fix for when a base class defines a symbol as a member variable and a derived class defines
5317 the same symbol as a member method.
5319 06/08/2005: wsfulton
5320 [C#] More fixes for virtual/new/override modifiers - when a method has protected access
5321 in base and public access in derived class.
5323 06/02/2005: wsfulton
5324 Fix #1066363 - Follow convention of release tarball name matching directory name.
5326 06/02/2005: wsfulton
5327 [C#, Java] Fix #1211353 - typesafe enums (and Java proper enums) wrappers when enum value
5330 05/27/2005: wsfulton
5331 Modernised and tidied up Windows macros --> SWIGEXPORT, SWIGSTDCALL. They can be overridden
5332 by users via -D compiler directives if need be.
5334 05/26/2005: wsfulton
5335 %csmethodmodifiers can be applied to variables as well as methods now.
5337 In addition to the default 'public' modifier that SWIG generates, %csmethodmodifiers will also
5338 replace the virtual/new/override modifiers that SWIG thinks is appropriate. This feature is
5339 useful for some obscure cases where SWIG might get the modifiers incorrect, for example
5340 with multiple inheritance and overriding a method in the base class.
5342 *** POTENTIAL INCOMPATIBILITY FOR C# MODULE ***
5344 05/25/2005: wsfulton
5345 Added missing constructors to std::pair wrappers (std_pair.i) for all languages.
5347 05/25/2005: wsfulton
5348 [C#] Added std::pair wrappers in std_pair.i
5350 05/25/2005: wsfulton
5351 [C#] The C# 'new' and 'override' modifiers will be generated when a C++ class inherits methods
5352 via a C++ 'using' declaration.
5354 05/25/2005: wsfulton
5355 Fix for exception specifications previously being ignored in classes that inherited methods
5356 from 'using' declarations, eg calls to Derived::bar below will convert C++ exceptions into
5357 a target language exception/error, like it always has done for Base::Bar.
5360 virtual bar() throw (std::string);
5362 class Derived : public Base {
5366 05/23/2005: wsfulton
5367 Fixes for detecting virtual methods in %extend for the -fvirtual option and C# override and new
5370 05/23/2005: wsfulton
5371 [C#] The 'new' modifier is now generated on the proxy method when a method in a derived
5372 class is not polymorphic and the same method exists in the derived class (ie it hides
5373 the base class' non-virtual method).
5375 05/23/2005: wsfulton
5376 [Java, C#] Fixes to detection of covariant return types - when the class hierarchy is more
5377 than 2 classes deep.
5379 05/21/2005: wsfulton
5380 [Java] std::wstring typemaps moved from std_string.i to std_wstring.i
5382 05/21/2005: wsfulton
5383 Fix for crash in DohStrstr, bug #1190921
5385 05/21/2005: wsfulton
5386 [TCL] Fix for methods with similar names when showing list of names on error - bug #1191828.
5387 Patch from Jeroen Dobbelaere.
5389 05/21/2005: wsfulton
5390 [TCL] long long overloading fix - bug #1191835, patch from Jeroen Dobbelaere.
5392 05/21/2005: wsfulton
5393 Fix bug #1196755 to remove debug from swigtcl8.swg.
5395 05/19/2005: wsfulton
5396 [C# and -fvirtual option] Fix for the override key not being generated in the derived class when a
5397 virtual method's return type was a typedef in either the base or derived class. Also ensures the
5398 method is eliminated when using the -fvirtual option. For example, Derived.method now has the C#
5399 override keyword generated:
5401 typedef int* IntegerPtr;
5404 virtual IntegerPtr method();
5407 struct Derived : Base {
5408 int * method() const;
5411 [C#] Fix for the override key being incorrectly generated for virtual methods when a base class
5412 is ignored with %ignore.
5414 05/13/2005: wsfulton
5415 [Java] Fixes to remove "dereferencing type-punned pointer will break strict-aliasing rules"
5416 warnings in C wrappers when compiling C code with 'gcc -Wall -fstrict-aliasing'. Patch from
5417 Michael Cahill. This modifies many of the casts slightly, for example
5418 arg1 = *(DB_ENV **)&jarg1;
5420 arg1 = *(DB_ENV **)(void *)&jarg1;
5422 05/12/2005: wsfulton
5423 [C#] Support for C# attributes. C# attributes can be generated:
5424 1) On a C/C++ type basis by specifying an inattributes and/or outattributes typemap attribute
5425 in the imtype or cstype typemaps (for C# return type or C# parameter type attributes).
5426 2) On a wrapped method or variable by specifying a csattributes feature (%feature).
5427 3) On a wrapped proxy class or enum by specifying a csattributes typemap.
5429 Examples are in the C# documentation (CSharp.html).
5431 04/29/2005: wsfulton
5432 New configure option to turn off the default maximum compiler warning as
5433 they couldn't be removed even when overriding CFLAGS and CXXFLAGS with configure
5434 (./configure CFLAGS= CXXFLAGS=). To turn the maximum warnings off, run:
5436 ./configure --without-maximum-compile-warnings
5438 04/28/2005: wsfulton
5439 Patch from Scott Michel which reworks the Java constructor and finalize/destructor typemaps,
5440 for directors to reduce the number of overall Java typemaps. Added the director_take and
5441 director_release typemaps to emulate other modules' __disown__ functionality.
5443 *** POTENTIAL INCOMPATIBILITY FOR JAVA DIRECTORS ***
5445 04/28/2005: wsfulton
5446 [C#] Fixed problems due to the over eager garbage collector. Occasionally the
5447 garbage collector would collect a C# proxy class instance while it was being used
5448 in unmanaged code if the object was passed as a parameter to a wrapped function.
5449 Needless to say this caused havoc as the C# proxy class calls the C++ destructor
5450 when it is collected. Proxy classes and type wrapper classes now use a HandleRef,
5451 which holds an IntPtr, instead of a plain IntPtr to marshal the C++ pointer to unmanaged
5452 code. There doesn't appear to be any performance degradation as a result of this
5455 The changes are in the proxy and type wrapper classes. The swigCPtr is now of type HandleRef
5456 instead of IntPtr and consequently the getCPtr method return type has also changed. The net
5457 effect is that any custom written typemaps might have to be modified to suite. Affected users
5458 should note that the implementation uses the new 'out' attribute in the imtype typemap as the
5459 input type is now a HandleRef and the output type is still an IntPtr.
5461 *** POTENTIAL INCOMPATIBILITY FOR C# MODULE ***
5463 04/28/2005: wsfulton
5464 [C#] Support for asymmetric type marshalling added. Sometimes the output type needs to be
5465 different to the input type. Support for this comes in the form of a new optional 'out'
5466 attribute for the ctype, imtype and cstype typemaps. If this typemap attribute is not
5467 specified, then the type used for both input and output is the type specified in the
5468 typemap, as has always previously been the case. If this typemap attribute is specified,
5469 then the type specified in the attribute is used for output types and the type specified
5470 in the typemap itself is used for the input type. An output type is a return value from
5471 a wrapped method or wrapped constant and an input type is a parameter in a wrapped method.
5473 An example shows that char * could be marshalled in different ways,
5475 %typemap(imtype, out="IntPtr") char * "string"
5476 char * function(char *);
5478 The output type is thus IntPtr and the input type is string. The resulting intermediary C# code is:
5480 public static extern IntPtr function(string jarg1);
5482 04/22/2005: mkoeppe (Matthias Koeppe)
5483 [Guile] Fix generation of "define-method" for methods of
5484 classes with a constructor. Reported by Luigi Ballabio.
5486 04/15/2005: wuzzeb (John Lenz)
5488 For wrapped functions that return multiple values (using argout),
5489 SWIG CHICKEN now returns them as multiple values instead of as
5490 a list. They can then be accessed using (call-with-values).
5492 04/14/2005: wuzzeb (John Lenz)
5494 + Added a whole bunch of new _runme scripts into the chicken test
5495 suite. Also fix some bugs these new scripts turned up.
5497 + Added optimization when returning a wrapped proxy class. Before,
5498 a minor garbage collection was invoked every time a function returned.
5500 + All the chicken Examples should now run correctly
5502 04/14/2005: wsfulton
5503 [C#] More fixes for typemap matching when wrapping variables, in particular
5504 std::string, so that std::string variables can be easily marshalled with
5505 a C# string property using:
5507 %include "std_string.i"
5508 %apply const std::string & { std::string *variable_name };
5509 std::string variable_name;
5511 (Recall that all class variables are wrapped using pointers)
5513 04/05/2005: wuzzeb (John Lenz)
5515 + Added Examples/chicken/egg, an example on how to build a chicken
5516 extension library in the form of an egg. Also updated the
5517 documentation on the different linking options.
5519 + chicken test-suite now has support to check SWIG with the -proxy
5520 argument if there exists a _proxy_runme.ss file.
5522 + More fixes for overloaded functions and -proxy
5524 03/31/2005: wsfulton
5525 Turned on extra template features for all languages which were
5526 previously only available to Python.
5528 This enables typemaps defined within a templated class to be used as
5529 expected. Requires %template on the templated class, %template() will
5530 also pick up the typemaps. Example:
5532 template <typename T> struct Foo {
5534 %typemap(in) Foo "in typemap for Foo<T> "
5536 %typemap(in) Foo<T> "in typemap for Foo<T> "
5539 %template(Foo_i) Foo<int>;
5540 %template() Foo<double>;
5542 will generate the proper 'in' typemaps wherever Foo<int> and Foo<double>
5545 03/30/2005: mkoeppe (Matthias Koeppe)
5546 [MzScheme] Patch from Hans Oesterholt for supporting MzScheme 30x.
5548 03/29/2005: wuzzeb (John Lenz)
5550 + Reallow older versions of chicken (1.40 to 1.89) by passing -nocollection
5552 + %import now works correctly with tinyclos. (declare (uses ...)) will be
5554 + TinyCLOS proxy classes now work correctly with overloaded functions
5557 03/29/2005: wsfulton
5558 [Java] Patch from Scott Michel for directorout typemaps. Java directors
5559 require the directorout typemaps like the other languages now. The new
5560 typemaps provide fixes for methods where the return type is returned
5561 by reference (this cannot automatically be made thread safe though).
5563 03/22/2005: wsfulton
5564 Enum casting fixes. Visual C++ didn't like the C type casting SWIG produced
5565 when wrapping C++ enum references, as reported by Admire Kandawasvika.
5567 03/21/2005: wsfulton
5568 [Perl] SF #1124490. Fix Perl macro clashes when using Visual Studio's STL string,
5569 so now projects can #include <string>.
5571 03/21/2005: wsfulton
5572 Fixed %varargs which got broken with the recent default argument changes.
5573 Also works for Java and C# for the first time now.
5575 03/17/2005: wuzzeb (John Lenz)
5577 + Fix a whole bunch of bugs in the chicken module. The entire
5578 test suite now compiles, with the exception of the tests that require
5579 std_vector.i, std_deque.i, and so on, which chicken does not have yet.
5581 + Add support for %exception and %typemap(exceptions). Exceptions are
5582 thrown with a call to (abort) and can be handled by (handle-exceptions)
5584 03/15/2005: wsfulton
5585 [Java] Patch from Scott Michel for directors. Modifications to the typemaps
5586 giving users fine control over memory ownership and lifetime of director classes.
5587 Director classes no longer live forever by default as they are now collectable
5590 03/15/2005: wuzzeb (John Lenz)
5591 [Chicken] Add support for adding finalizers garbage collected objects.
5592 Functions that return new objects should be marked with %newobject and
5593 input arguments which consume (or take ownership) of a pointer should
5594 be marked with the DISOWN typemap.
5596 Also add support for correctly checking the number of arguments passed
5597 to a function, and raising an error if the wrong number are passed.
5599 03/14/2005: wuzzeb (John Lenz)
5600 Add --without-alllang option to configure.in, which is the same as
5601 passing all the --without-python --without-perl5 etc... that Matthias added.
5603 03/09/2005: wsfulton
5604 [Php] Memory leak fix for functions returning classes/structs by value.
5606 03/08/2005: wsfulton
5607 [Perl] Fix for Perl incorrectly taking memory ownership for return types that
5608 are typedefs to a struct/class pointer. Reported by Josh Cherry.
5610 03/07/2005: wsfulton
5611 [C#] Various exception changes for the std::vector wrappers. These now more
5612 accurately mirror the same exceptions that System.Collections.ArrayList throw.
5614 03/07/2005: wsfulton
5615 [C#] Fix undefined behaviour after any of the std::vector methods
5618 03/07/2005: wsfulton
5619 [C#] When null is passed for a C++ reference or value parameter, the
5620 exception thrown has been corrected to an ArgumentNullException instead
5621 of NullReferenceException as recommended in the .NET Framework documentation.
5623 The default throws typemaps turn a C++ exception into an ApplicationException,
5624 not a SystemException now.
5626 03/07/2005: wsfulton
5627 [C#] Numerous changes in C# exception handling have been made over the past
5628 few weeks. A summary follows:
5630 The way in which C++ exceptions are mapped to C# exceptions is quite different.
5631 The change is to fix C# exceptions so that the C++ exception stack is correctly
5632 unwound as previously C++ exceptions were being thrown across the C PInvoke layer
5633 into the managed world.
5635 New typemap attributes (canthrow and excode) have been introduced to control the
5636 mapping of C++ to C# exceptions. Essentially a callback into the unmanaged world
5637 is made to set a pending exception. The exception to throw is stored in thread local
5638 storage (so the approach is thread-safe). The typemaps are expected to return
5639 from unmanaged code as soon as the pending exception is set. Any pending exceptions
5640 are checked for and thrown once managed code starts executing. There should
5641 be minimal impact on execution speed during normal behaviour. Full details will be
5642 documented in CSharp.html.
5644 The SWIG_CSharpThrowException() function has been removed and replaced with the
5645 SWIG_CSharpSetPendingExceptionArgument() and SWIG_CSharpSetPendingException()
5646 functions. The original name has been deliberately changed to break old code as
5647 the old approach was somewhat flawed. Any user defined exceptions that follow the
5648 same pattern as the old approach should also be fixed.
5650 Numerous new .NET framework exceptions are now available for easy throwing from
5651 unmanaged code. The complete list is:
5653 ApplicationException, ArithmeticException, DivideByZeroException,
5654 IndexOutOfRangeException, InvalidOperationException, IOException,
5655 NullReferenceException, OutOfMemoryException, OverflowException,
5656 SystemException, ArgumentException, ArgumentNullException and
5657 ArgumentOutOfRangeException.
5659 *** POTENTIAL INCOMPATIBILITY FOR C# MODULE ***
5663 Fix several memory leaks around. Even when we survive knowning
5664 swig is a memory leak factory, it was a little out of
5665 control. To run std_containers.i in the python test-suite,
5666 swig was using ~260MB, now it uses 'only' ~40MB, which is
5667 the same ammount that g++ uses, so, is not that bad.
5668 In the process, I found a couple of extra Deletes, which
5669 in some cases could trigger seg. faults and/or
5672 [python] Better support for directors + exception. More
5673 verbose errors and added an unexpected exception handler.
5675 [python] Fix memory leak for the
5677 std::vector<std::vector<int> >
5679 case,reported by Bo Peng.
5681 [python] Fix SwigPyObject compare problem reporte by
5684 [python] Fix several warnings in the generated code
5685 for gnu-gcc, Intel and VC7.1 compilers.
5688 02/25/2005: wuzzeb (John Lenz)
5689 Update documentation to use CSS and <div> instead of <blockquote>
5690 I used a script to convert the docs, and it set all the box classes
5691 to be "code". There are actually 4 different classes,
5692 "shell", "code", "targetlang", and "diagram". We need to go through
5693 and convert the divs depending on what they contain.
5697 [Python] Added option -nortti to disable the use of native
5698 C++ RTTI with directors (dynamic_cast<> is not used).
5700 Add more code for directors to detect and report errors in
5703 Extend the use of SWIGINTERN whenever is possible.
5705 Remove template warnings reported by VC7.1.
5707 Remove warnings reported by gcc/g++. Finally you can
5710 g++ -W -Wall -c mymodule_wrap.cxx
5712 and no spurious errors will be generated in the wrapper
5715 02/23/2005: wuzzeb (John Lenz)
5716 Added -external-runtime argument. This argument is used to dump
5717 out all the code needed for external access to the runtime system,
5718 and it replaces including the files directly. This change adds
5719 two new virtual functions to the Language class, which are used
5720 to find the language specific runtime code. I also updated
5721 all languages that use the runtime to implement these two functions.
5724 Fix %template + private error SF#1099976.
5728 Fix swigrun.swg warnings reported when using "gcc -W -Wall"
5729 (static/inline not used in front of a function
5730 declaration), and add SWIGUNUSED attribute to avoid
5731 unused warnings elsewhere.
5733 Fix unused variable warnings.
5735 [Python] Use new SWIGUNUSED attribute to avoid warnings in
5738 [Python] Fix PyOS_snprintf for python versions < 2.2 (SF #1104919).
5740 [Python] Fix map/multimap to allow empty maps (reported by
5743 [Docs] Add some documentation to Python.html and
5744 SWIGPlus.html, including for example the fact that
5745 'friends' are now supported.
5747 02/21/2005: wsfulton
5748 [PHP] Patch from Olly Betts, so that wrappers compile with Zend thread safety enabled.
5750 02/17/2005: wsfulton
5751 Memory leak fix in some of the scripting language modules when using default
5752 arguments in constructors. The scripting language was not taking ownership of the
5753 C++ object memory when any of the constructors that use default arguments was called.
5755 02/16/2005: wsfulton
5756 SF #1115055: Failed make install. Patch from Rob Stone.
5758 02/16/2005: wsfulton
5759 [Java] SF #1123416 from Paul Moore. Correct memory allocation for STRINGARRAY
5760 typemaps in various.i.
5762 02/15/2005: wsfulton
5763 Disabled typemap search changes for now (see entry 19/12/2004). It breaks
5764 old typemaps, lengthens the execution time by about 25% and introduces
5767 02/15/2005: wsfulton
5768 swig -help follows other software by printing to stdout instead of stderr now.
5769 swig -version also displays to stdout instead of stderr now.
5770 Behaviour reported by Torsten Landschoff.
5772 02/15/2005: wsfulton
5773 [Ruby] Fix for the less commonly used ordering of %include and #include, so
5774 that the generated code compiles. Bug reported by reported by Max Bowsher.
5780 02/15/2005: wsfulton
5781 [C#, Java] SWIG_exception macro will now return from unmanaged code / native code
5782 as soon as it is called. Fixes possible JVM crashes and other code unexpectedly
5783 being executed. Note SWIG_exception is only occasionally used by SWIG library
5784 writers, and is best avoided by SWIG users.
5786 02/15/2005: wsfulton
5787 [C#, Java] Typemaps can now be targeted at global variable names
5788 and static member variable names. Previously the typemaps for
5789 the setters were ignored, for example:
5791 %typemap(in) int globalint "..."
5794 02/13/2005: mkoeppe (Matthias Koeppe)
5795 [Guile] Add %typecheck for SWIGTYPE, add %typecheck for ptrdiff_t, fix
5796 typemaps for size_t.
5798 [Pike] Merge patch from Torsten Landschoff for improved Pike configuration.
5800 02/12/2005: mkoeppe (Matthias Koeppe)
5801 New configure switches --without-tcl, --without-python etc. allow to
5802 disable the search for installed languages.
5804 01/31/2005: wuzzeb (John Lenz)
5805 - Add DohSortList to DOH
5807 - Improve the runtime type system:
5808 + Speed. Type loading is now O(n log n) instead of O(N^2), which
5809 for large modules is a huge improvement.
5810 + A whole bunch of functions in swigrun.swg no longer need the
5811 swig_type_list_handle passed to them. The only one left is
5812 TypeQuery. This also makes runtime.swg a lot smaller.
5813 + Split up swig_type_info structure into two structures
5814 (swig_type_info and swig_cast_info)
5815 + Store a pointer to a swig_type_info rather than just the type
5816 name string in the linked list of casts. First off, this makes
5817 the guile module a little faster, and second, the
5818 SWIG_TypeClientData() function is faster too.
5819 + Add the idea of a module into the type system. Before, all the
5820 types were stored in one huge linked list. Now, another level is
5821 added, and the type system stores a linked list of modules, each
5822 of which stores an array of types associated with it.
5823 + For more information of how the runtime type system now works,
5824 please see Doc/Manual/typemaps.html and Doc/Devel/runtime.txt
5826 - Update all language modules to use the new type system. The changes
5827 to each language module are minor. All languages are now able to
5828 use runtime.swg for external access to the type system. Before
5829 only python and perl did.
5831 - [guile, mzscheme, ocaml, and php4] These languages opened up the
5832 init function inside the .cxx code, and any code in the .swg files
5833 in the init section was inside this function. This was a problem
5834 for swiginit.swg, which needs to be inserted before the SWIG_init
5835 function is opened. Thus I changed these languages to be like
5836 python or perl, where the init function is declared in the .swg
5839 - [Ruby] Instead of moving the init function to the .swg file, I
5840 added a new section initbeforefunc, and then added
5841 %insert(initbeforefunc) "swiginit.swg"
5843 - [MzScheme] Fix enums and fix Examples/Makefile.in so that if
5844 multiple -I arguments are specified in the INCLUDES variable, each
5847 - [Guile GH] Update Guile GH to use the new type system. See
5848 Doc/Manual/Guile.html for how smobs are now used.
5850 01/11/2005: wsfulton
5851 [C#] New typemap called 'csconstruct'. The code in this typemaps was previously hard
5852 coded and could not be customised by a user. This typemap contains the code that is
5853 generated into a proxy class's constructor.
5855 [Java] New typemap called 'javaconstruct'. The code in this typemaps was previously hard
5856 coded and could not be customised by a user. This typemap contains the code that is
5857 generated into a proxy class's constructor. Another typemap named 'javaconstruct_director'
5858 is used instead when the proxy class is a director class.
5860 [C#, Java] If a C++ class did not have a default constructor, a protected default constructor
5861 was automatically generated by SWIG. This seems is unnecessary and has been removed
5862 and thereby giving the user almost complete control over the generated code along with the
5866 [Disabled, see entry 02/15/2004]
5867 - Fix typemap search, now the "out" typemap search is done as follows
5869 int *Foo::foo(int bar) -> int *Foo::foo(int bar)
5871 -> int *foo(int bar)
5875 then, now you can be more specific, and define
5877 /* apply only for 'Foo::foo' method */
5878 %typemap(out) int * Foo::foo(int *bar) ...;
5880 /* apply for all 'foo' functions/methods */
5881 %typemap(out) int * foo(int *bar) ...;
5891 - More fixes for templates and template default args.
5892 See template_default.i for scary cases that now are
5893 supported, besides the already ugly STL/std cases.
5895 - Cosmetics and more use of 'const' where it was implicit.
5896 - Other fixes for OSS, which is now working again with 1.3.25.
5898 Version 1.3.24 (December 14, 2004)
5899 ==================================
5901 12/12/2004: wuzzeb (John Lenz)
5902 [Chicken] Fix a bunch of bugs relating to -proxy support
5903 + non-class variables now export properly using -proxy
5904 + static member functions now export properly using -proxy
5905 + member class variables now export properly using -proxy
5906 + added a -nounit argument, which does not export the (declare (unit ...))
5907 + correctly install swigclosprefix.scm
5908 + constants (enums, defines) now correcly export when using -proxy
5910 12/11/2004: wsfulton
5911 configure fix for when more than one version of jni_md.h is found
5912 in the Java include directory (was generating lots of sed error
5915 12/08/2004: wsfulton
5916 [Java] Fixes to arrays_java.i so that one can apply the array
5917 typemaps to functions taking pointers as input, eg
5919 %include "arrays_java.i"
5920 %apply int[] {int*};
5923 12/05/2004: wsfulton
5924 [Java] Director mods contributed by Scott Michel. New typemaps
5925 directordisconnect and directordisconnect_derived for the
5926 swigDirectorDisconnect() method. Also fix to get the javapackage
5927 typemap working again.
5930 - Finishing the fixes for templates + default template
5931 args + specializations.
5933 - [Python] Now we use the new templates + default template
5934 args in the std/STL library. That means the internal
5935 swig files are getting uglier since we now support the
5936 original declarations:
5938 template<class _Tp, class _Alloc = std::allocator< _Tp > >
5943 template<class _Key, class _Tp, class _Compare = std::less<_Key >,
5944 class _Alloc = std::allocator<std::pair<const _Key, _Tp > > >
5949 and the user can use the %template directive as
5951 %template() std::vector<int>;
5952 %template() std::vector<int, std::allocator<int> >;
5953 %template() std::vector<int, MyAllocator<int> >;
5955 Now we are closer to the cleaning/rewriting of the
5956 python std/STL support, such that we recover support for
5957 MSVC++ 6.0, and we can add support for other languages
5961 12/02/2004: wsfulton
5962 [Java] Fix for directors when wrapping methods using a member enum
5963 and typesafe/proper enums enabled.
5966 - Fix typemaps to work with templates and default template
5969 template <class A, class B = int>
5973 %typemap(in) Foo<int> *{...}
5974 %typemap(out) Foo<int,int> *{...}
5976 Foo<int> * foo( Foo<int> *f1, Foo<int,int> *f2);
5978 now 'f1', 'f2' and the return value resolve the provided
5981 This is highly needed for proper STL support, see new
5982 std_basic_string.i, std_sstream.i, etc.
5984 - Added std_sstream.i, and fix std_basic_string.i to use
5985 the new typemaps + template def. arg mechanism. Also,
5986 added the needed std_alloc.i. Now, all the containers
5987 can be modified to support std::allocator, like in:
5989 template<class T, class A = std::allocator<T > >
5995 This change is only completed by now for basic_string.
5997 - Fix for smart pointers + members + extensions:
6000 int extension(int i, int j) { return i; }
6001 int extension() { return 1; }
6015 Bar(Foo *f) : f(f) { }
6033 - Other small errors fixes, mostly python.
6035 11/25/2004: wsfulton
6036 [Java] Numerous director bug fixes so that the correct java types
6037 and canonicalized types in the JNI code are emitted. Use of the
6038 $javaclassname special variables in the director typemaps now
6039 consistent with the non-director typemaps. The types used for
6040 typemap lookups are also corrected in a few places. If you
6041 previously had your own director typemaps, ensure they are using the
6044 *** POTENTIAL INCOMPATIBILITY FOR JAVA DIRECTORS ***
6046 11/25/2004: wsfulton
6047 const enum SWIGTYPE & typemaps added. These wrap const enum references
6048 as if they were passed by value. Const enum references thus work the
6049 same as const reference primitive types such as const double &,
6050 const int & etc. Typemaps added for Java, C#, Ruby, Tcl, Perl and Pike.
6052 11/25/2004: wsfulton
6053 [Java, C#] New special variable: $*javaclassname, similar to $javaclassname
6054 and $&javaclassname. The new one removes a pointer from the C type before
6055 obtaining the Java class name. One or more of $javaclassname,
6056 $&javaclassname or $*javaclassname may now appear in a typemap. Likewise for
6057 C# using csclassname instead of javaclassname.
6059 11/25/2004: wsfulton
6060 The last vestiges of enums being handled as integers removed from the
6061 internals. The wrapper methods use the enum type rather than an int
6062 now. The net result is added type safety for enums when handled as
6063 pointers, references etc. Previously in situations such as a method
6064 taking a pointer to an enum, a pointer to an int or a pointer to an
6065 enum of some other type could inadvertantly be passed to the method.
6066 This is now fixed as the descriptor for an enum is no longer based on
6067 an int, but the enum type instead. Anonymous enums are still handled
6070 The consequence for scripting language users in correct usage of enums
6071 should not be noticeable. There is no change for any of the languages
6072 where enums are passed by value - most of the scripting languages will
6073 still accept an integer for an enum value and the strongly typed
6074 languages still use either typesafe enums, integers or proper enums
6075 depending on what the user configures. For Java and C# users a change
6076 in the typewrapper class name has occurred (for enum pointers,
6077 references etc). For example:
6079 enum Numbers { one=1, two };
6080 enum Numbers* number();
6082 In Java and C# this must now be coded as
6084 SWIGTYPE_p_Numbers n = modulename.number();
6088 SWIGTYPE_p_int n = modulename.number();
6090 *** POTENTIAL INCOMPATIBILITY ***
6092 11/21/2004: wsfulton/mmatus
6093 Added missing deprecated warning for %name and remove remaining %name
6094 usage in the SWIG libraries.
6097 - [Python] Adding the PySwigObject to be used for carrying
6098 the instance C/C++ pointers. This is used instead of
6099 string and PyCObjects.
6101 The new PySwigObject is even safer than PyCObject, and
6102 more friendly than plain strings:
6107 <Swig Object at _00691608_p_A>
6115 print "%s 0x%x" % (a.this, a.this)
6116 _00691608_p_A 0x8166900
6118 the last one is very useful when debugging the C/C++
6119 side, since is the pointer value you will usually get
6122 Also, if you have some old code that uses the string
6123 representation "_00691608_p_A", you can use it now again
6124 using 'str(ptr)', or by calling 'str = PyObject_Str(obj)'
6127 This change is mainly for nostalgic swig users that miss
6128 the string representation, but also allows to say again
6130 if a.this == b.this:
6133 and well, since the change were really simple, maybe in
6134 the future we will be able to do
6138 or add native python iteration over native C/C++ arrays,
6139 ie, no need to create/copy new tuples when returning and
6142 Also, a PySwigPacked object was adding to carry a member
6143 method pointer, but this is probably a temporal solution
6144 until a more general object for methods is added.
6146 Be aware that to simplify maintaining and compatibility
6147 with other tools, the old string and PyCObjects
6148 representation could disappear very soon, and the
6149 SWIG_COBJECTS_TYPES or SWIG_NO_OBJECT_TYPES macros will
6150 have no effect at compilation time. Still, the three
6151 mechanisms are present in the code just for testing,
6152 debugging and comparison purposes.
6156 - [Python] Adding back support for using the swig runtime code
6157 inside the user code. We just allow the user to include
6158 the minimal code needed to implement the runtime
6159 mechanism statically, just as in done in the swig
6162 To use the swig runtime code, for example with python,
6163 the user needs include the following:
6165 #include <Python.h> // or using your favorite language
6166 #include <swigrun.swg>
6167 #include <python/pyrun.swg> // or using your favorite language
6168 #include <runtime.swg>
6170 the files swigrun.swg, pyrun.swg and runtime.swg can
6171 be checked out by using swig -co, or they can simply
6172 be found by adding the swig lib directory to the
6173 compiler include directory list, for example
6175 SWIGLIB=`swig -swiglib`
6178 of better, using the CPPFLAGS, but that depends on your
6181 This change can be ported to the other languages too,
6182 you just need to isolate the needed runtime code in
6183 a single file like 'pyrun.swg', and provide the
6184 SWIG_Runtime_GetTypeList() method. Look at the
6185 Lib/python/pyrun.swg file and the Examples/python/swigrun
6189 - Fix mixed_types.i + gcc-3.4, ie, arrays + references +
6192 - Fix multidim arrays + typedefs,ie
6194 typedef char character[1];
6195 typedef character word[64];
6197 - Process protected/private bases in the same way before
6198 we process protected/private members, ie, we check
6199 for constructors, operator new, virtual members, etc.
6201 - Fix Ruby/Java to work (or ignore) multi-inheritance +
6202 directors. Allow other languages to define if it is
6207 SWIG_FEATURES="-directors -dirprot"
6208 make check-ruby-test-suite
6209 make check-python-test-suite
6210 make check-java-test-suite
6211 make check-ocaml-test-suite
6213 and you will get only 'real' errors. ruby and python
6214 compile with no errors, java shows some problems.
6216 Version 1.3.23 (November 11, 2004)
6217 ==================================
6219 11/05/2004: wsfulton
6220 Patch #982753 from Fabrice Salvaire: Adds dependencies generation for
6221 constructing makefiles. New command line options -MF -MD -MMD to work
6222 with the current options -M and -MM. These options are named the same
6223 and work the same as in gcc.
6225 11/05/2004: wsfulton
6226 %ignore/%rename changes for methods with default arguments to mirror
6227 %feature behaviour. See previous entry.
6229 *** POTENTIAL INCOMPATIBILITY ***
6231 11/04/2004: wsfulton
6232 %feature improvements for fine tuning when wrapping methods with
6233 default arguments. Any %feature targeting a method with default arguments
6234 will apply to all the extra overloaded methods that SWIG generates if the
6235 default arguments are specified in the feature. If the default arguments are
6236 not specified in the feature, then the feature will match that exact
6237 wrapper method only and not the extra overloaded methods that SWIG generates.
6240 %feature("except") void hello(int i=0, double d=0.0);
6241 void hello(int i=0, double d=0.0);
6243 will apply the feature to all three wrapper methods, that is:
6245 void hello(int i, double d);
6249 If the default arguments are not specified in the feature:
6251 %feature("except") void hello(int i, double d);
6252 void hello(int i=0, double d=0.0);
6254 then the feature will only apply to this wrapper method:
6256 void hello(int i, double d);
6258 and not these wrapper methods:
6263 This has been introduced to make %feature more powerful to ease the migration
6264 to new default arguments wrapping approach.
6266 *** POTENTIAL INCOMPATIBILITY ***
6268 If you previously had a %feature and didn't specify the default arguments,
6269 you will have to add them in now or you can obtain the original behaviour
6270 by using %feature("compactdefaultargs").
6272 11/04/2004: wsfulton
6273 [C#] Typemaps for std::vector added into std_vector.i. The proxy classes
6274 generated are modelled on the .NET ArrayList class. This isn't quite
6275 ready for general consumption yet, but will work with vectors of primitive
6276 types and some classes.
6278 10/3/2004: wuzzeb (John Lenz)
6279 [GUILE] The -scm interface is now the default. The old GH interface can
6280 still be enabled by passing -gh to SWIG.
6284 - More fixes for namespace + class declarations.
6285 As an extra bonus, we get %template support for static/members class
6286 methods, ie, now you can say:
6292 static void fooT(Y y) { }
6302 %template(foo) space::A::fooT<double>;
6303 %template(foo) space::A::fooT<int>;
6304 %template(foo) space::A::fooT<char>;
6306 %template(bar) B::barT<double>;
6307 %template(bar) B::barT<int>;
6308 %template(bar) B::barT<char>;
6316 note the the methods are emitted inside the classes,
6317 and hence, the %template name refers to the 'member'
6318 method name, not a global namespace name.
6321 - Solve namespace + class declarations, as in
6329 struct foo::Bar : Foo {
6332 see namespace_class.i for more examples.
6334 - Fix %template directive to properly use namespaces,
6339 template <typename T>
6346 typedef Ptr<Obj1> Obj1_ptr;
6347 %template(Obj1_ptr) Ptr<Obj1>;
6353 typedef one::Ptr<Obj2> Obj2_ptr;
6354 %template(Obj2_ptr) one::Ptr<Obj2>;
6357 this is done by using the namespace name 'one' to create
6358 a namespace node to emit the template instantiation,
6359 just as before, but the template parameters are resolved
6360 and qualified in the current namespace ('one' or 'two').
6361 This is same way that typedef works.
6363 This resolve the smart_pointer_namespace2.i case, and at
6364 the same time, several other ones where before swig was
6367 "Can't instantiate template 'xx' inside namespace 'yy'"
6369 error message. In fact, that error doesn't exist
6370 anymore. You can only get an error if you use a bad
6371 namespace name or so.
6374 - [ruby] Directors fixes:
6375 - enums and std::strings are working now (several
6376 reports in bug track system)
6377 - added patch 1025861 for director + exceptions
6379 *** Attention ***: ruby with directors + protected
6380 members work with version 1.7+. Older versions seems to
6381 have a broken signature for'rb_protect'.
6383 If you need to use an old version, look at
6385 http://excruby.sourceforge.net/docs/html/ruby__hacks_8hpp-source.html
6388 - [ruby] Fix memory allocation problem in typemap (bug 1037259)
6390 - [tcl] Fix (enums|constants) + namespace option
6391 (reported by jason.m.surprise@intel.com).
6393 - [perl] Add patch 962168 for multiple inheretance
6395 - Fix 'defined' as variable name.
6397 10/29/2004: wsfulton
6398 Seg fault fix for global scope operator used for friend methods:
6401 friend void ::globalscope();
6406 - Added module and swig option "templatereduce" to force swig
6407 to reduce any type needed with templates, ie, in these cases
6409 %module("templatereduce") test
6411 template <class T> struct A { };
6414 %template(A_Int) A<Int> ==> %template(A_Int) A<int>
6417 %template(A_Bp) A<Bp> ==> %template(A_Bp) A<B*>
6419 swig reduces the types Int and Bp to their primitives
6420 int and B*. This is closer to the usual compiler
6421 resolution mechanism, and it is really needed sometimes
6422 when you mix templates + typedefs + specializations.
6424 Don't use it if you don't have any problem already,
6425 since the type reduction can interfere with some
6426 user typemaps, specially if you defined something like
6429 %typemap(in) Int ...;
6431 in this case, when you use the "templatereduce" option,
6432 swig will ignore the user typemap, since the "typedef int Int"
6433 will take precedence, and the usual "int" typemap will be
6436 Note that the previous case is not common, and should be
6437 avoided, ie, is not recommended to use a typedef and a
6438 typemap at the same time, specially if you are going to
6439 use templates + specializations.
6443 virtual destructor is always emitted now, this doesn't
6444 cause any harm, and could solve some nasty and
6445 mysterious errors, like the one mentioned by Scott.
6447 also the destructor is not in-lined, so, that can solve
6448 some other mysterious errors when mixing directors +
6449 imports + embedded applications + some specific compilers.
6451 10/27/2004: wsfulton
6452 [C#] typemaps.i library file with INPUT, OUTPUT and INOUT typemaps added.
6454 10/27/2004: wsfulton
6455 [Java] std::wstring typemap fixes in std_string.i from Russell Keith-Magee.
6459 - Using + namespace is working now (using_namespace.i).
6461 - Derived + nested classes is working now
6462 (deriver_nested.i), but of course, we are still waiting
6463 for the nested class support.
6466 - unnamed parameters support,
6468 - protected constructor support (automatic and with
6471 - detection of really needed protected declarations
6472 (members and constructors) now is done automatically.
6473 Even if you don't use the 'dirprot' mode, swig will
6474 wrap what is minimally needed (and protected) for the
6477 what is public, as usual, is always wrapped, and if
6478 you use the 'dirport'
6481 - Final fixes for the OSS to compile with SWIG 1.3.23 (my
6482 very very ugly C++ + templates + everything mounters wrap).
6484 10/25/2004: wsfulton
6485 [C#] New commandline option -dllimport. This enables one to specify
6486 the name of the DLL for the DllImport attribute. Normally this name
6487 comes from the module name, so now it is possible to override this:
6489 swig -csharp -dllimport xyz example.i
6491 will generate for all the wrapped PInvoke methods:
6493 [DllImport("xyz", EntryPoint="...")]
6494 public static extern ...
6496 The wrappers from many different SWIG invocations can thus be compiled
6499 A new special variable $dllimport can also be used in typemaps, pragmas,
6500 features etc. This will get translated into the value specified by -dllimport
6501 if specified, otherwise the module name.
6503 10/22/2004: wsfulton
6504 [Java] Patch #1049496 from Scott Michel fixes directors methods with
6505 enums when wrapped with typesafe or proper Java enums.
6507 10/21/2004: wsfulton
6508 Fixes for default arguments in director constructors (Python, Ruby, Ocaml).
6511 - [Python] Add the '-cpluscast' option to enable the 'new'
6512 C++ casting operators, such as 'static_cast', inside the
6513 typemaps. By default swig use the old C cast style, even
6516 - [Python] Add the '-new_vwm' option to enable the new
6517 SwigValueWrapper mode. Now this is mainly for testing
6518 that the typemaps are really safe for any future
6519 solution, but you can use it if you have a very strange
6520 error with default cosntructors missing + %apply +
6521 %typemap, and if everything else fails (see
6522 valuwrapper_opaque.i for alternative and current
6523 solutions). If you are a user that don't know what is
6524 SwigValueWrapper, don't even try it.
6526 - [Python] Add the '-noh' option to be used with directors
6527 and when you prefer to disable the generation of the
6528 director header file. If not used, swig will work as
6529 usual generating both the wrap.cxx and wrap.h files. If
6530 you use it, swig will only generate wrap.cxx.
6532 10/21/2004: wuzzeb (John Lenz)
6533 - If you define SWIG_TYPE_TABLE when compiling a wrapper file,
6534 the runtime types will be stored in the given type table name.
6535 Using this, you can seperate different modules to share their
6536 own type systems. -DSWIG_TYPE_TABLE=Mytable
6538 - [Python] If you define SWIG_STATIC_RUNTIME then the type information
6539 will be static to this wrapper. Nothing will be shared with any
6542 - [Python] If you define SWIG_LINK_RUNTIME, then instead of using
6543 the new way of sharing type information, the wrapper will expect
6544 to be linked against the Lib/linkruntime.c file. Any modules compiled
6545 with SWIG_LINK_RUNTIME and linked against linkruntime.c will all
6546 share type information.
6549 - [Python] Initial fix for python/import example. Please
6550 update the Makefile (autoconf, configure, etc, expert),
6551 since now probably is only working with g++, icc and a
6552 few other compilers that have the -shared option.
6554 We need to create additional shared libraries for the
6555 virtual destructors. Old and usually forgotten C++
6558 Same fix need to be used in perl, I think.
6560 - [Python] Fix generation of header file for directors,
6561 now directors.swg is also included, so, it can be really
6562 used from C++, and it solves some problem with compiler
6563 that require that, even with the simple swig inclusion.
6565 - [Python] Reordering the methods and moving some bodies
6566 outside the class declaration. This is needed due to
6567 some gcc-2.96 internal compiler errors. It seems the
6568 PYTHON class is getting too large to been declared and
6569 defined at the same time.
6571 - Add the -oh option to change the output header file name
6574 swig -c++ -python test.i -o test.CC -oh test.HH
6576 this is mainly needed when using directors, and if the
6577 current default header file name is not good for you,
6578 which is generated as follow:
6580 swig -c++ -python test.i => test_wrap.h
6581 swig -c++ -python test.i -o test.CC => test.h
6584 10/20/2004: wsfulton
6585 1) Compact default arguments feature added. This feature allows one
6586 to use the default argument code generation that was used in
6587 SWIG-1.3.22 and earlier versions. It produces more compact wrappers
6588 as only one wrapper method is generated for any method with default
6589 arguments. So the advantage is it generates less code but has the
6590 original limitations, like it it does not work with all default arguments
6591 and default arguments cannot be taken advantage of in the strongly typed
6592 languages (C# and Java). It is implemented via the usual %feature mechanism:
6594 %feature("compactdefaultargs");
6596 2) Keyword arguments (kwargs) are working again for default arguments
6597 in the languages that support it, ie, Python and Ruby. The new default
6598 argument wrapping approach using overloaded methods cannot support kwargs
6599 so the compact default argument feature is automatically turned on when
6600 kwargs are specified, by %feature("kwargs").
6602 3) Compact default arguments are also automatically turned on when wrapping
6603 C (not C++) code. This is to support the bizarre notion of default arguments
6606 10/20/2004: wsfulton
6607 Overloaded templated functions in namespaces also working now.
6608 Templated functions with default arguments in namespaces too.
6612 - Allow to disable the new SwigValueWrapper mechanism,
6613 if you add the following line in your language main.
6615 /* Turn on safe value wrapper use mode */
6616 Swig_value_wrapper_mode(1);
6619 Now is only active in python. All the other languages
6620 are using the old resolution, but they can also use the
6621 "valuewrapper"/"novaluewrapper" features to fix some
6622 of the old broken cases. Note, however, that not all
6623 the broken cases can be solved in that way.
6625 The new mechanism seems to be working fine in perl, ruby
6626 and tcl, but failing in some typemaps in java.
6628 Hence, is upto the language maintainer to test it, and
6629 decide to enable it or not.
6631 Look at the valuewrapper_opaque.i for examples.
6633 - Fix more SwigValueWrapper cases when the new mechanism
6634 is active. Now it also check for local typemap
6635 variables, see valuewrapper_opaque.i for an example when
6636 this is needed. But again, this extra checking will only
6637 be activated when using the new value wrapper mode.
6639 - [Python] Fix variable wrapping of classes with private
6640 assign operators. It should be easy to fix in all the
6641 other modules, instead of checking
6643 if (!Getattr(n,"immutable")) ...
6647 if (is_assignable(n)) ...
6649 Look at the private_assign.i for an example.
6652 - %features "director"/"nodirector" now work as expected.
6653 - General fixes in %feature to resolve function decl
6656 %feature("hello") foo();
6657 char foo() -> f() // was working
6658 char *foo() -> f().p // it wasn't
6661 - Template + specialization + default template args now is
6662 working, (don't confuse with template + default arg
6663 values, that was solved before), now this ugly case is
6666 template <class T, class A = Alloc<T> >
6673 struct Vector<double>
6676 int foo() { return 0; }
6679 %template(V_c) Vector<char, Alloc<char> >;
6680 %template(V_i) Vector<int>; // picks Vector<int,Alloc<int> >
6681 %template(V_d) Vector<double>; // picks the specialization
6683 this is needed for automatic STL support (later will
6686 - Fix the template + typedef errors in test-suite, which
6687 probably will fix another group of strange template +
6688 namespaces + typedefs errors.
6690 - %warnfilter is working better now, parser.y tries to use
6693 - **** New default type resolution method (stype.c) *****
6695 It preserves the original mixed types, then it goes
6696 'backward' first deleting the qualifier, then the inner
6701 r.q(const).Aptr -> r.q(const).p.SWIGTYPE
6702 r.q(const).p.SWIGTYPE -> r.p.SWIGTYPE
6703 r.p.SWIGTYPE -> r.SWIGTYPE
6704 r.SWIGTYPE -> SWIGTYPE
6708 r.q(const).Hello -> r.q(const).enum SWIGTYPE
6709 r.q(const).enum SWIGTYPE -> r.enum SWIGTYPE
6710 r.enum SWIGTYPE -> r.SWIGTYPE
6711 r.SWIGTYPE -> SWIGTYPE
6714 a(2).a(4).int -> a(ANY).a(ANY).SWIGTYPE
6715 a(ANY).a(ANY).SWIGTYPE -> a(ANY).a().SWIGTYPE
6716 a(ANY).a().SWIGTYPE -> a(ANY).p.SWIGTYPE
6717 a(ANY).p.SWIGTYPE -> a(ANY).SWIGTYPE
6718 a(ANY).SWIGTYPE -> a().SWIGTYPE
6719 a().SWIGTYPE -> p.SWIGTYPE
6720 p.SWIGTYPE -> SWIGTYPE
6722 before it always stops after finding ref/pointer/enum/array/etc.
6724 Now, then, you can define (use and apply) 'higher' typemaps such as:
6726 %typemap(in) SWIGTYPE* const&
6727 %typemap(out) char FIXSIZE[ANY]
6728 %typemap(in) SWIGTYPE* const&
6729 %typemap(in) const enum SWIGTYPE&
6730 %typemap(in) SWIGTYPE[ANY][ANY]
6731 %typemap(in) const char (&)[ANY]
6733 It is possible with this change that previous typemaps
6734 that were defined (but ignored), now will start to work.
6736 Also, it is necessary check for the '%typemap(varin) SWIGTYPE[]',
6737 before it was usually not defined (but char[] was),
6738 and that can produce some inconsistencies.
6740 *** POTENTIAL INCOMPATIBILITY ***
6742 This change was needed for STL, since std::vector<enum Hello>
6743 std::vector<A*>, etc, will always generate methods that
6744 mix const references with the vector type.
6746 Now that is working, all the std::container<T*>
6747 specialization will not be needed anymore, well, in
6750 In the practice, everythin is working as before until
6751 the proper mixed types are defined and the libraries
6752 simplified to use them.
6754 - Change the behavior of extern "java"/"fortran"/"etc",
6755 now swig produces a warning, and use extern "C" instead.
6756 The warning can also be disable with the "-w 313" flag.
6757 (WARN_PARSE_UNDEFINED_EXTERN).
6759 - SwigValueWrapper is now more selective (lang.cxx).
6762 - Fix some typemaps (perl/tcl) to work properly with
6763 SwigValueWrapper. This was not a problem with
6764 SwigValueWrapper, but with the typemaps that now are
6765 safe to use with %apply.
6769 - Fix %callback/%pythoncallback work now as before after
6770 the def args changes. Also, %callback now is an alias
6771 for %pythoncallback, so, they do the same.
6774 - %callback is more usable and uniform:
6776 %callback("%s_cb") foo(); // for both, python/ruby
6777 %callback("%s_cb"); // for both, python/ruby
6778 %callback(1) foo(); // only in python.
6782 - Tweak to enum typing for soundness in the presence of multiple
6784 - global functions are now unambiguous in multiple loaded modules.
6785 - Fixed test case code to build multimodule test cases correctly.
6786 - There is no way to share overload resolution across modules
6787 because of soundness issues. If the user wants to call some
6788 function foo from an arbitrary module bar, they will have to
6789 use Bar._foo to call it correctly. Later I will fix the
6790 camlp4 module to do something clever in this case.
6791 - Promided performance overhaul of class mechanism.
6792 - Removed symbol hack for ocaml-3.07 and below which is not needed
6793 for ocaml-3.08 and above.
6795 10/16/2004: wuzzeb (John Lenz)
6797 - Completly change how chicken.cxx handles CLOS and generic code.
6798 chicken no longer exports -clos.scm and -generic.scm. The clos
6799 code is exported directly into the module.scm file if -proxy is passed.
6800 - The code now always exports a unit. Running the test-suite is now
6801 majorly broken, and needs to be fixed.
6802 - CLOS now generates virtual slots for member variables similar to how
6803 GOOPS support works in the guile module.
6804 - chicken no longer prefixes symbols by the module name, and no longer
6805 forces all names to lower case. It now has -useclassprefix and -closprefix
6806 similar to how guile handles GOOPS names.
6808 10/16/2004: wsfulton
6809 Templated functions with default arguments working with new default argument
6810 wrapping approach. The new approach no longer fails with the following default
6811 argument pattern (previously failed with some primitive types, like
6812 unsigned primitive types):
6814 template<typename T> int foo(const T& u = T());
6815 %template(foo) foo<unsigned int>;
6817 This relies on the templated function overloading support just added, so all
6818 the combinations of overloading by template parameters and normal parameters
6819 as well as overloading with default parameters works.
6821 10/16/2004: wsfulton
6822 Added support for the large range of templated function overloading that C++
6825 - Overloaded templated functions, eg
6827 template<typename T> int overload(T t);
6828 template<typename T> int overload(T t, const T &r);
6830 - Fixes where the templated type is not used in the parameter list, eg
6832 template<typename T> void xyz();
6833 template<> void xyz<double>();
6835 - Fixes for overloading of plain functions by a templated function:
6838 template<typename T> void abc(T t);
6840 - Overloading by templated parameters fixed:
6842 template<typename T> void foo(T t) {}
6843 template<typename T, typename U> void foo(T t, U u) {}
6845 %template(foo) foo<double, double>;
6847 - All combinations of the above also working including specializations, eg:
6850 template<typename T> void abc(T t);
6851 template<> void abc<double>(double t);
6852 template<> void abc(int t);
6854 10/16/2004: wuzzeb (John Lenz)
6855 - Remove the ability to share type information by using c linking.
6856 All type sharing happens through a global variable in the target language.
6857 + Remove SWIG_NOIMPORT, SWIG_RUNTIME, and related defines.
6858 + Depreciate -runtime, -noruntime command line options
6859 + Update test-suite common.mk to correctly build multicpptest
6860 + Remove reference to precommon.swg
6861 + Update the guile_gh interface to share data by a global var instead
6864 - Remove Advanced.html, since everything in it is now obsolete
6867 - Split the python std/STL C++ library files, now
6868 all the language independent definitions are under
6873 and hence, can be used from other languages.
6875 - Add more documentation to the Python STL, and
6876 clean unnecessary code.
6878 - Add initial C99 complex support, and some fixes
6882 - Fix the SwigValueWrapper for opaque types, now it is
6883 applied for opaque templates and classes, for which we
6884 don't know if there is or not a default constructor, ie
6890 Still, if you know that you class has a default
6891 constructor, and for some very very particular reason
6892 you want to avoid the SwigValueWrapper, and you don't
6893 want or can't expose the class to swig, now you can
6896 %feature("novaluewrapper") A;
6899 or the other way around, if the class has a default
6900 constructor, but you want to use the value wrapper, you
6903 %feature("valuewrapper") A;
6909 - Fix for char > 128, ie
6911 const char tilde_a = '\341';
6913 - Add patch 1041858 for $lextype, which carries the
6914 literal type of a symbol. See lextype.i in the
6915 test-suite for more details.
6920 10/07/2004: wsfulton
6921 {Ruby, Java] Fix director + 'empty' throws
6925 virtual ~A() throw();
6930 10/06/2004: wuzzeb (John Lenz)
6932 - Fix bug reported by William A. Hoffman propagating clientdata
6933 between modules. Added clientdata_prop.multicpptest to check for
6934 this bug. The fix involved the following changes:
6935 + SwigType_clientdata_collect does not need to check
6936 types in r_resolved because we only want to propagate clientdata
6937 to typedefed classes, and r_mangled already takes care of typedefs.
6939 + SWIG_TypeRegister now copies the clientdata field correctly
6941 + Move SWIG_Guile_PropagateClientData function from guile module
6942 into common.swg, because we need to call it from both guile and tcl.
6944 + Add base_names to swig_class to delay the lookup of bases. SWIG
6945 now exports the base names and only when the base swig_class is
6946 needed is SWIG_TypeQuery(name)->clientdata looked up.
6948 - conversion_ns_template testsuite test was failing because
6949 the name of the wrapped constructor function was not calculated
6950 correctly for structs. Fixed.
6952 10/06/2004: wsfulton
6953 Fixes for default arguments used in directors - in virtual
6954 methods and director constructors.
6957 Fix the __cplusplus macro, and bug 1041170.
6958 Now it is working as supposed, ie, you can safely use
6963 all over swig, including inside %defines and %{ %} bodies.
6966 *** POTENTIAL INCOMPATIBILITY ***
6968 The old trick of using
6972 doesn't work any more. So, if you have your own typemaps
6973 using that syntax, you will need to migrate them to use
6974 "#ifdef __cplusplus".
6976 10/05/2004: wuzzeb (John Lenz)
6977 - Reorganize how runtime type information is stored and shared
6978 between modules. For chicken and mzscheme, I removed
6979 the ability to use runtime libraries, while perl, tcl, python, and
6980 ruby default to using the new method but can go back to the old
6981 method by declaring SWIG_ALLOW_RUNTIME.
6983 - line 582 in mzscheme.cxx was generating a segfault on
6984 imports.multicpptest, so I fixed it.
6986 10/05/2004: wsfulton
6987 Fixes for %extend and overloaded static methods with default
6991 - [python] Fix director + method with 'empty' throw, ie
6994 virtual int foo() throw();
6997 other languages should also easy to fix, look for
6998 Getattr(n,"throw") in python.cxx.
7000 - Fix director + destructor with 'empty' throw
7003 virtual ~A() throw();
7006 - Now SWIG_FEATURES parse all and the same options you
7007 can pass to swig in the command line.
7009 - New command line flag: -features <list>, as in
7011 swig -features autodoc=3,director
7013 ie, any global feature can be initialized from the
7014 command line. This is mainly for testing, but users
7015 can also take advantage of it.
7018 - Properly qualify type in syntax as 'long(2)' or 'Foo()',
7019 this solve old problem with default args, and probably
7020 other problems around. However, the default arg problem
7021 was also already solved by William (see bellow).
7023 - Fix feature_set and feature_get methods. Before
7024 they look from particular to general and keep the first
7025 feature found. This didn't work well with templates.
7026 Now the methods look from general to particular, and
7027 override any found feature.
7029 - Previously a feature could not be applied to constructors
7030 or destructors that weren't explicitly declared in the class.
7031 This is now fixed, for example:
7033 %feature("featurename") Foo() "..."
7034 %feature("featurename") ~Foo() "..."
7036 // implicit Foo() and ~Foo()
7039 - Fix missing features for default const/dest, by really
7040 'creating' the methods and applying the features.
7042 - Fix return_const_value.i case by adding SwigValueWrapper<const T>
7045 - Fix %extend + overload, including overloading actual
7048 - Adding more cases in related files in the test-suite.
7050 10/04/2004: wsfulton
7051 Changes to the way default arguments are wrapped. Previously a single
7052 method was generated for each method that had default arguments. If
7053 a method had 5 arguments, say, of which 1 had a default argument
7054 then the call to the wrapped method would pass 5 arguments. The default
7055 value was copied into the wrapper method and used if the scripting
7056 language passed just 4 arguments. However, this was flawed as the
7057 default argument sometimes does not have global access, for example
7058 SWIG would generate code that couldn't compile when wrapping:
7062 void foo(int val = privatevalue);
7063 void bar(int val = Tricky::getDefault());
7065 static int getDefault();
7066 enum { privatevalue = 200 };
7069 Also bugs in resolving symbols generated code that wouldn't compile, for example
7070 (probably fixable though):
7075 Klass constructorcall(const Klass& k = Klass());
7078 The approach also does not work for statically typed languages (C# and Java)
7079 as these languages do not allow methods to have variable number of arguments.
7080 Although C# has a mechanism to pass a variable number of arguments they
7081 must be of the same type and are more like varargs.
7083 The new approach solves the above problems and wraps methods with default
7084 arguments as if the method was overloaded. So SWIG will now treat
7086 void foo(int val=0);
7088 as if it had parsed:
7093 The code generated is then exactly the same as if SWIG had parsed the two
7094 overloaded methods. The scripting languages count the arguments passed and call
7095 the appropriate method, just like overloaded methods. C# and Java are now able
7096 to properly wrap methods with default arguments by generating extra methods,
7097 again as if the method was overloaded, so for:
7099 void bar(string s="hello", double d=10.0, int i=0);
7101 the following proxy methods are generated:
7103 void bar(string s, double d, int i);
7104 void bar(string s, double d);
7108 The new approach comes with a couple of minor knock on effects.
7110 1) SWIG support for default arguments for C (not C++) code no longer works.
7111 Previously you could have this interface:
7116 void foo(int val=0);
7118 and call the wrapped method from a scripting language and pass no arguments
7119 whereupon the default of 0 was used. You can get the same behaviour for C
7120 code by using the "default" typemap:
7122 %typemap(default) int val "$1 = 0;";
7128 or you could of course compile your code as C++ if you want C++ features :) :
7131 void foo(int val=0);
7133 void foo(int val=0);
7135 A couple of SWIG's libraries used this C extension and these have been modified
7136 to use the "default" typemap. The "default" typemap is thus unchanged (and still
7137 is not and is not fully supported by C# and Java, and is likely to remain so).
7140 2) All features (%feature, %rename, %ignore etc) no longer work as if the method
7141 with default arguments is just one method. For example, previously
7145 would have ignored the method completely. Now it will only ignore foo(int) but
7146 not the extra foo() method. Instead use:
7150 to ignore them all. or
7155 This of course allows one to fine tune the wrapping, for example one could use:
7157 %rename(fooint) foo(int);
7158 %rename(foodefaults) foo();
7159 void foo(int val=0);
7161 and call them from any language like so:
7166 or for example ignore the extra overloaded method, so the defaults cannot be used:
7169 void foo(int val=0);
7171 *** POTENTIAL INCOMPATIBILITY ***
7175 - More cleaning up and uniformation on the Python Lib
7177 - Added Robin's docstring patch, plus some fixes, plus
7178 some extensions, see autodoc.i example in the test-suite,
7179 and try using %feature("autodoc","extended").
7181 This patch is not a complete solution for the
7182 documentation problem, just enough to inform python about
7185 The expected swig documentation support is far far away yet.
7189 - Fix the %callback feature (only used in ruby and python examples,
7190 by now, but it should be generic), now member callbacks
7193 - Fix wrapping of functions pointers like
7195 std::ostream& std::endl(std::ostream&);
7197 ie, the ones that return references or enums.
7199 [Python] Add the %pythoncallback directive, which is
7200 an improved version of %callback, ie,
7202 %pythoncallback(1) foo;
7203 %pythoncallback(1) A::bar;
7204 %pythoncallback(1) A::barm;
7212 static int bar(int a);
7217 int foobar(int a, int (*pf)(int a));
7219 in python you can use
7226 ie, no additional pointer elements are created, and
7227 the original 'foo' and 'A.bar' can be used as parameters.
7229 In the case of member fucntion however, still you need
7230 to use the special variable Class::<fnc_name>_cb_ptr, ie:
7232 foobarm(3, a, A.barm_cb_ptr)
7234 we will try to fix this situation also, but later.
7236 [Python] Add more elements from the STL library, now
7240 std.cout << "hello " << 123 << std.endl
7242 [Python] Fix in/out return mechanism, now swig will behave
7243 as 1.3.21 but using a python list when needed. The problem
7244 is that the types std::pair,std::vector,etc, use tuples,
7245 and they interfer with the previous inout tuple type.
7247 By using lists we solve the conflicts, swig acts as before,
7248 but returns a list when more than one parameter are using
7249 the OUT typemap. See the new inout.i example in the
7252 *** POTENTIAL INCOMPATIBILITY FOR PYTHON MODULE ***
7254 [Python] Much better error messages for bad arguments, now
7255 you always get the argument number where the error occurred.
7257 09/27/2004: wsfulton
7258 Patch from Bill Clarke -
7259 1) Warning emitted when -importall and -includeall is used together,
7260 with -includeall taking precedence.
7261 2) Ensure SWIGIMPORTED is always defined when a file is being
7262 imported with %import. Note that this is not the same as SWIGIMPORT,
7263 which gets defined in all generated wrapper files.
7267 - add %feature("exceptionclass") to identify a class used
7268 as exception. Before swig identified and marked a class
7269 using the "cplus:exceptionclass" attribute. However, the
7270 class needed to appear on an throw() statement. Now
7271 swig keeps trying to identify the exception classes, as
7272 before, but it also allows the user to mark a class by
7273 using the %feature explicitly. (mostly relevant for
7278 - fix -modern option + exceptions, which mix old class
7279 style with the new one. So, we always need to emit
7280 the "nonmodern" python code.
7282 - add the "python:nondynamic" feature and its handler
7286 %pythonnondynamic(1) A;
7293 then, in the python side
7299 aa.c = 3 # error, the class can not be extended dynamically.
7302 Since this is a feature, you can use
7304 %pythonnondynamic(1);
7308 %pythondynamic(0); [ Note: %pythondynamic since deprecated ]
7310 to force all the wrapped classes to be "nondynamic" ones.
7312 The default, as in regular python, is that all the wrapped
7313 classes are dynamics. So, careful with your spelling.
7316 - Support the -I- option.
7318 - Differentiate between %include <file> and %include "file".
7319 This fix several corner cases.
7322 [Python] Several patches:
7324 - Normalize the Lib file names:
7325 *.swg internal files,
7328 - Fix Char[ANY] typemaps, so they also delete any extra '\0' chars,
7329 now they behave as before (1.3.21). Still, you can use
7330 the SWIG_PRESERVE_CARRAY_SIZE macro if you need to
7331 preserve the original size (see pystrbase.swg).
7333 - Add the Char FIXSIZE[ANY] typemaps, to preserve the
7334 original C array sizes (see above). Though, you can't
7335 use them yet since %apply and arrays are not working
7338 - Add pyfragments.swg, now the user can add fragments
7339 to override the default ones.
7341 09/10/2004: wsfulton
7342 Patch from Bill Clarke which fixes spurious preprocessor bug which
7343 shows on Solaris and gcc, eg:
7344 Warning(202): Could not evaluate '!defined(SWIGJAVA) &&
7345 !(defined(SWIGCSHARP)'
7346 Also fixes a bug where '#if "a" == "b" == 1' wouldn't have worked
7348 09/10/2004: wsfulton
7349 Restored multiple build directories for the test-suite. Patch from
7352 09/06/2004: wsfulton
7353 Added the missing runtime.dsp Visual Studio project files for the
7354 import examples to work.
7357 Version 1.3.22 (September 4, 2004)
7358 ==================================
7360 09/03/2004: wsfulton
7361 The swig.m4 macro for use with the Autoconf/Automake/Libtool has
7362 been removed and is no longer installed. Please use the new and better
7363 maintained version derived from swig.m4 in the Autoconf macro archive.
7364 See http://www.gnu.org/software/ac-archive/htmldoc/ac_pkg_swig.html and
7365 http://www.gnu.org/software/ac-archive/htmldoc/ac_python_devel.html.
7367 09/01/2004: wsfulton
7368 [Perl] Applied patch #1019669 from Christoph Flamm. Adds support
7369 for %feature("shadow") in the same way as it works in Python. This
7370 enables one to override the generated shadow/proxy methods, including
7371 constructors and destructors. For example:
7373 /* Let's make the constructor of the class Square more verbose */
7375 %feature("shadow") Square(double w)
7379 my $self = examplec::new_Square(@_);
7380 print STDERR "Constructed an @{[ref($self)]}\n";
7381 bless $self, $pkg if defined($self);
7392 [Python] Incompatibility reported by Bill Clarke (llib@computer.org):
7394 If you are using Sun Studio 8 (and possibly earlier
7395 versions) to compile the output produced by swig
7396 1.3.22rc1, and you are using C++ and STL templates then
7397 you need to use either "-runtime" or "-noruntime". If you
7398 use neither of these options then you will probably get
7399 compiler errors when trying to compile the wrapper file;
7400 the error message will be like this: The name
7401 SWIG_Python_ConvertPtr[...] is unusable in static
7402 swigpy::traits_asptr[...] If you get this error message,
7403 you need to regenerate your wrapper file using 'swig
7404 -runtime' or 'swig -noruntime'.
7406 You shouldn't get this problem with Sun Studio 9.
7408 *** POTENTIAL INCOMPATIBILITY FOR PYTHON MODULE ***
7410 08/26/2004: wsfulton
7411 [Perl] Applied #932333 from Ikegami Tsutomu. Fixes long long *OUTPUT
7412 and unsigned long long *OUTPUT typemaps in typemaps.i.
7414 08/26/2004: wsfulton
7415 Applied patch #857344 from Art Yerkes. Workaround for autoconf bug when
7416 running 'make install'.
7418 08/26/2004: wsfulton
7419 [Perl] Part of patch #982753 applied. This implements a %perlcode directive.
7420 It allows one to add Perl code to the generated .pm file. Works the same
7423 08/26/2004: wsfulton
7424 [Java] Fix for directors when wrapping virtual methods with exception
7425 specifications that were not simple types. Previously code was generated that
7426 didn't compile, for example when the exception specification was a pointer.
7428 08/25/2004: wsfulton
7429 [C#] Typemap fix for methods that return char *. The CLR would incorrectly
7430 delete the memory pointed to by char *. Also applied the same correction to
7431 the char array typemaps.
7433 08/24/2004: wsfulton
7434 Fixes for -fmicrosoft error/warning message display:
7435 - End of file (EOF) warning messages not displaying in correct format
7436 - Some messages containing a file path were displaying a double backslash
7437 instead of a single backslash
7439 08/23/2004: wsfulton
7440 Applied patch #1011604 submitted by Charles Schwieters. Fix for 64 bit tcl
7443 08/23/2004: wsfulton
7444 Fix for bug #875583 - enum forward declarations previously gave a syntax error.
7447 [Allegro CL] Use typemaps "ffitype" and "lisptype" to determine the FFI type
7448 specifiers from the C type. This makes it possible, for instance, to control
7449 whether a C "char" argument takes a Lisp character or a Lisp integer value.
7450 The default (taking Lisp characters) is done by these built-in typemaps:
7451 %typemap(ffitype) char ":char"; %typemap(lisptype) char "character";
7452 If char means an integer instead, use these typemaps:
7453 %typemap(ffitype) char ":char"; %typemap(lisptype) char "integer";
7455 08/22/2004: wsfulton
7456 As discussed in bug #772453, the SWIG library directory is now installed
7457 into a different default directory. The library used to be installed to
7458 /usr/local/lib/swig1.3. It is now in the more usual architecture independent
7459 directory and I have additionally used a version specific subdirectory as
7460 the library will rarely work with older versions of SWIG. This release
7461 will thus use /usr/local/share/swig/1.3.22 by default, which can be
7462 tailored as before using './configure --swiglibdir'.
7465 [MzScheme] Add support to create native MzScheme structures from C structures.
7466 To convert a C structure to an MzScheme structure, use the new runtime macro
7467 SWIG_NewStructFromPtr in a typemap. Patch from Dmitriy Zavin.
7469 08/12/2004: wsfulton
7470 Patch #837715 from Ben Reser to correctly detect Python lib directory
7473 08/12/2004: wsfulton
7474 [C# and Java] Prevent memory leaks in the case of early return
7475 from wrapper methods using const std::string & parameters. Modified
7476 Mark Traudt patch #951565.
7478 08/12/2004: wsfulton
7479 Bug #943783 with patch fixes php char * out typemap NULL values.
7481 08/03/2004: Ahmon Dancy <dancy@dancy>
7483 [allegrocl] Additional case mode fixes. Also, make sure
7484 foreign types are exported.
7487 [Guile] In -scm mode, SWIG modules now exchange their pointer type
7488 information via the Guile interpreter. It is no longer necessary to build a
7489 runtime library or to use -noruntime and -runtime etc.
7491 The module (Swig swigrun) which was introduced in the change of 05/17/2004 is
7492 no longer automatically built. If you need it, run SWIG on the interface file
7495 07/23/2004: wsfulton
7496 [C#] Bug #917601 Mapping C++ bool fix from Mark Traudt
7498 07/23/2004: wsfulton
7499 RPM fixes for latest CVS version including removal of runtime
7502 07/23/2004: wsfulton
7503 Patch #908955 from Robert H De Vries.
7504 RPM file generation fix for Fedore Core 1 and Redhat AS2.1.
7506 07/12/2004: wsfulton
7507 Patch #864689 from Robin Dunn:
7509 This patch corrects two problems in the XML output of SWIG:
7511 1. There were often extra '/>\n' in the output.
7513 2. value attributes were output with '\n' in them but
7514 since that is not technically legal most (all?) XML
7515 parsers will strip them out. Replacing the '\n' with
7516 the ' ' entity reference solves this as that is
7517 legal and XML parsers will convert it to a '\n' when
7518 reading the values back in.
7520 This patch also adds a new global command line option
7521 that will allow the parse tree to be written out in XML
7522 *after* some other language module has been run, in
7523 order to be able to get extra info that the language
7524 module puts in the tree. In this way the XML is a
7525 post-processed version of the tree rather than a
7526 pre-processed version.
7528 Command line option is -dump_xml or -xmlout <file>
7530 07/12/2004: wsfulton
7531 [Java] Patch from Scott Michel to fix typesafe enums and proper enums
7534 07/12/2004: wsfulton
7535 HTML documentation (makechap.py) file generator missing end of line
7536 patch #908951 from Robert de Vries.
7538 07/08/2004: wsfulton
7539 The deprecated runtime library build has been removed. This also removes
7540 the dependency on Libtool. Libtool is no longer required to build SWIG.
7541 The associated -ldflags SWIG commandline option has also been removed.
7543 The examples and test-suite testcases that used the runtime library have
7544 been updated to use the replacement approach to using SWIG across
7545 multiple modules, that is they use the -noruntime and -runtime commandline
7546 options, see Modules.html. Effectively they build their own runtime
7547 libraries using -runtime. The examples are import and import_template.
7548 The test cases are in the imports and template_typedef_import directories.
7550 Anyone who wants the original runtime libraries can either run the test-suite
7551 or build the examples and use the appropriate shared object/DLL that is
7552 generated with the -runtime commandline option. For example libimports_runtime.so
7553 (Python calls it lib_imports_runtime.so) is generated after running the
7554 'make imports.multicpptest' testcase in the Examples/test-suite/<lang>
7555 directory. Or use libruntime.so / runtime.dll after building the import
7556 examples in Examples/<lang>/import.
7559 [Allegro CL] Convert character and string literals in constants to
7560 CL syntax. Fix FF:DEF-FOREIGN-CALL for mixed-case C functions.
7562 06/27/2004: wsfulton
7563 [Java] New feature for Java exceptions with format %javaexception(exceptionclasses).
7564 This feature is a slight enhancement to %exception and the only difference is the
7565 addition of the exception classes which are generated into a throws clause.
7566 The 'exceptionclasses' is a comma separated list of classes which will be
7567 added to the associated proxy method's throws clause. The 'exceptionclasses'
7568 are specified like the exception classes in the 'throws' attribute in the
7569 typemaps. This feature should be used for correctly handling checked exceptions
7570 thrown from JNI code. For example:
7572 %javaexception("java.lang.Exception") throwException %{
7573 ... convert a std::logic_error into a java.lang.Exception using JNI code ...
7576 #include <stdexcept>
7577 void throwException() {
7578 throw std::logic_error("Logic error!");
7581 will generate a method with a throws clause in the module class:
7583 public static void throwException() throws java.lang.Exception { ... }
7585 06/27/2004: wsfulton
7586 [C#] New %csconstvalue(value) feature directive for use with constants and
7587 enums. This works the same way as %javaconstvalue. For C#, this directive
7588 is the only way that one can fix wrapping of C/C++ enums with proper C#
7589 enums if the enum item's initialiser cannot compile as C# code. This is
7590 because Java enums can use a call into C code to initialise the enum item,
7591 whereas in C#, the enum value must be a compile time constant. That is,
7592 using %csconst(0) cannot be used in C# to initialise the C# enum item via
7595 06/27/2004: wsfulton
7596 [Java] New %javaconstvalue(value) feature directive for use with constants and
7597 enums. Sometimes the use of %javaconst(1) will produce code that won't compile
7598 under Java. If a compile time constant is required, %javaconst(0) is not an
7599 option. The %javaconstvalue directive achieves this goal and the value specified
7600 is generated as Java code to initialise the constant. For example:
7603 %javaconstvalue(1000) BIG;
7604 %javaconstvalue("new java.math.BigInteger(\"2000\")") LARGE;
7605 %javaconstvalue(10) bar;
7611 #define LARGE 2000ULL
7612 enum Foo { BAR = ::bar };
7617 public interface exampleConstants {
7618 public final static long BIG = 1000;
7619 public final static java.math.BigInteger LARGE = new java.math.BigInteger("2000");
7621 public final class Foo {
7622 public final static Foo BAR = new Foo("BAR", 10);
7626 Previously, none of BIG, LARGE or BAR would have produced compileable code
7627 when using %javaconst(1).
7629 06/27/2004: wsfulton
7630 %feature enhancements. Features can now take an unlimited number of attributes
7631 in addition to the feature name and feature value. The attributes are optional
7632 and are much the same as the typemap attributes. For example, the following
7633 specifies two optional attributes, attrib1 and attrib2:
7635 %feature(featurename, attrib1="attribval1", attrib2="attribval2") name "val";
7636 %feature(featurename, val, attrib1="attribval1", attrib2="attribval2") name;
7638 06/27/2004: wsfulton
7639 %feature improvements for the syntax that takes the feature value within the
7640 %feature() brackets. The value specified is no longer restricted to being just
7641 a string. It can be a string or a number. For example, this is now acceptable
7643 %feature("featurename",20.0);
7644 whereas previously it would have to have been:
7645 %feature("featurename","20.0");
7646 Useful for features that are implemented as a macro, for example:
7647 #define %somefeature(value) %feature("somefeature",value)
7648 These will now work accepting either a string or a number:
7649 %somefeature("Fred");
7652 06/06/2004: wuzzeb (John Lenz)
7654 - Created the Examples/test-suite/schemerunme directory, which holds all the
7655 runme scripts for guile and chicken (and possibly mzscheme...). The guile
7656 and chicken _runme files then (load "../schemerunme/foo.scm").
7657 - In chicken module, fix a few bugs invlolving dynamic casts.
7659 06/03/2004: wsfulton
7660 Patch to fix wrapping of templated methods. ISO compliant compilers, like
7661 Comeau and GCC-3.4.0, don't like the template specifier that SWIG was generating
7662 when calling the method. This fix may break some non standard compliant compilers,
7663 for example, Sun workshop compilers prior to version 6.2.p2. Patch submitted
7666 06/03/2004: wsfulton
7667 [Java, C#] Undocumented special variable $imclassname removed.
7668 New special variable $module is replaced by the module name, as specified
7669 by %module or -module commandline option. $imclassname can be created from $module.
7671 06/03/2004: wsfulton
7672 [C#] Same as for Java below. The new typemaps are named differently, namely,
7673 csbody and csbody_derived. The deprecated typemaps are csgetcptr and
7674 csptrconstructormodifiers.
7676 *** POTENTIAL INCOMPATIBILITY FOR C# MODULE ***
7678 06/03/2004: wsfulton
7679 [Java] Typemap changes for the Java proxy / typewrapper and enum classes. A new
7680 typemap called javabody contains the essential support code for generation into the body
7681 of these classes. There is also a new javabody_derived typemap which is used instead for
7682 wrapped classes that have a wrapped base class. The code is basically, the getCPtr()
7683 method and swigCPtr and swigCMemOwn member variables. These used to be hard coded
7684 with no way to modify the code. The introduction of this typemap makes it possible for
7685 the user to tailor nearly every aspect of the code generation.
7686 The exception now is the code for director classes.
7688 The javagetcptr and javaptrconstructormodifiers typemaps are deprecated and are
7689 no longer used as the code that these generated can be put in the more flexible
7690 javabody and javabody_derived typemaps.
7692 *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
7694 The following macros contributed by Scott Michel may help you upgrade if you have used
7695 the javagetcptr typemap:
7697 /* Utility macro for manipulating the Java body code method attributes */
7698 %define SWIGJAVA_ATTRIBS(TYPENAME, CTOR_ATTRIB, GETCPTR_ATTRIB)
7699 %typemap(javabody) TYPENAME %{
7700 private long swigCPtr;
7701 protected boolean swigCMemOwn;
7703 CTOR_ATTRIB $javaclassname(long cPtr, boolean cMemoryOwn) {
7704 swigCMemOwn = cMemoryOwn;
7708 GETCPTR_ATTRIB static long getCPtr($javaclassname obj) {
7709 return (obj == null) ? 0 : obj.swigCPtr;
7713 %typemap(javabody_derived) TYPENAME %{
7714 private long swigCPtr;
7716 CTOR_ATTRIB $javaclassname(long cPtr, boolean cMemoryOwn) {
7717 super($moduleJNI.SWIG$javaclassnameUpcast(cPtr), cMemoryOwn);
7721 GETCPTR_ATTRIB static long getCPtr($javaclassname obj) {
7722 return (obj == null) ? 0 : obj.swigCPtr;
7727 /* The default is protected getCPtr, protected constructor */
7728 SWIGJAVA_ATTRIBS(SWIGTYPE, protected, protected)
7730 /* Public getCPtr method, protected constructor */
7731 %define PUBLIC_GETCPTR(TYPENAME)
7732 SWIGJAVA_ATTRIBS(TYPENAME, protected, public)
7735 /* Public getCPtr method, public constructor */
7736 %define PUBLIC_BODYMETHODS(TYPENAME)
7737 SWIGJAVA_ATTRIBS(TYPENAME, public, public)
7740 06/03/2004: wsfulton
7741 [Java, C#] The contents of the class modifier typemaps and pragmas have changed.
7742 They must now include the class type. Previously 'class' was hard coded.
7743 This change enables flexibility into what type of class is generated,
7744 for example the proxy class could be an interface instead of a class.
7746 For Java this affects the javaclassmodifiers typemap and the jniclassclassmodifiers
7747 and moduleclassmodifiers pragmas.
7749 For C# this affects the csclassmodifiers typemap and the imclassclassmodifiers
7750 and moduleclassmodifiers pragmas.
7752 Unless you have overridden the default versions of these typemaps or pragmas, you
7753 shouldn't be affected. However, if you have, upgrading is easy, for example
7756 %typemap(javaclassmodifiers) Foo "public final"
7761 %typemap(javaclassmodifiers) Foo "public final class"
7764 *** POTENTIAL INCOMPATIBILITY FOR C# MODULE ***
7765 *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
7767 05/31/2004: wsfulton
7768 Fix for C++ exception specifications that are references. Problem reported by
7769 Oren Miller. Also improves the generated exception declarations in the
7770 catch handler for pointers - a pointer is used instead of a reference to
7771 a pointer. Added default throws typemaps for SWIGTYPE &, SWIGTYPE * and
7772 SWIGTYPE[ANY] (Java and C#).
7774 05/31/2004: wsfulton
7775 [Java, C#] Some minor typesafe enum improvements, including storing the name of
7776 the enum item. The toSring() / ToString() methods are overridden to return this name.
7778 05/30/2004: wuzzeb (John Lenz)
7780 - Update how examples and the test suite are built.
7781 - Symbol names are no longer converted to lower case
7782 - Added union_runme.ss, which was copied and modified from the guile module
7784 05/26/2004: lballabio (Luigi Ballabio)
7785 Committed on behalf of Marcelo (who still has problems with
7786 the SourceForge CVS.)
7788 Added Python typemaps for FILE* with (Python-only) test.
7792 * Allegro CL module: Now using some macros (defined in
7793 Lib/allegrocl/allegrocl.swg), swig-defconstant and swig-defun, for
7794 defining constants and foreign functions. This makes the
7795 generated file a bit neater.
7797 Now strips a layer of parenthesis from constants.
7799 Uses (* :void) instead of :foreign-address now.
7801 05/20/2004: wsfulton
7802 Unnamed enum global variables are now supported in addition
7803 to the recently added support for unnamed enum member variables.
7807 enum { enum1, enum2 } MemberInstance;
7809 enum { enum3, enum4 } GlobalInstance;
7811 The int typemaps are used for wrapping the get/set accessor methods.
7812 If the sizeof an enum is not the same size as an int then setting the
7813 variable will silently do nothing as the casts cannot be easily and portably
7814 generated. If you need to solve this highly obscure situation, write
7815 the assignment using the %exception feature.
7817 05/20/2004: wsfulton
7818 [C#] C# enum wrapping mods. Similar to the Java module, enums can be wrapped using
7819 one of 3 approaches:
7821 1) Proper C# enums - use %include "enums.swg"
7822 2) Typesafe enums - use %include "enumtypesafe.swg"
7823 3) Simple constant integers (original approach) - use %include "enumsimple.swg"
7825 See each of these files for further details. Each of these files use typemaps
7826 and a new feature to control the generated code. The feature is:
7828 %csenum(wrapapproach);
7830 where wrapapproach should be one of: "proper", "typesafe", "typeunsafe" or "simple".
7831 [No implementation deemed necessary for type unsafe enums].
7833 The default approach is proper C# enums. Anonymous enums are always wrapped by
7836 *** POTENTIAL INCOMPATIBILITY FOR C# MODULE ***
7838 05/20/2004: wsfulton
7839 [Java] Java enum support added. There are now 4 ways in which enums can be wrapped:
7841 1) Proper Java enums - use %include "enums.swg"
7842 2) Typesafe enums - use %include "enumtypesafe.swg"
7843 3) Type unsafe enums (constant integers) - use %include "enumtypeunsafe.swg"
7844 4) Simple constant integers (original approach) - use %include "enumsimple.swg"
7846 See each of these files for further details. Each of these files use typemaps
7847 and a new feature to control the generated code. The feature is:
7849 %javaenum(wrapapproach);
7851 where wrapapproach should be one of: "proper", "typesafe", "typeunsafe" or "simple".
7852 The default typemaps will handle enums that may or may not have specified initial
7853 values, for example ten is specified:
7855 enum Numbers { zero, ten(10) };
7857 However, the amount of generated Java code can be cut down, by modifying these typemaps
7858 if none of the enums have initial values (proper Java enums and typesafe enums approach).
7860 The default approach is typesafe enums. Anonymous enums are always wrapped by
7863 *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
7865 05/11/2004: wsfulton
7866 [Java, C#] Fix bug using %rename on enum items and when using
7867 %javaconst(1) / %csconst(1)
7868 For example, the following used to generate code that wouldn't compile:
7870 %rename(Obj) Object;
7871 enum Grammar { Subject, Object };
7873 04/28/2004: wsfulton
7874 [Java, C#] Minor fixes when using combinations of the
7875 javainterfaces, javabase, csinterfaces and csbase typemaps.
7877 05/18/2004: wsfulton
7878 [Java] JVM link failure on some systems fixed when using std_vector.i.
7879 Also adds default vector constructor for use from Java.
7881 05/17/2004: mkoeppe (Matthias Koeppe)
7883 [Guile] New runtime functions SWIG_PointerAddress,
7884 SWIG_PointerType, SWIG_IsPointerOfType, SWIG_IsPointer.
7886 [Guile] In -scm mode, wrap several SWIG runtime functions
7887 and export them into the module (Swig swigrun). The
7888 runtime module is now built with "module" linkage.
7890 [Guile] GOOPS proxy objects now also print the pointer
7891 address of the C object.
7894 Added Kou's patch for the Ruby %import directive so that modules
7895 with "nested" names are handled properly. Consider an interface
7896 file foo.i that has this %module declaration at its top:
7898 %module "misc::text::foo"
7900 Now consider another interface file spam.i that imports foo.i:
7904 Before this patch, this would result in the following code being
7905 generated for spam_wrap.c:
7907 rb_require("misc::text::foo");
7909 With this patch, however, you'll get the correct path name
7910 for the call to rb_require(), e.g.
7912 rb_require("misc/text/foo");
7914 See SourceForge Bug #928299.
7916 05/12/2004: wsfulton
7917 Patch for emitting directors when %feature("director") specified
7918 for a class with no virtual methods, but does have a virtual destructor.
7919 Submitted by Kevin Smith.
7921 05/06/2004: mkoeppe (Matthias Koeppe)
7922 New SWIG runtime function SWIG_TypePrettyName, which
7923 returns an unmangled type name for a swig_type_info
7926 [Guile]: Use it for printing pointer objects.
7928 05/03/2004: dancy (Ahmon Dancy)
7930 * Lib/allegrocl/allegrocl.swg: Updated comments about identifer
7933 * Sources/Modules/allegrocl.cxx: Register /dev/null for "header"
7934 target. Also, disregard "const" qualifiers during type
7938 05/02/2004: wuzzeb (John Lenz)
7939 [Chicken] Fix bug 782468.
7940 To fix this bug, the runtime code has been rewritten, and
7941 pointers are now represented as a C_SWIG_POINTER_TYPE.
7943 Chicken version > 1.40 is now required!
7945 * Typemap incompatibility: typemaps no longer use chicken_words.
7946 If a typemap needs some space, it should just call C_alloc
7948 * argout typemaps no longer use the /* if ONE */ construct to
7949 build an output list. A SWIG_APPEND_VALUE macro, exactly like
7950 guile and mzscheme is now used.
7952 04/25/2004: mkoeppe (Matthias Koeppe)
7953 [Guile] In the generated GOOPS code, don't create methods
7954 that would not specialize any arguments; simply re-export
7955 the primitive functions. (This is a performance
7956 optimization which reduces load time and execution time.)
7958 [Guile] In -gh mode, fix the "too many initializers" error
7959 which was caused by an incompatible swig_type_info layout.
7961 [Guile] The typemap for FILE * in ports.i now also accepts
7962 a regular FILE * pointer object. Also a bug with Scheme
7963 file ports that are open for input and output has been
7966 04/25/2004: wsfulton
7967 Change entry 03/21/2004 revoked. The change introduced another
7968 inconsistency (reference typemaps beings used instead of
7969 pointer typemaps for member variables as well as static
7970 member variables and global variables for some languages,
7971 but only for C++ and not C). This would break user's current
7972 typemaps and introduce further inconsistencies. Alternative
7973 solution required and being discussed.
7975 04/10/2004: mmatus (Marcelo Matus)
7977 Added the -directors flag. This enables the director
7978 mode for the interface and all the classes that
7979 don't set the "feature:nodirector" explicitly.
7981 You can use this in your module if you want to use the
7982 director feature in all your classes, but it is most
7983 intended for testing purposes, like:
7985 make check-python-test-suite SWIG="../../../swig -directors"
7986 make check-ruby-test-suite SWIG="../../../swig -directors"
7987 make check-java-test-suite SWIG="../../../../swig -directors"
7989 These commands will run the entire test-suite using
7990 directors, and not only the specific 'directors_*'
7991 cases. This should be done from time to time.
7993 04/10/2004: mmatus (Marcelo Matus)
7995 [python] Added support for std::wstring and wchar_t,
7996 for compiler and python versions that support them.
8000 %inlcude std_string.i // 'char' strings
8001 %inlcude std_wstring.i // 'wchar_t; strings
8004 04/10/2004: mmatus (Marcelo Matus)
8006 [python] Fix the default behaviour (seg. fault) when an
8007 inplace operator (+=,-=,...) was wrapped, as reported by
8008 Lucriz (lucriz@sitilandia.it), when the most common
8011 A& A::operator+=(int i) { ...; return *this; }
8015 ie, an object is returned and its contains the same 'this'
8016 value than the input object, which is deleted after the
8017 operation "a += b", leaving the result with no real
8018 object, but a seg. fault.
8020 To fix it, we needed to introduce a new feature and use an
8023 %feature("self:disown") A::operator+=;
8024 %feature("new") A::operator+=;
8026 here, "self:disown" disable the ownership of the 'self'
8027 or input object, and the "new" feature transfers the
8028 ownership to the result object.
8030 The feature/solution could also be used in other languages
8031 that use gc and implement the inplace operators, or other
8032 operators, in a similar way.
8034 *** POTENTIAL INCOMPATIBILITY FOR Python MODULE ***
8036 If you already are using the inplace operators in python,
8037 and you implemented some kind of workaround to the problem
8038 fixed here, it is possible you could end with 'free'
8039 objects that never get deleted. If that is the case, and
8040 you want to disable the current fix, use:
8042 %feature("self:disown","") A::operator+=;
8043 %feature("new","") A::operator+=;
8046 04/07/2004: cheetah (William Fulton)
8047 [C#] C++ enums are no longer wrapped by integers, they are now wrapped by
8048 C# enums. For Example, given C++:
8050 enum AnEnum { foo, bar };
8051 typedef AnEnum AnEnumeration;
8052 void something(AnEnum e, AnEnumeration f);
8054 The following is generated:
8056 public enum AnEnum {
8060 public static void something(AnEnum e, AnEnum f) {...}
8062 Note that a global enum like AnEnum above is generated into its own
8063 file called AnEnum.cs. Enums defined within a C++ class are defined
8064 within the C# proxy class. Some of the typemaps for modifying C# proxy
8065 classes also work for enums. For example global enums can use
8067 %typemap(csimports) to add in extra using statements.
8069 Global enums and class enums can use
8071 %typemap(csclassmodifiers) to make the enum private, public etc.
8072 %typemap(csbase) to change the underlying enum type (enum base)
8074 If we add this for the above example:
8076 %typemap(csclassmodifiers) AnEnum "protected"
8077 %typemap(csbase) AnEnum "long"
8079 the following is generated:
8081 protected enum AnEnum : long {
8086 *** POTENTIAL INCOMPATIBILITY FOR C# MODULE ***
8088 04/07/2004: cheetah (William Fulton)
8089 Seg fault fix for empty enums, like
8093 [Note: this change revoked on 04/25/2004]
8094 [Python] Makes the following 'var' cases more uniform:
8099 static std::string sa;
8104 now the three variables (ga, sa, ma) can be assigned as:
8111 ie, now 'ma' will also use a std::string typemap 'in' if
8112 defined, before it was only accepting a 'p_std_string'
8113 pointer. Note, however, that 'ma' will not use the
8114 'varin/varout' typemaps (that probably could be more
8115 natural), but it will pick up the 'in' typemap for const
8116 std::string& (which is easier).
8118 The changes in cwrap.c and lang.cxx will probably fix the
8119 behaviour in other languages that do not overload the
8120 membervarHandler method "too much".
8124 [Python] Disabling the default instantiations like:
8126 %template() std::pair<int,int>;
8128 for all the primitive types and STL containers/classes.
8129 They are expensive, specially for pair and map, and the
8130 previous behaviour also requires the user to perform
8131 manual instantiations. Still, if the speed difference is
8132 not important, it can be re-enabled by defining the macro
8133 SWIG_STD_DEFAULT_INSTANTIATION (see std_common.i).
8135 Also, normalizing the INPUT/OUTPUT/INOUT typemaps. Now
8136 they use the same conversors than the rest of the
8137 typemaps, and you can use them for std::pair, std::string
8138 and all the other STL types, like in:
8140 void p_inoutd(std::pair<double, double> *INOUT);
8142 Added the attribute.i and implicit.i files with macros to
8143 transform functions pairs like 'set_x'/'get_x'
8144 (or 'T& x()'/'const T& x() const') into an attribute,
8145 and allowing the use of implicit constructors in typemaps
8146 (see the files for more details).
8149 [Guile] Fix the documentation strings of functions with
8150 anonymous arguments.
8153 [Python] More general std_string.i interface.
8154 Now you can wrap it using
8156 %template(string) std::basic_string<char>;
8158 and use the std::string as a base class:
8160 struct A : std::string {
8163 But more important, swig will recognize
8164 both std::basic_string<char> and std::string as
8168 Previously added, but not mentioned before:
8170 - friend declaration support, swig now emits a global
8171 function in the same class scope.
8173 - ref/unref features: to mix ref counting C++ classes
8174 and native script ref counting mechanisms (like in python).
8178 %feature("ref") RCObj "$this->ref();"
8179 %feature("unref") RCObj "$this->unref();"
8181 And the class RCObj, and all the derived ones, will
8182 perform the right ref/unref calls when a new pointer
8183 is returned to the target language, or when the target
8184 language attempts to delete the object.
8186 See the refcount.i file in the test-suite for more
8191 [Python] Using the new %fragment support, major rewrote
8192 of the python swig library, including:
8194 - Almost automatic template/typemap instantiation for
8195 the STL components. For example, now you can write:
8197 %template(vector_i) std::vector<int>;
8199 and a specialized vector_i class is emitted with all
8200 the needed typemaps. No need to use the old
8201 'specialize_vector' macros.
8203 Note you can also define
8205 %template(matrix_i) std::vector<std::vector<int> >;
8206 %template(vector_pii) std::vector<std::pair<int,int> >;
8208 - The empty template instantiation
8210 %template() std::vector<int>;
8212 defines the vector typemaps, but no proxy class. For all the
8213 fundamental types, the empty template instantiation are
8214 defined, so, you can say
8218 int func(const std::vector<int>& a);
8220 where the proper typemap is applied to 'a', but no
8221 std::vector<int> proxy is generated.
8224 - All the STL containers present a more uniform behavior and
8225 more complete interface declaration. The following are
8236 not a container, but also supported:
8240 also, more typemaps are defined for all of them,
8241 including varin, varout, typecheck, etc.
8243 - Initial attempt to implement the STL containers
8244 considering allocators, ie:
8248 it is partially working, but it is just a workaround
8249 while swig improves its template type support.
8252 Please test with your particular setup. It seems to be
8253 working with g++ 3.2.2, g++ 2.96, Intel icc and SGI CC
8254 compilers, plus python 1.5.2, 2.0 and 2.3, but since
8255 we are using templates, there is a chance you can find
8256 some problems when using with an old C++ compiler.
8260 - Allowing the empty %template directive, such as
8262 %template() std::vector<int>;
8264 to process the class "typedef"s and "typemap"s. Before
8265 only the internal "typedef"s were processed.
8267 This makes possible to emit the default in/out
8268 typemaps without the need of wrapping an specialized
8271 - Adding the preprocessor extension #@ which mangles the
8272 following macro argument, like in:
8274 #define macro(X) #@X
8276 macro(std::string) -> std_s_s_string
8278 - Fragments can now be "type specialized", as the typemaps. The
8279 syntax is as follows
8281 %fragment("name","header")
8282 { /* a type independent fragment (old syntax) */ }
8283 %fragment("name" {Type}, "header")
8284 { /* the fragment is type dependent */}
8286 Now fragments can also be used inside templates:
8290 %fragment("incode"{A<T>},"header") {
8291 /* 'incode' specialized fragment */
8294 %typemap(in,fragment="incode"{A<T>}) {
8296 here we use the 'type specialized'
8297 fragment "incode"{A<T>}
8303 03/11/2004: cheetah (William Fulton)
8304 [Java] Director bug which meant that some virtual functions overridden in
8305 Java were not being called on some operating systems. Bug reported and fixed
8306 by Robert de Vries and Scott Michel.
8308 03/02/2004: mkoeppe (Matthias Koeppe)
8309 [Guile] In -scm mode, don't forget to check the type of string arguments.
8311 02/24/2004: cheetah (William Fulton)
8312 [C#] New commandline option -namespace <name>. This allows one to specify
8313 a C# namespace into which all C# classes are generated.
8315 02/23/2004: mkoeppe (Matthias Koeppe)
8316 [MzScheme] Use FUNC_NAME rather than a bogus typemap variable for signalling
8317 errors. Call scheme_wrong_type with a zero-based argument number.
8318 Reported by Ondrej Pacovsky, SF #902621.
8320 [Guile] Define FUNC_NAME also in the dispatch wrapper for overloaded
8321 functions. Patch by John Lenz, SF #896255.
8323 02/22/2004: mkoeppe (Matthias Koeppe)
8324 [Guile] In -scm mode, don't try to invoke a null destructor function.
8326 02/20/2004: cheetah (William Fulton)
8327 Fixes so that the SWIG source will compile using the Digital Mars Compiler
8328 (formerly Symantic compiler) on Windows. Submitted by Scott Michel.
8330 02/13/2004: mkoeppe (Matthias Koeppe)
8331 [MzScheme] New command-line argument -noinit. Use it for building
8332 the runtime library, where we don't want to define the functions
8333 scheme_initialize etc. Reported by Tim Brown, SF #891754.
8335 [MzScheme] Don't produce invalid C code when invoked with the
8336 -declaremodule option. Reported by Tim Brown, SF #891108.
8338 [Guile] Build the runtime library with passive linkage, to rename
8339 the SWIG_init function uniquely.
8341 02/12/2004: cheetah (William Fulton)
8342 [Java, C#] Patch submitted by Bill Hoffman which prevents SWIG from crashing
8343 when a file for the typewrapper class cannot be opened.
8345 02/11/2004: cheetah (William Fulton)
8346 [Java, C#] Overloading changes:
8347 - Methods which are overloaded in const only no longer generate Java
8348 code that won't compile - the first method parsed is used and a
8349 warning is displayed. Note that this behaviour is slightly different
8350 to the scripting languages which always uses the non-const method.
8351 - Warning messages 509 and 512 replaced by new warning number 516, which
8352 is more relevant to these statically typed languages as the overloaded
8353 methods aren't 'shadowed', they are ignored.
8355 01/23/2004: mkoeppe (Matthias Koeppe)
8356 [Guile] Replace the "known_classes" hash table by a node
8357 attribute. Methods of classes in C++ namespaces now get
8358 the proper specializer in the GOOPS declaration.
8359 Reported by rm@mh-freiburg.de.
8361 01/23/2004: mkoeppe (Matthias Koeppe)
8362 [Guile] Uniquify the argument names in GOOPS shadow method
8363 declarations. Reported by rm@mh-freiburg.de.
8365 01/21/2004: sunshine (Eric Sunshine)
8366 Revived the NextStep port of SWIG.
8368 Fixed fatal problem in DohStrstr() caused by difference in strstr()
8369 implementation which made %apply become entirely dysfunctional. On
8370 NextStep, strstr("foo","") evaluates to NULL; whereas, on modern
8371 platforms, it evaluates to "foo". %apply relies extensively upon
8372 strstr("foo","") evaluating to non-NULL, therefore it failed
8373 catastrophically when faced with NextStep's strstr().
8375 Added `bool' check to configure.in since NextStep's C++ compiler
8376 does not supply this type. swig.h now fakes up `bool' if needed.
8378 Worked around NextStep C++ compiler bug in which C++ code is
8379 disallowed inside extern "C" functions. This problem affected all
8380 language modules, since they publish hook functions of the form:
8381 extern "C" Language *swig_foo(void) { return new FOO(); }
8382 Fixed by creating a C++ wrapper:
8383 static Language *new_swig_foo() { return new FOO(); }
8384 extern "C" Language *swig_foo(void) { return new_swig_foo(); }
8386 Ensured that Swig_copy_string() is used in place of strdup() since
8387 NextStep does not supply strdup().
8389 Fixed detection of Ruby library name and location in configure.in.
8390 Problem 1: Assumed that library always resided in Ruby's "archdir",
8391 which was correct for Ruby 1.6.x, but which is incorrect for Ruby
8392 1.8.x, in which case the library normally resides in Ruby's
8393 "libdir". Problem 2: Assumed that the library could always be
8394 linked via "-l"+RUBY_INSTALL_NAME (where RUBY_INSTALL_NAME
8395 typically is "ruby"), however this failed for platforms, such as
8396 NextStep, which do not support shared libraries. In this case, the
8397 static library name in 1.8.x is libruby-static.a, thus
8398 -lruby-static is required. The new logic works correctly for
8399 static and shared libraries for 1.6.x and 1.8.x.
8401 Fixed detection of Perl CFLAGS in configure.in for NextStep.
8402 Detection code extracted CFLAGS from Perl's %Config hash but
8403 neglected to add a newline to the value before passing it through
8404 `sed'. NextStep's ancient `sed' discards input which is not
8405 terminated with a newline, thus Perl CFLAGS always evaluated to the
8408 01/16/2004: cheetah (William Fulton)
8409 Tidy up in the exception handling code that is generated when
8410 C++ exception specifications are wrapped with the throws typemap.
8411 This redundant code is no longer generated:
8417 01/12/2004: wsfulton on behalf of mmatus (marcelo matus)
8418 if a method uses %exception and the method requires the use
8419 of the throws typemap, the code in a throws typemap will be
8420 generated inside the try body. For example:
8427 // method int catch handler
8429 // method generic catch handler
8432 %typemap(throws) Except %{
8433 // throws typemap Except catch handler
8438 void method(int i) throw (Except);
8449 // throws typemap Except catch handler
8454 // method int catch handler
8456 // method generic catch handler
8461 As can be seen, the inner try catch block is for the throws typemaps.
8462 Previously, this was reversed so that the inner try catch block
8463 was the %exception code. In the example above, it would have been
8464 impossible to catch Except as the catch all (...) would catch the
8467 Version 1.3.21 (January 11, 2004)
8468 =================================
8470 01/10/2004: cheetah (William Fulton)
8471 The output format for both warnings and errors can be selected for
8472 integration with your favourite IDE/editor. Editors and IDEs can usually
8473 parse error messages and if in the appropriate format will easily take you
8474 directly to the source of the error. The standard format is used by
8475 default except on Windows where the Microsoft format is used by default.
8476 These can be overridden using command line options, for example:
8478 $ swig -python -Fstandard example.i
8479 example.i:4: Syntax error in input.
8480 $ swig -python -Fmicrosoft example.i
8481 example.i(4): Syntax error in input.
8484 Fixed [ 871909 ] simple namespace problem.
8485 This was a problem using anonymous structures in a namespace.
8494 Reported by Josh Cherry.
8497 Fixed some broken Perl examples.
8499 12/28/2003: cheetah (William Fulton)
8500 [Java and C#] Fixes for wrapping covariant (polymorphic) return types.
8505 virtual Base* copy() const = 0;
8507 struct Derived : Base {
8508 virtual Derived* copy() const;
8511 The Derived::copy proxy method returns Base not Derived. A warning is issued
8512 about this. Previously the pointer used by the proxy class was incorrectly
8513 treated as a Base* instead of a Derived*.
8515 12/18/2003: cheetah (William Fulton)
8516 Fix so that Windows paths are displayed correctly when reporting errors.
8517 An error previously would have been shown something like:
8519 .?xample.i:14: Syntax error in input.
8523 .\example.i:14: Syntax error in input.
8526 Version 1.3.20 (December 17, 2003)
8527 ==================================
8530 Last minute modifications. Perl5 module now generates shadow classes
8531 by default like all of the other modules. PHP4 wrappers no longer
8535 Weakened warning message related to constructor names so that an
8536 unusual nested-class wrapping technique would work again (apparently
8537 it worked in some older SWIG releases). For example:
8543 class Scope::ClassA {
8546 class Scope::ClassB {
8550 Note: There is still some odd interaction with the SWIG symbol
8551 table/type system that will need to be looked at in a future release.
8552 Reported by Gustavo Niemeyer.
8555 12/11/2003: cheetah (William Fulton)
8556 [Java] Protected class methods are wrapped as protected Java methods
8557 when using the dirprot director feature. This can be changed using
8558 %javamethodmodifiers to something else should the need arise, for
8559 example, private or package access.
8561 12/11/2003: cheetah (William Fulton)
8563 %javamethodmodifiers (Java) and %csmethodmodifiers (C#) operate slightly
8564 differently. Previously this feature had to be present to set the method
8565 modifiers. Now it is only used if it exists for the method being wrapped.
8566 The default is "public" as previous however, when wrapping protected
8567 director methods it is "protected". This change will not affect existing
8568 use of the %javamethodmodifiers or %csmethodmodifiers.
8570 12/11/2003: mmatus (Marcelo Matus)
8572 This fix some recurring reports about keywords not been
8573 properly identified and warned, and it solves the problem
8574 of how to add a test file to the test-suite such that it
8575 doesn't use any keyword of all the supported languages
8576 (and doing it without compiling the test for all the
8577 supported languages, thing that is not always possible,
8578 and without requiring you to know all the supported
8579 language keywords, thing that is always impossible).
8581 So these are the changes globally speaking:
8583 - Uniform the definition of the keyword warnings through
8584 the supported languages: all the languages has now a
8585 separate file that defines the keywords or bad names:
8588 chicken/chickenkw.swg
8591 - Added keyword list for most of the languages that didn't
8592 have one (using the new separated file).
8594 - Added the "All keywords" warning support: -Wallkw option.
8596 This option allows you to include all the known keywords
8597 for all the supported languages, and can be used as:
8601 This will help to the process of adding a test-suite
8602 file that can be compiled in all the swig supported
8603 languages, and it will be also helpful for users who
8604 want to create multi-language libraries.
8606 And these are the detailed changes (mostly file addition):
8608 - For the languages that already have some sort of keyword
8609 warning list, move it to an external languagekw.swg
8612 move keywords from python.swg -> pythonkw.swg
8613 move keywords from chicken.swg -> chickenkw.swg
8614 move keywords from tcl8.swg -> tclkw.swg
8616 and re-include languagekw.swg from language.swg.
8618 - For the language that didn't have a keyword list, and
8619 for the ones that I could find a list, add the
8620 languagekw.swg file, ie:
8629 also add a line in language.swg to include
8630 languagekw.swg, but now it is commented!!!, like in
8634 /* please test and activate */
8635 //%include "javakw.swg"
8637 ie, there will be no change in how swig runs normally
8638 until the language maintainer test and uncomment that
8641 So, please check each languagekw.swg file (I left the
8642 link to the keyword list source for checking), and after
8643 testing, uncomment the %include line.
8645 - Added the file allkw.swg, which includes all the
8646 languagekw.swg files.
8648 For the languages that has no languagekw.swg file right
8649 now, and if they need one, add the file into the
8650 language directory, and add the corresponding include
8651 line into the allkw.swg file.
8653 - Added the -Wallkw that includes the allkw.swg file.
8654 Note that the old -lallkw.swg option couldn't be used
8655 since it include the file after it would be needed.
8658 Hopefully, the -Wallkw option will be added to the default
8659 rules in the related test-suite Makefiles, so, when
8660 creating a new test, or adding a new swig library file
8661 (like _std_deque.i), swig will warn you if you are using a
8662 bad name, considering all the language where it needs to
8665 Right now you can test it by using:
8667 make check-python-test-suite SWIG="swig -Wallkw"
8669 or using your favorite target language, it doesn't matter.
8671 And yes, there are several examples that are using
8672 reserved keywords, specially from csharp.
8674 *** Remember ****: the new keyword warning lists are not
8675 included by default in any of language that before didn't
8676 have one. To enable the keyword warnings as the default
8677 behavior, the inclusion of the languagekw.swg file has to
8678 be uncommented at each language.swg file.
8680 So, all the language maintainers, please check the
8683 Also, you can add buit-in names, and not only keywords, like
8684 'True/False' in python. Remember that you can be more
8685 specific and refer only to member names, like *::configure
8686 or *::cget (see an example in the tcl8/tcl8kw.swg file),
8687 or only global names, like ::range (see an example in the
8688 python/pythonkw.swg file.
8690 Just to be consistent, use the following codes:
8692 - Use code 314 for keyword and/or fatal bad names.
8693 - Use code 321 for buit-in and/or not fatal bad names.
8695 so, they can't be disabled/enabled independently (see
8696 python/pyhtonkw.swg for examples).
8698 **** And don't add any new test file without checking it
8699 with the -Wallkw option!! (that includes me) *****.
8702 12/11/2003: cheetah (William Fulton)
8704 Added support for accepting the Unix directory separator '/' on
8705 Windows and the Mac in addition to the native one ( '\' on
8706 Windows). This can be used in %import, %include and commandline
8707 options taking a path, for example -I. On Cygwin, both the Windows
8708 and Unix directory separator can now be used (was '/' only).
8710 12/10/2003: mmatus (Marcelo Matus)
8712 [python] Implementing the runtime "reprotected" director
8713 members, if you have:
8715 %feature("director") B;
8720 virtual int hello() { return do_hello();)
8723 virtual int do_hi() {return 0;}
8724 virtual int do_hello() {return 0;}
8727 then, at the python side
8731 class Foo(my_module.Bar):
8736 b = Bar() # Pure C++ Director class
8737 f = Foo() # C++ Director + python methods
8739 b.hello() # Ok, and it calls C++ Bar::do_hello()
8740 f.hello() # Ok, and it calls Python Foo::do_hello()
8742 b.do_hi() # RuntimeError, do_hi() is protected!!
8743 f.do_hi() # RuntimeError, do_hi() is protected!!
8745 b.do_hello() # RuntimeError, do_hello() is protected!!
8746 f.do_hello() # Ok, since it its redefined in python.
8748 Here Bar.do_hello is always protected, but Foo.do_hello
8749 is "public", because it is redefined in python. Before,
8750 all the 'do_hello' methods were public.
8752 This seems to be a good compromise between C++ and python
8753 philosophies, ie, all the director protected methods keep
8754 protected at the user side (C++ way) until they are
8755 redefined (python way, were all defined methods are always
8756 public). And this is not only a good compromise, it also
8757 seems to be the only way to do it :).
8759 Now ruby has native director protected members, and python
8760 pure runtime support. I guess these are the two possible
8761 extreme cases. And hopefully, they could be used as
8762 templates to modify the other languages that support
8763 directors, so they can "reprotect" the protected director
8764 members at the target language side.
8766 This finished the director protected support for the
8767 python language. Ocalm will need to add the
8768 "reprotection" later.
8770 12/10/2003: mmatus (Marcelo Matus)
8772 The following case (reported by Lyle Johnson) was fixed:
8774 %rename(x) Foo::y();
8784 swig warned that the symbol 'x' was already defined, and
8785 the renaming fails. 'x' was not emitted, since it is
8786 protected, but it was kept in the symbol table with too
8789 Now swig works for all the cases (plain, director and
8790 dirprot) again. This was fixed by allowing the parser.y to
8791 decide much closer what to do with 'x'. Before all the
8792 discarding or generation was resolved at the lang.cxx
8793 stage. Also the changes in parser.y to implement the
8794 director protected mode are now much more encapsulated, and
8795 they get disabled if the mode is not enabled. Before the
8796 deactivation was done at the generation stage (lang.cxx).
8798 By the other hand, if the director mode is enabled, and
8799 %rename is done, reusing a protected member name, there is
8800 a pathological case:
8802 %rename(x) Foo::y();
8804 class Foo : public A {
8810 static int x; /* works */
8811 static void x(); /* works */
8812 typedef void x(); /* works */
8814 virtual void x(); /* always fails, as it should, since
8815 Foo::x() will be emitted in the
8818 void x(); /* always fails, but sometimes it shouldn't,
8819 since the Foo::x() will not be emitted if
8820 it is not virtual */
8824 The last case is not always right because at the parser.py
8825 stage it is not possible to decide if the protected member
8826 Foo::x() could or not conflict with the renamed Foo::y(),
8827 since Foo::x() could be virtual by inheritance.
8829 I guess this just an intrinsic limitation, and no much can
8830 be done about it without resorting into larger changes to
8831 postpone, under certain conditions, the multiply symbol
8832 detection (lang.cxx stage).
8834 So, by now, it is just considered a well known "feature" in
8835 the director protected mode. The good news is that it seems
8836 to be a rare case, and it can be avoided by the user by
8837 hiding 'x' before renaming 'y':
8839 %rename(_x) Foo::x();
8840 %rename(x) Foo::y();
8843 12/08/2003: mmatus (Marcelo Matus)
8844 The virtual method detections now properly
8845 treats the following cases:
8847 namespace foo { typedef int Int; }
8854 virtual Foo* cloner() = 0;
8855 virtual int get_value() = 0;
8856 virtual A* get_class() = 0;
8857 virtual void just_do_it() = 0;
8863 foo::Int get_value();
8868 All the Foo and Bar methods are virtual. A new attribute
8869 "virtual:type" record the base polymorphic type. In the
8870 previous cases we have:
8872 type : Bar virtual:type : Foo
8873 type : foo::Int virtual:type : int
8874 type : B virtual:type : A
8875 type : void virtual:type : void
8877 This attribute is useful in languages (java+directors)
8878 that could have problems redefining Bar* Bar::cloner().
8880 If you never had code like the above, you will see no
8881 effects. But if you have some code like that, you
8882 will see some effects since some methods that
8883 before were not properly treated as virtual,
8884 will start to act like that. This could enlarge
8885 your director classes.
8888 12/08/2003: mmatus (Marcelo Matus)
8889 The director protected member support (dirprot)
8890 is disabled by default.
8892 It can be enable by using '-dirprot' or by adding
8893 the option to the module declaration, like:
8895 %module(directors="1",dirprot="1") my_module
8897 This module option was added to properly compile the
8898 director_protected.i and director_nested.i examples.
8900 The feature has been tested with python[2.2,2.3]
8901 and ruby[1.6.7], both at compilation and runtime, and
8902 java[j2sdk1.4.1_01], but only at compilation (my java
8903 installation doesn't run any of the director examples,
8906 Please test for ocaml and java.
8908 The errors reported by William and Scott were fixed,
8909 except for a warning about SWIG_JavaThrowExecption()
8910 multiply defined. I can't reproduce this error with my
8911 examples. We will wait for Scott to send us a minimal
8915 12/07/2003: mmatus (Marcelo Matus)
8916 The director protected member support has been
8917 completly moved out from python.cxx, and now
8918 resides in the common lang.cxx, emit.cxx and
8921 This means it should work for all the other languages
8922 that currently support directors, ie, python, java, ocalm
8925 The change has been tested with python (compilation+runtime)
8926 and java (just compilation).
8928 Please add runtime tests for the missing languages
8931 The '-nodirprot' option was moved to the principal main,
8932 and can be used from all the languages.
8934 12/07/2003: cheetah (William Fulton)
8935 [Java] Fixed and improved error checking of STRING_OUT typemaps in
8938 12/04/2003: mmatus (Marcelo Matus)
8940 - Now the virtual members with no explicit declarator
8941 are properly identified:
8944 virtual int f() = 0;
8951 Here, B::f() is virtual, and the director and the
8952 virtual elimination mechanism now recognize that.
8954 - [C#] This fix also fixes the problem where 'override' was not being
8955 used on any overridden virtual method, so for struct B above,
8956 this C# code is generated:
8958 public class B : A {
8960 public override int f() {
8966 - Initial support for protected virtual methods. They are now
8967 properly emitted when using with director (python only by
8970 %feature("director") A;
8973 virtual int f1() = 0;
8976 %feature("director") B;
8983 This can be dissabled by using the '-nodirprot' option.
8985 - The feature 'nodirector' is working now at the top level,
8986 so, it must work for all the languages:
8988 %feature("director") A;
8989 %feature("nodirector") A::f2;
8996 in this case, only 'f1' is exported to the director class.
8998 - Added director support for const TYPE& arguments (python).
9000 12/02/2003: cheetah (William Fulton)
9001 [Java] Fix for INOUT and OUTPUT typemaps in typemaps.i for when the JNI type
9002 is bigger than the C type. For example, unsigned long (32bits on most systems)
9003 is mapped to jlong (64bits). Returned value was incorrect. Bug reported by
9006 12/02/2003: cheetah (William Fulton)
9007 [C# and Java] Better fix for entry dated 05/11/2003. Fixes the following
9010 Java: javabase, javainterfaces, javaimports, javaclassmodifiers,
9011 javaptrconstructormodifiers, javafinalize, javagetcptr & javacode.
9012 C#: csbase, csinterfaces, csimports, csclassmodifiers,
9013 csptrconstructormodifiers, csfinalize, csgetcptr & cscode.
9015 It also fixes bug in using arrays of C structs with arrays_java.i
9016 as reported Scott Michel.
9019 [Perl] Fixed [ 852119 ] recursive inheritance in output .pm, perl5.
9020 Reported by William Dowling.
9023 [Tcl] Fixed [ 755382 ] calling func(const vector<T>& p) evaluates p[0] in interp.
9024 The Tcl type checker was improperly handling the interpreter result when
9025 type violations were supposed to be ignored.
9026 Reported by Flaviu Popp-Nowak.
9028 11/30/2003: cheetah (William Fulton)
9029 Fixed [ 545058 ] configure's --with-tclincl has no effect
9031 11/30/2003: cheetah (William Fulton)
9032 [Java] Fixed [ 766409 ] missing symbol SWIG_JavaThrowException during module load
9033 SWIGs internal functions are all static as there is no need for different SWIG
9034 generated modules to share any code at runtime.
9037 [Tcl] Added support for C++ pointers to members.
9039 11/28/2003: cheetah (William Fulton)
9040 Fixed [ 848335 ] Directors: #include wrapper .h file - was incorrectly
9041 adding a directory to the generated #include "foo_wrap.h" statement
9044 11/28/2003: cheetah (William Fulton)
9045 [Java] Fixed [ 849064 ] JAVA : Access modifier for derived class wrong.
9046 The delete() method is always public now. It used to be protected whenever a
9047 destructor was non public. An UnsupportedOperationException runtime
9048 exception is thrown instead of making delete() protected now.
9051 [Perl5] Added support for C++ pointers to members.
9054 Fixed [ 850151 ] PYVERSION with python2.3 in configure of SWIG 1.3.19 (Maybe).
9057 Fixed [ 850666 ] #include extra line added.
9058 This should fix some problems with getting correct line numbers on
9062 Fixed another one of Marcelo's evil template bugs (infinite
9063 recursion). [ 849504 ] template and typedef -> inf. recursion.
9066 Fixed parsing problem with declarations like this:
9068 int *x = &somearray[0];
9071 Fixed [ 756552 ] missing default argument class scope with "|".
9072 This is really only a band-aid fix for use of class-enums in
9073 expressions. For example:
9077 enum Flag { flag1 = 0x1, flag2 = 0x2 };
9078 void foo(int x = flag1 | flag2);
9081 Note: there are still some (more subtle) cases that are broken,
9082 but hard to fix due to an issue with template expansion. Will
9084 Reported by Dmitry Mironov.
9087 Incorporated [ 840878 ] support for %inline { ... } (PATCH).
9088 This adds support for the following:
9094 The difference between this and %inline %{ ... %} is that the
9095 enclosed text is processed by the SWIG preprocessor. This
9096 allows special macros and other processing to be used in
9097 conjunction with %inline.
9098 Contributed by Salvador Fandino Garcia.
9101 Fixed [ 836903 ] C++ inconsistency (with void arguments).
9102 SWIG was having difficulty with f() vs f(void) in C++ programs.
9107 virtual void f(void) = 0;
9112 virtual void f(); // Not matched to f(void) correctly
9115 The parser now normalizes all declarations of the form f(void)
9116 in C++ classes to f(). This should fix a variety of subtle
9117 problems with inheritance, optimizations, overloading, etc.
9118 Problem reported by Partho Bhowmick.
9121 [Perl5] Incorporated [ 841074 ] better croaking (PATCH). This fixes some problems
9122 with strings and provides some new error functions.
9123 Contributed by Salvador Fandino Garcia.
9126 Fixed [ 791835 ] Default argument with cast: txt = (char *)"txt" syntax Error.
9127 The parser should now accept things like this:
9129 void foo(char *s = (char *) "Hello");
9131 Problem reported by Claudius Schnorr.
9134 [Tcl] Fixed problem with cross module linking. Previously modules referred
9135 to base classes through a global variable. Now, the module looks up base
9136 classes through the type system itself---avoiding the need to link to a global
9137 like before. Caveat: modules with base classes must be loaded before
9138 modules with derived classes.
9140 11/24/2003: mkoeppe (Matthias Koeppe)
9141 [Guile] In -scm mode, use () to represent null pointers,
9142 as it is done in -gh mode.
9144 11/23/2003: mkoeppe (Matthias Koeppe)
9145 Add a generated script "preinst-swig", which can be used
9146 to invoke SWIG before it has been installed. It arranges
9147 that the runtime libraries from the source directory are
9150 11/23/2003: mkoeppe (Matthias Koeppe)
9151 [Guile] In -gh mode, don't forget to call SWIG_Guile_Init.
9152 Add a SWIG_contract_assert macro.
9154 11/23/2003: mkoeppe (Matthias Koeppe)
9155 [MzScheme] Update the configure check for the dynext object to work
9159 Fixed the include/import error reported by Kerim Borchaev,
9160 where two files with names like
9165 can not be include at the same time. Swig was including
9166 just the first one, assuming the second one was not a
9167 different one, since it was checking/keeping just the
9171 Changes to the SWIG runtime library support.
9172 - The -c command line option has been renamed to -noruntime
9173 - New command line option: -runtime. When supplied, this
9174 inserts the symbol SWIG_GLOBAL into the wrapper code. This,
9175 in turn, makes all of the runtime support functions globally
9177 - New library file: swigrun.i. Used to create modules
9178 for runtime library (if needed).
9180 11/18/2003: cheetah (William Fulton)
9181 'make srcrpm' rpmbuild fix - patch from Joe Cooper
9183 11/18/2003: mkoeppe (Matthias Koeppe)
9184 [Guile] Change meaning of configure option --with-guile to
9185 the name of the Guile executable. The new option --with-guile-prefix
9186 can be used to specify the tree where Guile is
9187 installed. (However, usually it suffices to use the
9188 single option --with-guile-config.)
9189 When running the run tests test-suite, make sure to use the
9190 version of Guile that SWIG was configured for.
9192 11/17/2003: mkoeppe (Matthias Koeppe)
9193 [Guile] Improvements to object-ownership management in
9194 "-scm" mode. (They do not apply to the default "-gh" mode.)
9195 * Renamed the smob type that indicates that the object can
9196 be garbage collected from "collected swig" to "collectable
9197 swig", which is more precise.
9198 * Export the destructor functions again. It is now
9199 allowed to explicitly call destructors, even for
9200 garbage-collected pointer objects. A pointer object
9201 that has been passed to a destructor is marked in a
9202 special way using a new smob type, "destroyed swig".
9203 (This helps avoid nasty memory bugs, where references to
9204 dead C objects are still held in Scheme. Moreover, the
9205 garbage collector will not try to free a destroyed
9207 * Destructor-like functions can also mark their arguments
9208 as destroyed by applying the typemap SWIGTYPE *DESTROYED.
9209 (It calls the function SWIG_Guile_MarkPointerDestroyed.)
9210 * Functions that "consume" their objects (or that "own"
9211 them after the call) can mark their arguments as
9212 not garbage collectable. This can be done by applying
9213 the typemap SWIGTYPE *CONSUMED. (It calls the function
9214 SWIG_Guile_MarkPointerNoncollectable.)
9215 * The macro TYPEMAP_POINTER_INPUT_OUTPUT from library
9216 pointer-in-out.i creates additional typemaps
9217 PTRTYPE *INPUT_CONSUMED, PTRTYPE *INPUT_DESTROYED.
9218 They mark the passed pointer object likewise.
9219 The typemap PTRTYPE *OUTPUT creates a garbage-collectable
9220 pointer object, like %newobject does for a returned
9221 pointer. Use the new typemap PTRTYPE *OUTPUT_NONCOLLECTABLE
9222 to create a pointer object that will not be garbage collected.
9224 11/17/2003: mkoeppe (Matthias Koeppe)
9225 [Guile] Handle $input in "freearg" typemaps.
9226 Never qualify GOOPS slot names with the class name.
9227 Handle optional arguments properly in the GOOPS methods.
9229 11/16/2003: cheetah (William Fulton)
9230 Fixes for installation to work with the upcoming Automake-1.8.
9231 mkinstalldirs was being used by a non-Automake makefile.
9232 mkinstalldirs is being phased out and so was not being
9233 created by Automake. install-sh used instead.
9235 11/16/2003: cheetah (William Fulton)
9236 [Java] Numerous director improvements, tweaks and bug fixes since
9237 the initial implementation have been contributed by Scott Michel.
9240 [Python] When %feature("shadow") is used to add code to shadow
9241 classes, the special variable $action expands to the name of the
9242 underlying wrapper function that would have been called normally.
9245 [Python] When generating proxy class code, SWIG emits a few
9246 default methods for __repr__() and other Python special
9247 methods. Some of these methods are emitted after all of the
9248 contents of a class. However, this makes it hard to override
9249 the methods using %pythoncode and some other directives that
9250 allow code to be inserted into a class. These special methods
9251 are now emitted into the code *before* all of the other methods.
9252 Suggested by Eric Jones.
9255 Preprocessor enhancement. For include statements like this:
9257 %include "foo/bar.i"
9259 the directory "foo" is now added to the search path while
9260 processing the contents of bar.i. Thus, if bar.i includes other
9261 files in the same directory, they will be found. Previously,
9262 you would have to add additional directories using -I to make this
9263 work correctly. Note: the C preprocessor seems to behave in
9264 an identical manner on many (most? all?) systems.
9265 Suggested by Kerim Borchaev.
9268 Configuration changes to make SWIG work on Mac OSX 10.3.x (Panther).
9269 Tested with Python, Tcl, Perl, and Ruby---all of which seem to work.
9271 11/08/2003: cheetah (William Fulton)
9272 [Java] Fixed the typemaps in various.i which were mostly broken.
9273 char **STRING_IN and char **STRING_RET typemaps replaced with
9274 STRING_ARRAY. float *FLOAT_ARRAY_RETURN typemap removed.
9277 [Tcl] Tcl module now emits a safe module initialization function by
9278 default. It can be removed by running 'swig -nosafe'.
9280 11/04/2003: mkoeppe (Matthias Koeppe)
9281 [Guile] Only use the SCM_ API when the function
9282 `scm_slot_exists_p' exists (needed for GOOPS support).
9283 This function was renamed during the Guile 1.5 series
9284 from `scm_slots_exists_p'.
9285 Report the right runtime library when invoked with
9288 11/03/2003: mkoeppe (Matthias Koeppe)
9289 [Chicken] Fix #782052. The --with-chickencfg configure
9290 option (and others) were not accepted.
9292 11/02/2003: mkoeppe (Matthias Koeppe)
9293 [Guile] Merge new set of GOOPS changes by John Lenz.
9294 GOOPS objects are now manipulated directly by the C code.
9295 Some fixes to typemap-GOOPS interaction.
9297 11/02/2003: mkoeppe (Matthias Koeppe)
9298 [Guile] Remove the file argument to -scmstub and -goops.
9299 The Scheme files are now always called MODULE.scm or
9300 MODULE-primitive.scm, where MODULE is the module name and
9301 "primitive" can be changed by the -primsuffix option.
9302 The Scheme files are now placed in the directory given by
9303 the -outdir option, or the current directory.
9304 (Patch by John Lenz, slightly modified.)
9306 *** INCOMPATIBILITY [Guile] ***
9308 11/02/2003: mkoeppe (Matthias Koeppe)
9309 Unify the pointer-conversion runtime API. The standard
9311 * SWIG_NewPointerObj (POINTER, TYPE, FLAGS)
9312 -- Create an scripting object that represents a typed
9313 pointer. FLAGS are language specific.
9314 * SWIG_ConvertPtr (INPUT, RESULT, TYPE, FLAGS)
9315 -- Get a pointer from the scripting object INPUT and
9316 store it in the place RESULT. When a type mismatch
9317 occurs, return nonzero.
9318 * SWIG_MustGetPtr (INPUT, TYPE, ARGNUM, FLAGS)
9319 -- Get a pointer from the scripting object INPUT and
9320 return it. When a type mismatch occurs, throw an
9321 exception. If ARGNUM > 0, report it as the
9322 argument number that has the type mismatch.
9323 [Guile]: No changes.
9324 [MzScheme]: No changes.
9325 [Perl]: Add the function SWIG_NewPointerObj.
9326 The function SWIG_MakePtr is kept.
9327 The function SWIG_MustGetPtr is currently not
9329 [Python]: Add the function SWIG_MustGetPtr.
9330 [Ruby]: Add the function SWIG_MustGetPtr.
9331 [Tcl]: Remove the "interp" argument of
9332 SWIG_NewInstanceObj, SWIG_ConvertPtr,
9333 SWIG_ConvertPacked, and SWIG_ConvertPtrFromString.
9334 The function SWIG_MustGetPtr is currently
9336 No changes to Pike because its pointer conversion code did
9337 not look complete. No changes to PHP4, because I did not
9338 understand its runtime code. No changes to Chicken
9339 because major changes are expected soon anyway. No
9340 changes to Java, OCaml, C# because they do not seem to
9341 have a pointer-conversion runtime API.
9343 *** INCOMPATIBILITY [Tcl] ***
9345 11/02/2003: mkoeppe (Matthias Koeppe)
9346 [Perl5, PHP4, Pike, Python, Ruby, Tcl]: Use the
9347 preprocessor to rename external functions of the SWIG
9348 runtime API to follow the naming convention
9349 SWIG_<language>_<function>. This should allow linking
9350 more than one interpreter into a program.
9352 10/31/2003: cheetah (William Fulton)
9353 [C#] Fix since introducing the exception and std::string delegates.
9354 The fix overcomes linker errors when using more than one SWIG module.
9355 Problem reported by Andreas Schörk.
9358 Incorporated patch: [ 823302 ] Incr Tcl support.
9359 Contributed by Alexey Dyachenko.
9360 Note: needs documentation.
9363 Incorporated patch: [ 829325 ] new Python Module options and features.
9366 This patch makes a number of changes to the SWIG python module.
9368 1. Add -apply option, and change the default code
9369 output to use the foo(*args, **kw) calling syntax
9370 instead of using apply(). If the -apply option is
9371 given then code is generated as before. This is very
9372 similar to Patch #737281 but the new -modern option
9373 makes the second half of that patch unnecessary so it
9374 is not included here.
9376 2. Add -new_repr option. This is the same as my Patch
9377 #797002 which I will mark as closed since it is no
9378 longer needed. When this new option is used then the
9379 __repr__ methods that are generated for proxy classes
9380 will be more informative and give details about the
9381 python class and the C++ class.
9383 3. Add %feature("addtofunc"). It allows you to insert
9384 one or more lines of code inside the shadow method or
9385 function that is already generated, instead of
9386 replacing the whole thing like %feature("shadow") does.
9387 For __init__ it goes at the end, for __del__ it goes
9388 at the begining and for all others the code generated
9389 is expanded out to be like
9391 def Bar(*args, **kwargs):
9392 val = _module.Foo_Bar(*args, **kwargs)
9395 and the "addtofunc" code is inserted just before the
9396 return statement. If the feature is not used for a
9397 particular method or function then the shorter code is
9398 generated just like before.
9400 4. A little bit of refactoring to make implementing
9401 addtofunc a little easier.
9403 5. Added a -modern command-line flag that will cause
9404 SWIG to omit the cruft in the proxy modules that allows
9405 it to work with versions of Python prior to 2.2. The
9406 result is a simpler, cleaner and faster python proxy
9407 module, but one that requires Python 2.2 or greater.
9410 Incorporated patch: [ 829319 ] XML module tweaks.
9411 This adds a new command line option -xmllite that
9412 greatly reduces the amount of emitted XML code by
9413 eliminating some fields mostly used in SWIG's
9414 internal processing. Contributed by Robin Dunn.
9417 Incorporated patch: [ 829317 ] Adds DohSplitLines function.
9418 Contributed by Robin Dunn.
9421 Fixed [ 827907 ] argout objects not being wrapped properly (PATH).
9422 Patch contributed by Salvador Fandiño GarcÃa.
9425 Fixed [ 826996 ] perl type checking ignores perl subclasses.
9426 This enhancement makes it so wrapped classes and structs can
9427 be subclassed in Perl and used normally.
9428 Patch contributed by Salvador Fandiño GarcÃa.
9430 10/16/2003: cheetah (William Fulton)
9431 [C#] IntPtr marshalled with a void* instead of int in C function
9432 declarations. The casts thus look more conventional, for example:
9435 DllExport double SWIGSTDCALL CSharp_get_Shape_x(int jarg1) {
9437 Shape *arg1 = (Shape *) 0 ;
9438 arg1 = *(Shape **)&jarg1;
9442 DllExport double SWIGSTDCALL CSharp_get_Shape_x(void * jarg1) {
9444 Shape *arg1 = (Shape *) 0 ;
9445 arg1 = (Shape *)jarg1;
9451 Fixed a subtle problem with overloaded methods and smart pointers.
9452 If a class has overloaded methods like this:
9457 static int bar(int x, int y);
9460 and the class is used as a smart pointer:
9467 The SWIG would try to expose the static member Foo::bar
9468 through FooPtr---resulting bogus wrapper code and a compiler
9471 Due to the way in which overloading is handled, it is
9472 extremely difficult to eliminate the static method in
9473 this case. Therefore, it is still exposed. However,
9474 the generated code now compiles and works.
9476 10/05/2003: mkoeppe (Matthias Koeppe)
9477 [Guile, MzScheme, Chicken]: Remove symbol clashes between
9478 the runtime libraries by renaming all extern common.swg
9479 functions with the preprocessor.
9481 10/05/2003: mkoeppe (Matthias Koeppe)
9482 [Guile] Added basic GOOPS support, contributed by John Lenz.
9483 See the documentation for details.
9487 10/04/2003: mkoeppe (Matthias Koeppe)
9488 [Guile] New option, -only-setters, which disables
9489 traditional getter and setter procedures for structure slots.
9491 10/03/2003: mkoeppe (Matthias Koeppe)
9492 [Guile] Added run test for reference_global_vars by John Lenz.
9495 Partial solution to [ 792180 ] C++ smart-pointer/namespace mixup revisited.
9496 The problem is not easy to fix (at least it doesn't seem so), but is
9497 related to the instantiation of qualified templates inside of other
9498 namespaces. SWIG now generates an error message in this case rather
9499 than generating broken wrappers.
9502 Fixed [ 800012 ] ENTER macro from CORE/scope.h clashes with libc search.h.
9503 Reported by Britton Leo Kerin.
9506 Fixed [ 811518 ] Casting ints to doubles (w/ solution?)
9507 Addresses a problem with overloading in the Perl module.
9508 Reported by Gerald Dalley.
9511 [Guile with -scm option] Fix typo in generated code for
9512 procedures-with-setters. Reported by John Lenz.
9515 Fixed [ 812528 ] externs not correct when throw is in signature.
9516 Reported by Joseph Winston.
9518 09/23/2003: cheetah (William Fulton)
9519 SWIG was generating a number of symbols that didn't comply with
9520 the ISO C/C++ standard, in particular ISO/IEC 14882:1998(E) 17.4.3.1.2
9521 where double underscores are forbidden as well as symbols starting with
9522 an underscore followed by an upper case letter. Most of these have
9523 been rooted out. See new section added to internals.html development
9524 manual 'Symbol Naming Guidelines for Generated C/C++ Code'.
9526 09/23/2003: cheetah (William Fulton)
9527 Director typemap name changes:
9530 argoutv => directorargout
9532 *** POTENTIAL INCOMPATIBILITY ***
9534 09/19/2003: mrose (Mark Rose)
9535 [Python] Director constructors now default to __disown = 0,
9536 which is the intended behavior and fixes the director_finalizer
9537 test case under python.
9539 09/12/2003: cheetah (William Fulton)
9540 [C#] - Typemaps added for std::string and const std::string &.
9541 - New delegate for creating a C# string given a char *. It
9542 can be used by calling SWIG_csharp_string_callback as shown
9543 in the std::string 'out' typemap. Useful if the return type is
9544 mapped to a C# string and the calling function is responsible
9545 for cleaning up memory as the C# garbage collector doesn't
9546 free the memory created in C/C++ and then returned as a C# string.
9547 - The exception delegates have moved into an inner class in the
9548 intermediate class, thereby freeing up the static constructor.
9552 Major refactoring of iteration over lists and hashes. The
9553 DOH library now uses iterators. They work like this:
9555 List *l = (some list);
9558 for (i = First(l); i.item; i = Next(i)) {
9559 // i.item contains the actual list item.
9560 // i.item is NULL at end of list
9564 Hash *h = (some hash);
9566 for (j = First(h); j.item; j = Next(j)) {
9567 // j.item contains hash table item
9568 // j.key contains hash table key
9569 // Both j.item and j.key are NULL at end
9573 The old iteration functions Firstitem(), Nextitem(), Firstkey(),
9574 and Nextkey() are gone.
9576 The new iterators are simpler, result in better memory use,
9577 and may be faster. Also, there are no longer any problems
9578 iterating over the same list/hash in multiple places at
9579 the same time. For example, this is fine:
9582 for (i = First(l); i.item; i = Next(i)) {
9583 for (j = First(l); j.item; j = Next(j)) {
9588 (This never worked in previous versions).
9589 *** POTENTIAL INCOMPATIBILITY ***. This will probably break
9590 third party extensions to SWIG (or give them further encouragement
9591 to join the SWIG CVS-tree :-).
9593 09/10/2003: mkoeppe (Matthias Koeppe)
9594 [Guile] Fix memory leaks in the "list-vector.i" typemaps.
9596 09/09/2003: mkoeppe (Matthias Koeppe)
9597 [Chicken] Use C_mk_bool rather than C_mkbool. This fixes
9598 the wrapping of boolean values for Chicken 1.10 and newer.
9599 Reported by Dave <hundo@yahoo.com> / Felix Winkelmann
9600 <felix@proxima-mt.de>.
9602 09/05/2003: cheetah (William Fulton)
9603 [Java] Directors implemented for Java. In summary this is a big new feature
9604 which supports upcalls from C++ to Java. Code is generated to support C++
9605 callbacks to call into Java and true polymorphic behaviour for Java classes
9606 derived from C++ classes. See java.html for details. Contributed by
9610 Created contract example directory at /SWIG/Examples/contract
9611 Added simple contract examples (simple_c & simple_cxx)
9612 Modified contract module's output format
9616 09/01/2003: cheetah (William Fulton)
9617 Test-suite build improvements:
9618 - Multiple build directories working for the test suite, so it is now
9619 possible to run configure in multiple subdirectories and run the test
9620 suite in each of these sub directories.
9621 - 'make distclean' fixed so it doesn't bomb out on the Examples directory
9622 when using multiple subdiretory builds. Required the following directories
9624 Examples/GIFPlot/Perl -> Examples/GIFPlot/Perl5
9625 Examples/GIFPlot/Php -> Examples/GIFPlot/Php4
9626 These new directories used to be symbolic links to the old directory.
9627 Also the Examples/test-suite/Perl symbolic link has been removed.
9628 - Running the test-suite, other than from the root directory, say
9629 in Examples/test-suite/python will now display all the code being
9631 - The following 3 C# compilers are detected during configure and work with
9632 the test-suite: Mono, Portable.NET and Microsoft.
9635 Added inheritance support for design by contract feature.
9638 Fixed [ 794914 ] Wrong types in template specialization.
9639 SWIG was not handling arguments correctly in template
9640 partial specialization. For example,
9642 template<class T> class Foo<T *> {
9647 %template(FooInt) Foo<int *>;
9649 in this class, the return type of blah was set to
9650 'int **', but it should really be 'int *'. This has been
9651 fixed, but it will affect all prior uses of partial
9655 Fixed [ 786394 ] Patch for generated perl code does not compile under RedHat9.
9656 Reported by Scott Finneran.
9659 Fixed [ 791579 ] (unsigned) long long handled incorrectly (Tcl).
9660 This was an error in the Tcl typemaps.i file.
9661 Reported by Kjell Wooding.
9664 Fixed [ 797573 ] no way to rename classes coming from C structures.
9665 This problem relates to renaming of anonymous structures with a
9666 typedef. For example:
9673 Reported by Britton Leo Kerin.
9676 Fixed [ 797576 ] -help seems to imply that only tcl-specific options exist.
9677 Added a comment to alert user to other options.
9678 Reported by Britton Leo Kerin.
9681 Fixed [ 798205 ] Segfault in SWIG_ConvertPtr.
9682 Reported by Prabhu Ramachandran.
9684 08/30/2003: mrose (Mark Rose)
9685 Modified the director typemaps in python/std_complex.i to use the
9686 new-style macro and conversion functions, which eliminated some
9687 redundant code. Fixed a few bugs in these typemaps as well, although
9688 more testing is needed.
9690 08/29/2003: mrose (Mark Rose)
9691 Completed initial support for wrapping abstract classes with directors.
9692 Constructor wrappers will be generated for abstract classes that have
9693 directors, and instances of the director classes will be created regardless
9694 of whether the proxy class has been subclassed in the target language.
9695 No checks are made during construction to ensure that all pure virtual
9696 methods are implemented in the target language. Instead, calls to
9697 unimplemented methods will throw SWIG_DIRECTOR_PURE_VIRTUAL_EXCEPTION
9700 Integrated Prabhu Ramachandran's typemap patches, which provide director
9701 typemap support for enums and std::size_t, and fix a couple bugs in the
9702 director std::vector<> typemaps.
9704 08/29/2003: cheetah (William Fulton)
9705 [C#] Implemented exception handling for throwing C# exceptions from C/C++ code.
9706 A few delegate functions are available for calling which then throw the C#
9707 exception. Use the SWIG_CSharpThrowException function from C/C++ typemaps.
9708 See the generated wrapper code or csharphead.swg for all available exceptions.
9711 SWIG_CSharpThrowException(SWIG_CSharpException, "exception description");
9713 The 'throws' typemaps are also now implemented, so code is automatically
9714 generated to convert any C++ exception into a C# System.Exception when the C++
9715 method declares an exception specification such as:
9717 int foo() throw(Bar);
9719 Also any parameters that are references to a C++ class or a class passed by value
9720 and are passed as a C# null will now throw a C# NullReferenceException.
9722 08/29/2003: cheetah (William Fulton)
9723 [C#] Fix to match the calling convention of all pinvoke methods so that they
9724 match the calling convention used by default in the C# 'static extern' declarations
9725 (__stdcall is used on Windows).
9727 08/19/2003: cheetah (William Fulton)
9728 [Java] Reworked std::string typemaps. Fixes a number of string in std namespace
9729 problems. For example %template vector<string>. The templated class' get method
9730 wasn't returning a Java String, but a SWIGTYPE_p_string. Reported
9734 Fixed [ 763522 ] 1.3.19 segfault in SwigType_add_pointer/DohInsertitem.
9735 Related to problem with unnamed class handling in Perl module.
9738 Fixed [ 763563 ] Missing indication of optional arguments.
9739 Tcl module. Reported by Krzysztof Kozminski.
9742 Fixed [ 787432 ] long param handled as int. Tcl module
9743 now uses Tcl_GetLongFromObj to convert integer values.
9746 Fixed [ 775989 ] numeric template parameters. There were
9747 some errors in template expansion related to the use of
9748 arrays where the array dimension was a template parameter.
9749 It should work now. Reported by Bryan Green.
9751 08/10/2003: mrose (Mark Rose)
9752 Added a director typemap (outv) for return by value and cleaned up up a few
9753 of the commented director typemaps.
9755 08/10/2003: mrose (Mark Rose)
9756 Fixed constructor generation for director classes to ignore private
9757 constructors. Protected constructors are also ignored for now, pending
9758 a solution to the problem of wrapping classes that only define protected
9761 08/07/2003: cheetah (William Fulton)
9762 New commandline option -outdir <dir> to specify where the language specific
9763 files are to be generated. This is useful for target languages like Python,
9764 Java etc which generate proxy files in the appropriate language.
9765 This option does not apply to the C/C++ wrapper file.
9767 08/07/2003: cheetah (William Fulton)
9768 On Windows the generated files (other than the _wrap.c or _wrap.cxx files)
9769 were sometimes incorrectly being generated into the current directory unless
9770 the input file used the Unix path separator. The Windows path separator
9771 should now be used. Bug reported by Robert Davies.
9774 Added array variable set typemap to Perl module.
9777 Fixed [ 775677 ] Array init causes codegen bug..
9780 Fixed [ 779062 ] Class"\n"::foo not supported. SWIG
9781 should now correctly handle whitespace in between
9782 namespace qualifiers. For example "A :: Foo :: Bar".
9784 07/31/2003: cheetah (William Fulton)
9785 Fixes for parameters which are classes that are passed by value and have
9786 a default value. A copy constructor for SwigValueWrapper is required
9787 (SF #780056). Also fixed memory leak in these circumstances. These mods
9788 also fix SF #780054.
9791 Improved run-time error message for pointers in Python module.
9792 Contributed by Zooko.
9794 07/10/2003: ballabio (Luigi Ballabio)
9795 [Almost all languages] Wrappers for std::pair added.
9796 Typemaps for Python, Ruby, Guile and MzScheme.
9798 07/01/2003: mkoeppe (Matthias Koeppe)
9799 [Chicken] Handle the case of more than one argout typemap
9802 06/29/2003: cheetah (William Fulton)
9803 [Java, C#] SF #670949 request. The destructor wrapper function name is now
9804 configurable. A new attribute called methodname in the
9805 javadestruct/javadestruct_derived (Java) or csdestruct/csdestruct_derived (C#)
9806 typemaps specifies the method name. For example in Java the destructor is
9807 wrapped by default with the delete method:
9809 %typemap(javadestruct, methodname="delete") SWIGTYPE {...}
9811 06/27/2003: cheetah (William Fulton)
9812 [Java, C#] The throws attribute for adding exception classes to the throws
9813 clause also now works with the following typemaps:
9815 javain, javaout (Java)
9818 For example, the 'AnException' will be added to the throws clause in the
9821 %typemap(javaout, throws="AnException") int {
9822 int returnValue=$jnicall;
9823 if (returnValue==0) throw new AnException("Value must not be zero");
9827 06/25/2003: mrose (Mark Rose)
9828 [Python] Director typemap marshalling checks for null pointers when
9829 walking the parameter list instead of relying soley on the parameter
9830 count. Cures a segfault that occured for multiple argument inv typemaps.
9831 Someone with more Swig experience should probably review this code.
9833 06/24/2003: mkoeppe (Matthias Koeppe)
9834 [Chicken] Don't emit calls to "C_check_for_interrupt",
9835 which may result in an endless loop. Patch by felix@proxima-mt.de.
9837 06/20/2003: cheetah (William Fulton)
9838 [C#] Finalizers now use destructor syntax as the override which was used in
9839 the Finalize method is not in the ECMA standards, spotted by the MS compiler.
9841 06/10/2003: cheetah (William Fulton)
9842 [C#] A number of changes have been made to remove the Java naming
9843 that was used in the C# module.
9845 Typemap name changes:
9851 javainterfaces -> csinterfaces
9853 javaclassmodifiers -> csclassmodifiers
9855 javaimports -> csimports
9856 javaptrconstructormodifiers -> csptrconstructormodifiers
9857 javagetcptr -> csgetcptr
9858 javafinalize -> csfinalize
9860 Feature name changes:
9861 javaconst -> csconst
9862 javamethodmodifiers -> csmethodmodifiers
9865 pragma(java) -> pragma(csharp)
9866 jniclassbase -> imclassbase
9867 jniclassclassmodifiers -> imclassclassmodifiers
9868 jniclasscode -> imclasscode
9869 jniclassimports -> imclassimports
9870 jniclassinterfaces -> imclassinterfaces
9872 Special variable name changes:
9873 $javaclassname -> $csclassname
9874 $javainput -> $csinput
9877 This will break SWIG interface files that use these typemaps, features
9878 and pragmas. Please update your code or use macros for backwards
9881 *** POTENTIAL INCOMPATIBILITY FOR C# MODULE ***
9883 06/10/2003: mkoeppe (Matthias Koeppe)
9884 [MzScheme] Applied MzScheme module updates contributed by
9885 John Lenz <jelenz@students.wisc.edu>.
9887 - Updated mzscheme to use SWIG's common runtime type
9888 system from common.swg.
9890 - The Lib/mzscheme directory has been reorganized to
9891 standardize names across the language modules:
9892 mzscheme.i was moved to mzscheme.swg, mzscheme.swg and
9893 mzschemedec.swg have been removed, mzrun.swg (which
9894 contains the runtime code) has been added.
9896 - The swig_proxy structure was renamed to swig_mz_proxy.
9897 swig_mz_proxy now contains a pointer to a swig_type_info
9900 - Added varin and varout typemaps for SWIGTYPE [] and
9903 - Garbage collection by calling scheme_add_finalizer() has
9906 *** NEW FEATURE [MzScheme] ***
9908 06/10/2003: cheetah (William Fulton)
9909 [Java] New typemaps: javadestruct and javadestruct_derived
9910 for the C++ destructor wrapper. The javadestruct version gets used by
9911 classes at the top of an inheritance chain and the javadestruct_derived
9912 version gets used by other classes.
9914 [C#] cildispose and cildisposeoverride typemaps replaced by
9915 csdestruct and csdestruct_derived typemaps. The delete()
9916 method has been removed and its functionality put into these
9917 typemaps designed for the Dispose() method.
9919 - New typemaps csinterfaces and csinterfaces_derived replace
9920 the javainterfaces typemap. Also fixes the peculiarity of all classes
9921 in an inheritance chain individually deriving from the IDisposable
9924 - New typemap csfinalize for finalizers. C++ destructors are now called
9925 by garbage collector during finalization. Problem reported by
9929 Modified contract code for error message output.
9930 Contract code can now print out simple error message.
9931 Modified contract code to prepare for inheritance
9934 [Guile] Applied Guile module updates contributed by
9935 John Lenz <jelenz@students.wisc.edu>.
9937 - SWIG currently uses Guile's gh_ API, which is marked as
9938 deprecated in Guile 1.6 and will be removed in Guile
9939 1.9. This change introduces a command-line flag "-scm"
9940 which causes SWIG to generate wrappers that use Guile's
9941 SCM API instead; this requires Guile >= 1.6.
9943 - The Lib/guile directory has been reorganized to
9944 standardize names across language modules: guiledec.swg
9945 and guile.swg have been moved into guile_gh_run.swg,
9946 guile.i has been moved to guile_gh.swg, guile_scm.swg
9947 and guile_scm_run.swg which contain the SCM API stuff
9950 - ghinterface.i, which contains the defines from the gh_
9951 functions to the scm_functions has been added
9953 - The API for dealing with pointer objects is now
9954 SWIG_ConvertPtr, SWIG_MustGetPtr, SWIG_NewPointerObj.
9956 - Added varin and varout typemaps for SWIGTYPE [] and SWIGTYPE &
9958 - Garbage collection has been added.
9960 *** NEW FEATURE [Guile] ***
9962 06/01/2003: cheetah (William Fulton)
9963 Dimensionless arrays such as
9968 produce a warning that the variable is read-only. Depending on the target
9969 language, this used to cause compile errors or generate a setter that
9970 generated a runtime error. A setter cannot be automatically generated
9971 because the array size cannot be determined by SWIG. A varin, globalin
9972 or memberin typemap (depending on the target language) must be written
9976 Refinement to default typemap matching and arrays. When an
9977 array is declared like this:
9981 The default typemap now resolves to
9985 If no match is found for that, it then resolves to
9989 If no array dimension is specified in the original declaration,
9990 the SWIGTYPE [] is used right away.
9992 Note: This change has been made to resolve problems related to
9993 arrays with and without dimensions. For example, sometimes SWIG
9994 was generating setter functions for array variables with no dimensions
9995 (an error). Likewise, SWIG sometimes made arrays with dimensions
9996 read-only (also an error). This fixes the arrays_global test
10000 Fixed subtle type handling bug with references and pointers.
10001 If you had functions like this:
10006 void func2(Bar &x);
10008 Then func2() wouldn't accept objects returned by func1()
10009 because of a type error. It should work now.
10010 Reported by Brian Yang.
10012 05/21/2003: cheetah (William Fulton)
10013 Fixes to some of the Visual C++ example project files which would not
10014 work with spaces in the paths held in the environment variables used to
10015 point to the target language's library / include directory.
10018 05/21/2003: songyanf (Tiger)
10019 Added -contracts option.
10020 First try of the idea of "Wrap by Contract":
10021 build up realiable cross-language module by wrapping with SWIG.
10022 Implemented basic assertion
10023 (preassertion & postassertion & invariant)
10024 for simple C/C++ functions.
10026 Current format of contracts are:
10027 %contract class_name :: func_name (paras...) {
10039 *** NEW FEATURE ***
10041 05/19/2003: cheetah (William Fulton)
10042 Build tweaks. There were a few preprocessor definitions which were
10043 specified in the Makefile for passing on the commandline when compiling.
10044 These are now all defined in swigconfig.h. Autoconf doesn't normally
10045 allow installation directories to be defined in this config header file,
10046 but an autoconf archive macro enables this. This macro along with future
10047 autoconf macros are going to be put in the Tools/config directory.
10049 'swig -version' now reports the target build platform.
10051 05/11/2003: cheetah (William Fulton)
10052 [C# and Java] Fix to the following typemaps:
10054 javabase, javainterfaces, javaimports, javaclassmodifiers,
10055 javaptrconstructormodifiers, javafinalize, javagetcptr & javacode.
10057 These are the typemaps for modifying/generating proxy classes.
10058 Previously the typemaps would use the proxy class name and not the
10059 C++ type, which was inconsistent with all other typemaps.
10061 In most circumstances the proxy class name and the C++ class name/type
10062 is the same except for classes in namespace, templated classes etc. so
10063 this shouldn't affect most cases.
10065 *** POTENTIAL INCOMPATIBILITY FOR JAVA and C# MODULES ***
10067 05/09/2003: cheetah (William Fulton)
10068 Visual C++ Project files have been added so that the runtime libraries
10069 can be built on Windows (for Tcl, Perl, Python and Ruby).
10071 05/01/2003: beazley
10072 Fixed problem with return by value, const, and private constructors.
10084 const B returnB() const;
10088 Problem and patch suggestion reported by Bill Hoffman.
10090 04/29/2003: cheetah (William Fulton)
10092 - Single autoconf invocation - autoconf in the Tools directory has gone.
10094 - Libtool bootstrapped when running autogen.sh. This requires anyone
10095 using the cvs version of SWIG to have libtool installed on their
10096 machine. Suggest version 1.4.2 or higher, preferably the latest - 1.5.
10098 - Automake is now used to build the runtime libraries in conjunction
10101 - Runtime libraries are now successfully built as DLLs on Cygwin.
10103 - Skipping languages is no longer just determined in the top level
10104 makefile but in configure.in. This info is used for building
10105 the runtime libraries and for running the examples and test-suite.
10107 - These changes have fixed multiple build directory builds, that is
10108 building from directories other than the top level directory.
10109 Installation from multiple build directories also working. An initial
10110 configure in the top level directory is no longer needed as described
10111 in 04/02/2003 entry. A 'make distclean' will be needed before building
10112 in a directory other than the top level directory if the autotools
10113 have been run from this top level directory at some point, but
10114 autoconf will tell you this. Note that 'make check' only works from
10115 the top level directory at the moment.
10117 04/28/2003: beazley
10118 Fixed [ 723471 ] Wrapper_print() fails with preprocessor directives.
10120 04/28/2003: beazley
10121 Minor refinement of const static member variable handling
10122 described in CHANGES 08/11/2002. Previously, SWIG merely
10123 checked to see if there was an initializer in the declaration.
10124 Now, SWIG additionally checks to make sure the static member
10127 04/25/2003: ljohnson (Lyle Johnson)
10128 [Ruby] Added a kind of limited support for multiple inheritance,
10129 activated using the -minherit command-line option. I've also updated
10130 the "C++ Inheritance" section of the Ruby documentation to discuss
10131 how this works, and its limitations. Also also modified the minherit.i
10132 test case to run against this.
10134 04/25/2003: ljohnson (Lyle Johnson)
10135 [Ruby] Added the -globalmodule command-line option for the Ruby
10136 module, for wrapping stuff into the global module (Kernel) instead
10137 of a nested module. Updated documentation accordingly.
10139 04/23/2003: mrose (Mark Rose)
10140 Fixed symname error in director calls to Python methods
10141 that extend C++ operators.
10143 Stopped director destructor wrappers from calling __set_up,
10144 which was leaving the director flag in an inconsistent state.
10146 04/23/2003: beazley
10147 Fixed problem with namespace resolution and nested namespaces.
10148 Reported by Alfred Lorber (and Marcelo Matus).
10150 04/16/2003: cheetah (William Fulton)
10151 Patch for Java examples and test-suite to run on Mac OS X.
10153 04/15/2003: ljohnson (Lyle Johnson)
10154 [Ruby] Incorporated Nobu Nakada's patches for supporting the Ruby
10155 1.8 allocation framework.
10157 04/15/2003: ljohnson (Lyle Johnson)
10158 [Ruby] Replaced all uses of the deprecated STR2CSTR() macro with the
10159 safer StringValuePtr() macro. For more information, see ruby-talk:67059
10160 and follow-ups to that post.
10162 04/11/2003: beazley
10163 Fixed problem with preprocessor macro expansion. For example:
10165 #define min(x,y) ((x) < (y)) ? (x) : (y)
10168 Reported by Sebastien Recio.
10170 04/10/2003: cheetah (William Fulton)
10171 [Java] Added a runtime check to typemaps in arrays_java.i library to check
10172 that the Java array passed in is the same size as the C array and throw an
10175 Also fix to use delete instead of free for arrays created using new.
10177 04/07/2003: cheetah (William Fulton)
10178 Remove GCC3 warning when compiling the examples and test-suite:
10180 cc1plus: warning: changing search order for system directory "/usr/include"
10181 cc1plus: warning: as it has already been specified as a non-system directory
10183 See SF patch #715531 submitted by Gerald Williams
10185 04/03/2003: cheetah (William Fulton)
10186 [C#] Improved wrapping of enums and constants. These were previously
10187 wrapped as C# variables rather than constants. Either these are wrapped
10188 as readonly (runtime) constants or compile time constants, depending on
10189 the %javaconst directive (The directive is likely to change name soon).
10190 For example wrapping:
10196 public static readonly int ABC = examplePINVOKE.get_ABC();
10197 public const int XYZ = 33;
10199 04/03/2003: cheetah (William Fulton)
10200 [Java] Global constants and enums are put in their own interface called
10201 xxxConstants, where xxx is the module name. This is an improvement as
10202 it is possible to derive (implement) a Java class from the xxxConstants
10203 interface to improve the syntax; namely when wrapping:
10204 enum {ONE=1, TWO, THREE};
10205 accessing these from a Java class implementing xxxConstants is neater:
10208 int number = xxx.ONE;
10210 Patch submitted by Dave Dribin.
10212 04/02/2003: cheetah (William Fulton)
10213 Build improvements for multiple builds. This allows one to build
10214 the SWIG executable and runtime libraries for different platforms/compilers
10215 etc by running configure in different directories. This isn't 100% just
10216 yet and won't be until libtool is better configured... a 'configure' and
10217 'make distclean' needs to be run in the root directory before it all works.
10221 $ mkdir config1; cd config1; ../configure CC=gcc CXX=g++; make; cd ..
10222 $ mkdir config2; cd config2; ../configure CC=cc CXX=c++; make; cd ..
10224 To be improved. A 'make check' does not work yet either.
10226 04/01/2003: beazley
10227 Fixed template partial specialization argument expansion bug.
10228 This showed up when trying to use std_vector.i with vectors
10231 03/31/2003: cheetah (William Fulton)
10232 Fix for parallel make builds of SWIG, for example
10234 Build failure reported by Bill Clarke.
10236 03/28/2003: beazley
10241 Version 1.3.19 (March 28, 2003)
10242 ===============================
10244 03/28/2003: beazley
10245 Variety of minor bug fixes to the 1.3.18 release including:
10247 - Segmentation fault with %extend directive.
10248 - Typemap variable substitution bug.
10249 - Expression evaluation bug.
10250 - Large memory leak with template expansion.
10252 Version 1.3.18 (March 23, 2003)
10253 ===============================
10255 03/21/2003: beazley
10256 Fixed two problems with the %extend directive, overloading, and
10257 template expansion. See the 'template_extend_overload' and
10258 'template_extend_overload_2' tests in Examples/test-suite for
10261 03/20/2003: cheetah (William Fulton)
10262 [C#] Added some typemaps as suggested by Andreas Schoerk for handling
10263 parameters that are passed as pointers or by reference. These have
10264 been put in typemaps.i.
10266 03/20/2003: beazley
10267 Fixed a C++ scoping bug related to code like this:
10274 Previously, SWIG just tossed out the Foo::bar() declaration. Now,
10275 the declaration is wrapped provided that the prefix is exactly the
10276 same as the current scope (including any enclosing namespaces).
10277 Reported by Bruce Lowery.
10279 03/20/2003: beazley
10280 Incorporated [ 696516 ] Enabling exception processing for data member access.
10281 In some compilers, attribute access can generate exceptions. However,
10282 SWIG ordinarily assumes that no exceptions will be raised. To disable this,
10283 use the %feature("allowexcept"). For example:
10285 %feature("allowexcept") Foo::x;
10289 int x; /* Exception handling enabled */
10293 Patch contributed by Yakov Markovitch.
10295 03/20/2003: beazley
10296 Incorporated Patch. [ 701860 ] Improve Performance (python proxies).
10297 Gives a performance boost to proxy class code and the management of the
10298 .this and .thisown attributes. Contributed by Mike Romberg.
10300 03/19/2003: cheetah (William Fulton)
10301 [C# and Java] Added missing vararg support.
10303 03/18/2003: mrose (Mark Rose)
10304 Removed code related to tagging individual methods for directors.
10305 The concept of having directors for some but not all virtual methods
10306 of a class is deeply flawed. The %feature("nodirector") tag is also
10309 Directors are off by default. To enable them for a class, issue
10310 %feature("director") classname; which will create director methods
10311 for every virtual method in the hierarchy of the class.
10313 03/17/2003: beazley
10314 Fixed a subtle problem with passing arguments of type function. For
10317 int foo(int x(int, int));
10321 typedef int binop_t(int, int);
10322 int foo(binop_t x);
10324 In old versions, this would produce code that wouldn't compile. Now,
10325 SWIG merely adds an extra pointer, making these declarations the same
10328 int foo(int (*x)(int, int));
10330 typedef int binop_t(int, int);
10331 int foo(binop_t *x);
10333 Reported by Garth Bushell.
10335 03/17/2003: mrose (Mark Rose)
10336 Fixed the return statement for director base class calls that have no
10339 03/15/2003: beazley
10340 Fixed a problem with const smart-pointer wrapping. For example:
10351 const Foo *operator->();
10355 In this case, only "x" and "bar" are visible from Blah (since application
10356 of spam violates constness). Moreover, access to "x" is read-only.
10358 03/15/2003: mrose (Mark Rose)
10359 Cleaned up two signed versus unsigned comparisons in python/std_vector.i.
10361 03/15/2003: cheetah (William Fulton)
10362 [C#] Global variables are wrapped using properties instead of get and set methods.
10363 Member variable wrapping bug fixes, for example wrapping pointers work now.
10364 Typemaps are used for all variable wrapping to generate the property code.
10366 03/13/2003: mrose (Mark Rose)
10367 Fixed a bug in the virtual method unrolling for directors.
10368 The order of unrolling is now from base to derived, to ensure
10369 that the most derived implementation of a director method is
10372 Director methods for pure virtual methods now throw
10373 DIRECTOR_PURE_VIRTUAL_EXCEPTION if _up is set.
10375 03/12/2003: cheetah (William Fulton)
10376 [C#] Polymorphism fix: virtual functions now use the appropriate
10377 keyword in the C# proxy class, virtual or override.
10378 Some 'using System;' statement fixes needed by the Mono compiler.
10380 03/11/2003: beazley
10381 Fixed subtle bug in the application of SwigValueWrapper<> to
10382 template classes with default constructors. Reported by
10385 03/11/2003: beazley
10386 The $descriptor(type) variable is now expanded in code supplied to
10387 %extend. This is useful for certain kinds of advanced wrapping
10388 (especially container classes).
10391 Support for std::map.
10392 (a) Integration with scripting language (a la std::vector) for
10393 Python, Ruby, MzScheme, and Guile;
10394 (b) Simple wrapper for other languages
10396 03/10/2003: beazley
10397 Fixed problem with escape sequences in string and character constants. SWIG
10398 wasn't parsing certain octal codes correctly.
10400 03/07/2003: beazley
10401 Fixed a variety of subtle preprocessor problems reported by
10404 (a) Empty preprocessor values no longer generate "bad constant
10405 value" errors. For example:
10410 (b) Macro names can now span multiple lines (technically valid,
10411 although questionable practice). For example:
10413 #define A_LONG_MACRO_\
10416 (c) Whitespace is no longer required before certain macro values.
10423 03/07/2003: ljohnson (Lyle Johnson)
10424 [Ruby] Added missing long long and unsigned long long typemaps
10425 in the Lib/ruby/typemaps.i library file.
10427 03/07/2003: mrose (Mark Rose)
10428 Added Examples/python/callback to demostrate how directors can
10429 be used to implement callbacks in Python
10430 Added Examples/python/extend to demonstrate virtual method
10431 calls from C++ to Python (really the same as the callback
10432 example, just a different context).
10433 Added four tests for very basic director functionality. These
10434 have runtime tests under python.
10435 The Python module now emits #define SWIG_DIRECTORS near the
10436 top of the output file if directors are enabled. This is useful
10437 for disabling parts of tests in target languages that don't
10440 03/06/2003: mrose (Mark Rose)
10441 Added a section to Doc/Manual/Python.html on cross language
10442 polymorphism (directors).
10444 03/06/2003: mrose (Mark Rose)
10445 The short-lived "-fdirectors" command line option has been
10446 removed. To enable directors, instead use the extended %module
10447 directive as follows:
10449 %module(directors="1") modulename
10451 03/06/2003: cheetah (William Fulton)
10452 The long long typemaps have been rewritten so that they can be more
10453 easily used with non ISO compilers, like Visual C++. For example
10454 if you are wrapping the Windows 64 bit type __int64 the long long
10455 typemaps can be used with %apply:
10457 %apply long long { __int64 };
10458 __int64 value1(__int64 x);
10460 __int64 will now appear in the generated code instead of long long.
10462 03/06/2003: beazley
10463 *** DEVELOPER CHANGE ***
10464 Swig module mutation has been changed slightly. When a language
10465 class method wants to save node attributes, it now uses one of the
10466 following functions:
10471 The first argument to these functions is a namespace in which
10472 saved attributes are placed. For example,this code
10475 Swig_save("cDeclaration",n,"type","parms","name",NIL);
10477 saves the attributes as "cDeclaration:type", "cDeclaration:parms",
10478 and so forth. If necessary, a language module can refer to
10479 old values by using this special namespace qualifier.
10481 In addition to this, a special attribute "view" contains the name
10482 of the last namespace used to save attributes. In the above
10483 example, "view" would have the value "cDeclaration". The value
10484 of "cDeclaration:view" would have the previous view and so forth.
10486 Swig_restore(n) restores a node to the state before the last
10487 Swig_require() or Swig_save() call.
10489 Note: This change makes it easier for language modules to refer
10490 to old values of attributes.
10493 03/06/2003: mrose (Mark Rose)
10494 Merged the cross-language polymorphism patch. When enabled, C++
10495 "proxy" classes (called directors) are generated for each specified
10496 C++ class. Directors pass method calls from C++ to Python, similar
10497 to the way the usual proxy (shadow) classes pass method calls from
10498 Python to C++. Together, these two types of proxies allow C++
10499 classes that are extended in Python to behave just like ordinary
10500 C++ classes and be used in C++ like native objects.
10502 This feature is still very experimental and is disabled by default.
10503 To enable director support, specify '-fdirectors' on the SWIG command
10504 line or in the SWIG_FEATURES environment variable. In the interface
10505 file, add %feature("director") to generate directors for all classes
10506 that have virtual methods.
10508 See http://stm.lbl.gov/~tm2/swig/ProxyDoc.html for more details.
10511 03/03/2003: beazley
10512 Fixed a small glitch in typemap local variable replacement. If you had
10513 a typemap like this:
10515 %typemap(in) type ($1_type temp) {
10521 and no occurrence of "$1_type" appeared in the body, then the local
10522 variable type wouldn't be substituted.
10524 03/03/2003: cheetah (William Fulton)
10525 [C#] New version of the CSharp module which is typemap based.
10526 It also uses ECMA C# and no longer uses Microsoft Visual C++.NET
10527 glue. This means that it will work on non-Windows platforms.
10528 Contributed by Neil Cawse.
10530 02/27/2003: beazley
10531 Fixed [ 653548 ] error parsing casting operator definition.
10532 SWIG now ignores casting operators declared outside of a class.
10535 inline A::operator char *() { ... }
10537 Bug reported by Martin Casado.
10539 02/27/2003: beazley
10540 Added support for anonymous bit-fields. For example:
10548 Anonymous bit-fields are ignored by SWIG. Problem
10549 reported by Franz Höpfinger.
10551 02/26/2003: cheetah (William Fulton)
10552 [Java] Better typemaps in the Examples/java/typemap example and also
10553 fixes subtle bug when using the StringBuffer typemaps more than once.
10555 02/26/2003: beazley
10556 Fixed [ 642112 ] Constants char bug.
10558 02/26/2003: beazley
10559 Fixed [ 675337 ] Partial template specialization not entirely working.
10560 There was a subtle problem related to the naming and ordering of
10561 template partial specialization arguments. Matching worked okay,
10562 the resulting templates weren't expanded correctly.
10564 02/25/2003: beazley
10565 Fixed problem with parsing (and generating code) for
10566 references to arrays. For example:
10568 int foo(int (&x)[10]);
10570 02/25/2003: beazley
10571 Fixed [ 635347 ] Compilation warning from libpy.c.
10572 Reported by Daniel L. Rall.
10574 02/25/2003: beazley
10575 Fixed a subtle problem with virtual method implementation
10576 checking and typedef.
10578 typedef int *intptr;
10581 virtual int *foo() = 0;
10583 struct B : public A {
10584 virtual intptr foo() { };
10587 SWIG was treating these declarations as different even though
10588 they are the same (via typedef).
10590 02/25/2003: ljohnson (Lyle Johnson)
10591 [Ruby] Added range checking for the NUM2USHRT macro, per [ 675353 ].
10593 02/24/2003: beazley
10594 Fixed a subtle problem with the code that determined if a class is abstract
10595 and can be instantiated. If you had classes like this:
10598 virtual int foo(int) = 0;
10600 struct B : virtual A {
10601 virtual int foo(int);
10604 struct C : virtual A {
10607 /* Note order of base classes */
10608 struct D : B, C { }; /* Ok */
10609 struct E : C, B { }; /* Broken */
10611 then SWIG determined that it could instantiate D(), but not E().
10612 This inconsistency arose from the depth-first search of the
10613 inheritance hierarchy to locate the implementations of virtual
10614 methods. This problem should now be fixed---SWIG will attempt
10615 to locate any valid implementation of a virtual method by
10616 traversing over the entire hierarchy.
10618 02/22/2003: cheetah (William Fulton)
10619 [Java] Fix for using enum typemaps. The Java final static variable type
10620 can be set using the jstype typemap, enabling enums to be mapped to
10621 something other than int. Bug reported by Heiner Petith.
10623 02/21/2003: songyanf (Tiger)
10624 Added CSharp (C#) module prototype
10625 i.e. csharp.cxx & csharp.h at Source/Modules/.
10626 They are for test usage only now and need improvement.
10627 The interface also need to be modified.
10629 *** NEW FEATURE ***
10631 02/20/2003: songyanf (Tiger)
10632 Fixed problem with typedef with -fvirtual.
10633 Similar as beazley's modification today.
10635 02/20/2003: beazley
10636 Added support for gcc-style variadic preprocessor macros.
10637 Patch [ 623258 ] GCC-style vararg macro support.
10638 Contributed by Joe Mason.
10640 02/20/2003: beazley
10641 Fixed [ 605162 ] Typemap local variables.
10642 Reported by Lyle Johnson.
10644 02/20/2003: beazley
10645 Fixed problem with abstract classes and typedef. For example:
10649 virtual void foo(int x) = 0;
10652 typedef int Integer;
10653 class Bar : public Foo {
10655 virtual void foo(Integer x);
10658 SWIG was getting confused about the latter method---making Bar
10659 abstract. Reported by Marcelo Matus.
10661 02/19/2003: cheetah (William Fulton)
10662 [Java] %javaconst(flag) can also be used on enums as well as constants.
10663 This feature enables true Java compiler constants so that they can be
10664 used in Java switch statements. Thanks to Heiner Petith for patches.
10666 02/19/2003: songyanf (Tiger)
10667 Modified -fcompact feature to deal with PP lines
10669 02/18/2003: beazley
10670 Fixed [ 689040 ] Missing return value in std_vector.i.
10671 Reported by Robert H. de Vries.
10673 02/18/2003: beazley
10674 Fixed a few evil scoping problems with templates, namespaces, and the
10675 %extend directive. Problem reported by Luigi Ballabio.
10678 02/18/2003: cheetah (William Fulton)
10679 [Ruby] Improved support for Visual C++ and other native Windows compilers.
10680 It is no longer necessary to specify "/EXPORT:Init_<module>", where <module> is the
10681 swig module name when linking using these native Windows compilers.
10683 02/15/2003: songyanf (Tiger)
10684 Added -fvirtual option.
10685 Reduce the lines and size of the wrapper file
10686 by omitting redifined virtual function in children classes.
10688 Modified -compact option to -fcompact option
10690 Added -small option.
10691 -small = -fvirtual -fcompact
10692 And it can be extended by future feature options,
10693 which are used to reduce wrapper file szie.
10695 Added SWIG_FEATURES environment variable check.
10696 To dynamically set the feature options such as -fcompact & -fvirtual
10697 *** NEW FEATURE ***
10700 Updated Doc/Manual/Perl5.html to talk about C++ compile problems
10701 configure.in now checks for PERL5_CCFLAGS
10702 Runtime/Makefile.in and Example/Makefile.in now use PERL5_CCFLAGS
10703 Added Lib/perl5/noembed.h which contains all the known macro conflicts
10705 02/12/2003: beazley
10706 Fixed [ 685410 ] C++ Explicit template instantiation causes SWIG to exit.
10707 Fixes a syntax error with declarations similar to this:
10709 template class std::vector<int>;
10711 SWIG now ignores the instantiation and generates a warning message.
10712 We might do more later. Reported by Thomas Williamson.
10714 02/11/2003: cheetah (William Fulton)
10715 Rewrote bool typemaps to remove performance warning for compiling generated code
10718 02/11/2003: cheetah (William Fulton)
10719 Fix for wrapping reference variables (const non-primitive and all non-const types)
10725 02/11/2003: beazley
10726 Fixed more very subtle preprocessor corner cases related to recursive
10727 macro expansion. For example:
10729 #define cat(x,y) x ## y
10731 cat(cat(1,2),3) // Produces: cat(1,2)3
10733 #define xcat(x,y) cat(x,y)
10735 xcat(xcat(1,2),3) // Produces 123
10737 See K&R, 2nd Ed. p. 231.
10739 02/10/2003: cheetah (William Fulton)
10740 Fixed [ 683882 ] - patch submitted by F. Postma for SWIG to compile on HP-UX.
10742 02/10/2003: beazley
10743 Fixed subtle preprocessor argument expansion bug. Reported by Marcelo Matus.
10745 02/10/2003: songyanf
10746 Added -compact option.
10747 Reduce the lines and size of the wrapper file
10748 by omitting comments and combining short lines.
10749 *** NEW FEATURE ***
10751 02/07/2003: beazley
10752 Fixed [ 651355 ] Syntax error with cstring.i
10753 Reported by Omri Barel.
10755 02/07/2003: beazley
10756 Fixed [ 663632 ] incompatibility with standard cpp.
10757 This is a refinement that fixes this problem:
10759 // Some macro with an argument
10762 int FOO; /* Not a macro---no arguments */
10764 02/05/2003: beazley
10765 Fixed [ 675491 ] parse error with global namespace qualification.
10766 Submitted by Jeremy Yallop.
10768 02/04/2003: beazley
10769 Fixed bug in varargs processing introduced by the numinputs typemap parameter.
10772 [xml] Fix string-replacement ordering buglet.
10773 Thanks to Gary Herron.
10775 12/23/2002: cheetah (William Fulton)
10776 Further build changes:
10777 - The SWIG executable is now built using a single Makefile.
10778 - This makefile is generated by Automake (Source/Makefile.am).
10779 - Dependency tracking and tags support are in this makefile.
10780 - Automake 1.7.2 and Autoconf 2.54 minimum versions are needed to build SWIG from CVS.
10781 - Running ./autogen.sh now installs Autoconf/Automake support files into
10782 Tools/config and these files are no longer stored in CVS.
10783 - Bug fixes in 'make install' for systems using .exe executable extension and
10784 ./configure --with-release-suffix=whatever
10786 12/16/2002: cheetah (William Fulton)
10787 More build changes:
10788 - Autoconf's AC_CANONICAL_HOST replaces proprietary approach for detecting build host.
10789 - Autoconf support files moved to Tools/config.
10791 12/16/2002: cheetah (William Fulton)
10792 Modifications to run on MacOS, submitted by Bernard Desgraupes.
10793 Mainly ensuring generated files are output in the appropriate directory for
10796 12/11/2002: cheetah (William Fulton)
10797 Various build modifications and bug fixes:
10798 - Simplification of version string. Use autoconf's PACKAGE_VERSION instead.
10799 - Build time removed from SWIG version.
10800 - Using standard autoconf config header generation.
10801 - Updated old autoconf macros as reported by autoupdate.
10802 - Removed $prefix in autoconf from search paths as autoconf won't expand them.
10803 - Subtle bug fix where 'make prefix=/somewhere; make clean; make prefix=/somwhere/else'
10804 produced an executable using the incorrect library directories.
10805 - Added -ldflags commandline option for MzScheme, Ocaml, Pike and PHP.
10806 - Fixed reporting of compiler used when using -version commandline option.
10807 - SWIG web address added to -version commandline option.
10809 12/11/2002: beazley
10810 Minor fix to Tcl dynamic cast typemaps. Reported by
10813 12/10/2002: beazley
10814 Fixed subtle template argument replace bug. Reported by
10817 12/10/2002: beazley
10818 Reverted CHANGES 09/03/2002, preprocessor argument evaluation. Arguments
10819 are not evaluated during collection, K&R, p. 230.
10821 12/06/2002: beazley
10822 Fixed [ 649022 ] Compilation problems with KAI/KCC
10824 12/02/2002: beazley
10825 SWIG 'rel-1-3' CVS branch merged back into the main branch.
10828 Version 1.3.17 (November 22, 2002)
10829 ==================================
10831 11/19/2002: beazley
10832 Fixed [ 613922 ] preprocessor errors with HAVE_LONG_LONG.
10834 11/19/2002: beazley
10835 Fixed [ 615480 ] mzscheme SWIG_MustGetPtr_.
10837 11/19/2002: beazley
10838 Fixed [ 635119 ] SWIG_croak causes compiler warning.
10840 11/16/2002: cheetah (William Fulton)
10841 [Java] Added typemaps for pointers to class members.
10843 11/15/2002: cheetah (William Fulton)
10844 [Java] Bug fix: Overloaded C++ functions which cannot be overloaded in Java
10845 once again issue a warning.
10847 11/14/2002: cheetah (William Fulton)
10848 [Java] Handling of NULL pointers is improved. A java null object will now
10849 be translated to and from a NULL C/C++ pointer by default. Previously when
10852 class SomeClass {...};
10853 void foo(SomeClass *s);
10855 and it was called from Java with null:
10857 modulename.foo(null)
10859 a Java NullPointerException was thrown. Extra typemaps had to be written in
10860 order to obtain a NULL pointer to pass to functions like this one. Now the
10861 default wrapping will detect 'null' and translate it into a NULL pointer.
10862 Also if a function returns a NULL pointer, eg:
10864 SomeClass *bar() { return NULL; }
10866 Then this used to be wrapped with a SomeClass proxy class holding a NULL
10867 pointer. Now null is returned instead. These changes are subtle but useful.
10868 The original behaviour can be obtained by using the original typemaps:
10870 %typemap(javaout) SWIGTYPE {
10871 return new $&javaclassname($jnicall, true);
10873 %typemap(javaout) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] {
10874 return new $javaclassname($jnicall, $owner);
10876 %typemap(javagetcptr) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] %{
10877 protected static long getCPtr($javaclassname obj) {
10878 return obj.swigCPtr;
10882 *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
10885 11/12/2002: beazley
10886 Fixed problem with abstract methods and signatures. For example:
10888 class abstract_foo {
10890 virtual int meth(int meth_param) = 0;
10894 class abstract_bar : public abstract_foo {
10896 int meth(int meth_param_1, int meth_param_2) { return 0; }
10899 In this case, abstract_bar is still abstract.
10901 Fixes [ 628438 ] Derived abstract class not abstract.
10902 Reported and patched by Scott Michel.
10904 11/11/2002: beazley
10905 Fixed a matching problem with typemaps and array dimensions. For example, if you
10908 typedef char blah[20];
10912 %typemap() char [ANY] {
10916 then $1_dim* variables weren't be expanded properly. It should work now.
10917 Problem reported by Pankaj Kumar Goel.
10919 11/07/2002: mkoeppe
10920 Added an experimental new module that dumps SWIG's parse
10921 tree as (Common) Lisp s-expressions. The module is
10922 invoked with SWIG's -sexp command-line switch. The output
10923 can be read into Common Lisp. There is (prototype)
10924 example Lisp code that generates Foreign Function Interface
10925 definitions for use with Kevin Rosenberg's UFFI.
10927 *** EXPERIMENTAL NEW FEATURE ***
10929 11/07/2002: mkoeppe
10930 Removed duplicate declaration of "cpp_template_decl" in
10931 parser.y; bison 1.75 complained.
10933 11/06/2002: cheetah (William Fulton)
10934 [Java] Default primitive array handling has changed like arrays of classes.
10935 C primitive arrays are no longer wrapped by a Java array but with a pointer
10936 (type wrapper class). Again the changes have been made for efficiency reasons.
10937 The original typemaps have been moved into arrays_java.i, so the original
10938 behaviour can be obtained merely including this file:
10940 %include "arrays_java.i"
10942 The array support functions are no longer generated by default. They are only
10943 generated when including this file, thus this often unused code is only
10944 generated when specifically requiring this type of array support.
10946 *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
10948 11/05/2002: ljohnson (Lyle Johnson)
10949 [Ruby] Added support for nested module declarations (as was
10950 previously added for the Perl module). So a %module directive
10953 %module "Outer::Inner::Foo"
10955 will nest everything as (in Ruby code):
10965 11/05/2002: mkoeppe
10966 [MzScheme] Add an argument (-declaremodule) that generates
10967 code to correctly declare a primitive module extension.
10968 Patch submitted by Bruce Butterfield.
10970 11/02/2002: cheetah (William Fulton)
10971 [Java] Added patch submitted by Michael Cahill to remove unused parameter
10972 warnings for the jenv and cls parameters. This patch also also allows one
10973 to use "void" in the jni typemap for any type without code being generated
10974 attempting to return a value.
10976 10/29/2002: cheetah (William Fulton)
10977 [Java] Array handling is different. Arrays of classes are no longer wrapped
10978 with proxy arrays, eg wrapping
10983 used to be wrapped with these Java getters and setters:
10985 public static void setFoo(X[] value) {...}
10986 public static X[] getFoo() {...}
10988 This approach is very inefficient as the entire array is copied numerous
10989 times on each invocation of the getter or setter. These arrays are now
10990 wrapped with a pointer so it is only possible to access the first array element
10991 using a proxy class:
10993 public static void setFoo(X value) {...}
10994 public static X getFoo() {...}
10996 Arrays of enums have also been similarly changed. This behaviour is now like the
10997 other SWIG language's implementation and the array library should be used to
10998 access the other elements. The original behaviour can be achieved using the
10999 macros and typemaps in arrays_java.i, for example:
11001 %include "arrays_java.i"
11002 JAVA_ARRAYSOFCLASSES(X)
11006 *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
11008 10/29/2002: cheetah (William Fulton)
11009 [Java] Two new typemaps javain and javaout for generating the proxy class
11010 and type wrapper class method calls to the JNI class. The new typemaps are
11011 really used for transforming the jstype (used in proxy class and type wrapper
11012 classes) to the jtype (used in the JNI class) and visa versa. A javain typemap
11013 is required whenever an in typemap is written and similarly javaout for an out
11014 typemap. An example is probably best to show them working:
11016 %typemap(javain) Class "Class.getCPtr($javainput)"
11017 %typemap(javain) unsigned short "$javainput"
11018 %typemap(javaout) Class * {
11019 return new Class($jnicall, $owner);
11024 Class * bar(Class cls, unsigned short ush) { return new Class(); };
11027 The generated proxy code is then:
11029 public static Class bar(Class cls, int ush) {
11030 return new Class(exampleJNI.bar(Class.getCPtr(cls), ush), false);
11034 Some new special variables have been introduced in order to use these typemaps.
11035 Here $javainput has been replaced by 'cls' and 'ush'. $jnicall has been replaced by
11036 the native method call, 'exampleJNI.bar(...)' and $owner has been replaced by 'false'.
11037 $javainput is analogous to the $input special variable. It is replaced by the parameter name.
11038 $jnicall is analogous to $action in %exception. It is replaced by the call to the native
11039 method in the JNI class.
11040 $owner is replaced by either true if %newobject has been used otherwise false.
11042 The java.swg file contains default javain and javout typemaps which will produce the same code
11043 as previously. This change is only of concern to those who have written their own typemaps as
11044 you will then most likely have to write your own javain and javaout typemaps.
11046 The javaout typemap also makes it possible to use a Java downcast to be used on abstract
11047 proxy base classes. See the Java documentation on dynamic_cast.
11049 *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
11052 [Methodology] Upgaded to libtool 1.4.3, presumably w/ better
11053 support for newish platforms (like MacOS X).
11056 Fixed Runtime/Makefile.in bug -- thanks to Richard Calmbach.
11059 Fixed typo in doh.h -- thanks to Max Horn.
11061 Version 1.3.16 (October 14, 2002)
11062 =================================
11064 10/13/2002: beazley
11065 Fixed bug with %extend directive and %feature reported
11068 10/13/2002: beazley
11069 Added OpenVMS build directory (vms). Contributed by
11070 Jean-François Pieronne.
11072 10/09/2002: cheetah (William Fulton)
11073 [Java] Added throws clause to the native functions in the JNI class.
11074 The throws clause is the same as the one generated for proxy functions
11075 and module class functions.
11077 09/27/2002: beazley
11078 Fixed some problems with the %import directive and classes that
11079 were defined but not wrapped. Problem reported by Leslie Brooks,
11080 Gerry Woods, and others.
11082 09/23/2002: cheetah (William Fulton)
11083 [Java] Some error checking added:
11084 1) OutOfMemoryException check in the char * typemaps.
11085 2) As SWIG treats pointers, references and passing by value all the
11086 same, it is possible to pass a NULL pointer to a function that expects
11087 an object passed by value or by reference. A NullPointerException is
11088 now thrown under this scenario.
11091 [Methodology] Reworked "make clean" and "make install"
11092 to be more table driven.
11093 [Docs] Explain how to extend "make install" w/ extra-install.list.
11095 09/15/2002: beazley
11096 Deprecation of the "ignore" typemap. The "ignore" typemap has
11097 been deprecated in favor of a generalization of the "in" typemap.
11098 To ignore an argument, use something like this instead:
11100 %typemap(in,numinputs=0) int *output (int temp) {
11104 This change fixes a number of subtle bugs related to the interaction
11105 of the "in" and "ignore" typemaps (which were supposed to be
11106 mutually exclusive).
11108 The use of the numinputs argument is reserved for future expansion.
11109 Currently, values >1 will generate an error. However, future
11110 releases of SWIG may utilize that to support multi-input typemaps.
11112 %typemap(ignore) still works, but generates a warning message and is
11113 translated to %typemap(in,numinputs=0).
11115 *** POTENTIAL INCOMPATIBILITY ***
11116 *** NEW FEATURE ***
11118 09/15/2002: beazley
11119 Fixed segmentation fault for unnamed structures. For example:
11125 Reported by Roger Gibson.
11126 Note: we might be able to generate wrappers in special cases.
11128 09/13/2002: beazley
11129 Minor modification to generated wrapper functions. Pointer arguments are now
11130 always set to an initial value of 0. Simplifies typemap writing and cleanup
11131 code (since you can rely on zero-value initialization). This also greatly
11132 reduces the need to ever write an "arginit" typemap.
11134 09/12/2002: beazley
11135 Minor enhancement to smart-pointer support. If operator->()
11136 is part of an ignored base class like this,
11145 class Bar { /* Ignored */
11152 class Spam : public Bar { };
11154 then methods from Foo are still available. For example,
11161 The only catch is that the operator->() itself is not available
11162 (since it wasn't wrapped). Therefore, there won't be any
11163 __deref__() operation unless it is explicitly added to Spam
11164 (either using %extend or just placing operator->() in the
11165 definition of Spam).
11168 [Methodology] Reworked "make check" to be more table driven.
11169 [Docs] Docuemented methodology in Manual/Extending.html.
11172 [Docs] Prefixed Manual/*.html with "<!DOCTYPE html ...>" to
11173 pander dotingly to (over-)sensitive editors.
11176 [Guile] Converted Examples/guile/simple "make check"
11177 behavior to actually check execution results. Reduced
11178 iteration counts so that the test doesn't take too long.
11180 09/10/2002: beazley
11181 SWIG-1.3.15 released.
11184 Version 1.3.15 (September 9, 2002)
11185 ==================================
11187 09/09/2002: beazley
11188 Fixed nasty runtime type checking bug with subtypes and inheritance
11191 09/09/2002: cheetah (William Fulton)
11192 [Java] Java exception classes for a method's throws clause can be generated by
11193 specifying them in a comma separated list in the throws attribute in any one
11194 of the following typemaps: in, out, check, freearg, argout and throws. A classic
11195 example would be to convert C++ exceptions into a standard Java exception:
11197 %typemap(throws, throws="java.io.IOException") file_exception {
11198 jclass excep = jenv->FindClass("java/io/IOException");
11200 jenv->ThrowNew(excep, $1.what());
11201 return $null; // or use SWIG_fail
11204 class file_exception {...};
11205 void open(const char *filename) throw(file_exception);
11207 The Java method will then be declared with a throws clause:
11209 public static void open(String filename) throws java.io.IOException {...}
11211 09/08/2002: mkoeppe
11212 * [Guile] Improved the documentation system. The arglist no
11213 longer gets cluttered with type specification, making it
11214 more readable. (Also the ILISP function C-u M-x
11215 `arglist-lisp' RET works better this way.) The types of
11216 arguments are explained in an extra sentence after the
11219 There are now two documentation-related typemap arguments:
11221 %typemap(in, doc="$NAME is a vector of integers",
11222 arglist="$name") int *VECTOR { ... }
11224 The "arglist" texts of all arguments of a function make up
11225 its arglist in the documentation. The "doc" texts of all
11226 arguments are collected to make a sentence that describes
11227 the types of the arguments. Reasonable defaults are
11230 As usual, $name is substituted by the name of the
11231 argument. The new typemap variable $NAME is like $name,
11232 but marked-up as a variable. This means that it is
11233 upper-cased; in TeXinfo mode ("-procdocformat texinfo") it
11234 comes out as @var{name}.
11236 The directives %values_as_list, %values_as_vector,
11237 %multiple_values now also have an effect on the
11238 documentation. (This is achieved via the new pragmas
11239 return_nothing_doc, return_one_doc, return_multi_doc.)
11241 Documentation has also improved for variables that are
11242 wrapped as procedures-with-setters (command-line switch
11245 * [Guile] Emit constants as _immutable_ variables. (This
11246 was broken recently.)
11248 09/07/2002: mkoeppe
11249 [Guile] Updated the typemaps in list-vector.i.
11251 09/07/2002: mkoeppe
11252 Short-circuit the typechecks for overloaded functions.
11253 (The changes in code generation are visible in the new
11254 testcase "overload_complicated".)
11256 09/06/2002: cheetah (William Fulton)
11257 [Java] Solution for [ 596413 ]
11258 New typemap so that the Java proxy classes and type wrapper classes
11259 wrapper constructor modifier can be tailored by users. The default value is
11260 protected. Normally SWIG generates a constructor like this which can only
11261 be accessed within one package:
11263 protected Bar(long cPtr, boolean cMemoryOwn) {
11267 If you are using SWIG across multiple packages or want to use this constructor
11268 anyway, it can now be accessed outside the package. To modify use for example:
11270 %typemap(javaptrconstructormodifiers) SWIGTYPE "public"
11272 to change to public for all proxy classes and similarly for all type wrapper classes:
11274 %typemap(javaptrconstructormodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] "public"
11276 09/06/2002: cheetah (William Fulton)
11277 [Java] Added throws typemaps for the Java module. C++ exceptions get converted into
11278 java.lang.RuntimeException Java exceptions.
11280 Warning: This may change from java.lang.Runtime exception in the future.
11282 09/05/2002: cheetah (William Fulton)
11283 [Java] Fix for variables declared as references.
11285 09/05/2002: beazley
11286 Fixed [ 605162 ] Typemap local variables. Reported by Lyle Johnson.
11288 09/05/2002: ljohnson (Lyle Johnson)
11289 [Ruby] More updates to the Ruby module documentation, including
11290 a new typemap example that demonstrates how to collect key-value
11291 pairs from an argument list into a Hash.
11293 09/05/2002: beazley
11294 Fixed bug with template expansion and constructors.
11296 template<class T> class Foo {
11301 The extra <T> in the constructor was carried through in the
11302 name--causing runtime problems in generated modules.
11303 Reported by Jordi Arnabat Benedicto.
11305 09/05/2002: mkoeppe
11306 [Guile] Support overloading.
11308 09/04/2002: ljohnson (Lyle Johnson)
11309 [Ruby] Updated typemaps for long long and unsigned long long types
11310 to use Ruby 1.7 support for these types when available.
11312 09/04/2002: ljohnson (Lyle Johnson)
11313 [Ruby] Added output typemaps for const reference to primitive
11316 09/04/2002: mkoeppe
11317 [Guile] Fix pass-by-value typemaps. Reported by Arno
11318 Peters via Debian bugtracking (#156902), patch by Torsten
11319 Landschoff <torsten@debian.org>.
11321 09/03/2002: samjam (Sam Liddicott)
11322 Better reference support.
11323 Functions that want a void** can take a NULL by reference and
11324 the void* will be made for you and then passed-by-reference
11326 Also all integer-class native types can be passed by reference
11327 where an int* or int& etc is needed
11329 09/03/2002: beazley
11330 Changed the evaluation order of preprocessor macro arguments.
11331 Arguments are now expanded by the preprocessor *before* they
11332 are passed to macro expansion. This fixes a subtle expansion
11333 bug reported by Anthony Heading.
11335 09/03/2002: beazley
11336 Fixed the file include order (again, apparently). See 2/27/99.
11338 09/02/2002: beazley
11339 [Perl] Better exception handling support. Since Perl error handling
11340 relies on setjmp/longjmp, wrapper functions have been modified slightly
11341 to provide an extra block scope:
11344 char _swigmsg[SWIG_MAX_ERRMSG] = "";
11345 const char *_swigerr = _swigmsg;
11347 /* Normal wrapper function here */
11349 SWIG_croak("An error occurred\n");
11351 XSRETURN(argvi); /* Successful return */
11358 The macro SWIG_croak(x) sets the value of _swigerr to x and
11359 executes a "goto fail". The whole wrapper function is enclosed
11360 block scope to provide proper cleanup of C++ objects. Since
11361 croak executes a longjmp(), there is no way to properly reclaim
11362 resources if this executes in the same scope as the wrapper
11365 The _swigmsg[] variable is normally unused, but can be used
11366 to store small error messages using sprintf or snprintf. It
11367 has a capacity of at least 256 bytes (SWIG_MAX_ERRMSG).
11369 09/02/2002: beazley
11370 [Tcl] Added better support for exceptions. Instead of returning TCL_ERROR,
11371 use the macro SWIG_fail to return with an error. This ensures that
11372 arguments are properly cleaned up. Exception specifiers are now
11373 handled by default.
11375 09/02/2002: ljohnson (Lyle Johnson)
11376 [Ruby] The type-checking system for the Ruby module has had a flaw
11377 in that some types which should be considered equivalent
11378 weren't. This bug was best demonstrated by the inherit_missing.i
11379 test suite case, which defines a base class "Foo" that is
11380 subclassed by "Bar". The "Foo" class isn't actually wrapped (i.e.
11381 it's not directly accessible from Ruby) but we'd still like to be
11382 able to pass "Bar" instances to functions expecting Foos and have
11383 that work; it wasn't. The revised implementation (similar to that
11384 used for some other language modules) adds a new instance variable
11385 (__swigtype__) to each object that indicates its SWIG type;
11386 that is, each "Bar" instance will now have a string instance
11387 variable called "__swigtype__" whose value is "_p_Bar".
11389 Unless developers were taking advantage of this low-level
11390 implementation detail, they shouldn't notice any compatibility
11391 problems; nevertheless, I'm marking it as a "potential
11394 *** POTENTIAL INCOMPATIBILITY ***
11396 09/01/2002: ljohnson (Lyle Johnson)
11397 [Ruby] Fixed SF Bug #603199.
11399 08/08/2002: cheetah (William Fulton)
11400 [Java] Added OUTPUT, INPUT and INOUT typemaps in typemaps.i for C++
11403 08/27/2002: mkoeppe
11404 [Guile] Fixed error in "lib_std_vector" testcase and
11405 compiler warning in "lib_cdata" testcase.
11407 08/27/2002: ljohnson (Lyle Johnson)
11408 [Ruby] Added the "%mixin" directive, which allows the user to
11409 specify a comma-separated list of module names to mix-in to a
11410 class. So, for example, if you'd like to specify that Ruby's
11411 Enumerable module should be mixed-in to your class Foo, you'd
11414 %mixin Foo "Enumerable";
11416 or to specify that the modules Fee, Fie and Fo should be mixed
11419 %mixin Foo "Fee,Fie,Fo";
11421 *** NEW FEATURE ***
11423 08/27/2002: ljohnson (Lyle Johnson)
11424 [Ruby] Modified the %alias directive so that multiple aliases
11425 can be specified for an instance method by using a comma-separated
11428 08/27/2002: ljohnson (Lyle Johnson)
11429 [Ruby] Added "throw" typemaps for the Ruby module.
11431 08/26/2002: beazley
11432 Two new command line options for printing dependencies.
11433 'swig -M' lists all file dependencies. 'swig -MM' lists
11434 dependencies, but excludes files in the SWIG library.
11437 % swig -M -python example.i
11438 example_wrap.cxx: \
11439 /u0/beazley/Projects/lib/swig1.3/swig.swg \
11440 /u0/beazley/Projects/lib/swig1.3/python/python.swg \
11444 % swig -MM -python example.i
11445 example_wrap.cxx: \
11449 *** NEW FEATURE ***
11451 08/26/2002: beazley
11452 Fixed [ 597599 ] union in class: incorrect scope.
11453 Reported by Art Yerkes.
11455 08/26/2002: beazley
11456 Fixed [ 600132 ] Default argument with namespace.
11457 Reported by Shibukawa Yoshiki.
11459 08/24/2002: beazley
11460 Automatic C++ exception handling enabled for all language modules. This is
11461 pretty simple. If you have a class like this:
11467 void blah() throw(Foo);
11470 then the generated wrapper code looks like this:
11478 /* "throw" typemap code inserted. $1 = _e */
11484 The "throw" typemap can be used to raise an error in the target
11485 language. It can do anything. Here is a very simple example:
11487 %typemap("throw") Foo {
11488 PyErr_SetString(PyExc_RuntimeError, "Foo exception");
11492 To make this work in each language module, simply define a few default
11493 "throw" typemaps for SWIGTYPE, SWIGTYPE *, int, const char *, and a
11494 few common exception types. That's all there is to it.
11496 Automatic exception handling can be disabled using -noexcept or
11497 setting the NoExcept global variable to 1.
11498 *** NEW FEATURE ***
11500 08/23/2002: beazley
11502 Automatic translation of C++ exception specifications into error handling code.
11509 void blah() throw(Foo);
11512 In this case, Foo is wrapped as a classic-style class (compatible
11513 with exception handling). Furthermore, you can write Python code
11519 except Foo,e: # Note use of exception class here!
11523 The object "e" in the exception handler is just a wrapped Foo
11524 object. Access it like a normal object.
11526 If an exception is not wrapped as a class, a RuntimeError
11527 exception is raised. The argument to this exception is
11528 the exception object. For example:
11532 void blah() throw(int);
11538 except RuntimeError,e:
11539 print e.args[0] # Integer exception value
11543 - If a class is used as an exception, it *must* be wrapped
11544 as a Python classic-style class (new classes don't work).
11546 - Automatic exception handling is compatible with %exception.
11548 - Use -noexcept to turn off this feature.
11550 - The newly introduced "throw" typemap is used to raise
11551 Python errors (naturally).
11553 *** EXPERIMENTAL NEW FEATURE ***
11555 08/23/2002: beazley
11556 Information from throw() specifiers is now stored in the parse
11561 int blah() throw(spam,bar);
11564 The stored information is fully corrected for namespaces and works
11565 with templates. Uses will follow.
11567 08/22/2002: beazley
11568 Exception handling code is no longer applied to member access
11569 function. For example, in this code
11574 } catch(whatever) {
11585 The exception handling code is not applied to accessor functions
11586 for Foo::x. This should reduce the amount of extra code
11589 Caveat: Exception handling code *is* used when attributes are
11590 accessed through a smart-pointer or a synthesized attributed
11591 added with %extend is used.
11593 08/22/2002: beazley
11594 Made more patches to hopefully eliminate problems when compiling SWIG
11595 as a 64-bit executable.
11597 08/22/2002: beazley
11598 Fixed a bug with const reference members, variables, and static members.
11603 static const int &ref;
11606 SWIG was trying to generate "set" functions which wouldn't compile.
11608 08/21/2002: beazley
11609 Made the warning message for "Class X might abstract" off by default.
11612 08/21/2002: beazley
11613 Refined handling of const and non-const overloaded methods. If
11614 a class defines a method like this:
11619 int bar(int) const;
11622 Then the non-const method is *always* selected in overloading and
11623 the const method silently discarded. If running with -Wall, a warning
11624 message will be generated.
11626 08/19/2002: beazley
11627 Better support for using declarations and inheritance. Consider this:
11636 double blah(double x);
11639 class FooBar : public Foo, public Bar {
11641 char *blah(char *x);
11646 Now SWIG wraps FooBar::blah as an overloaded method that uses all
11647 accessible versions of blah(). See section 15.2.2 in Stroustrup, 3rd Ed.
11649 SWIG also supports access change through using declarations. For example:
11657 class Bar : public Foo {
11664 Caveat: SWIG does not actually check to see if declarations imported
11665 via 'using' are in the inheritance hierarchy. If this occurs, the
11666 wrapper code won't compile anyways---not sure it's worth worrying about.
11668 08/18/2002: beazley
11669 Modified overloading dispatch to not include nodes with an "error" attribute.
11670 A language module can set this if a node couldn't be wrapped and you don't want
11671 it included in the dispatch function.
11673 08/18/2002: beazley
11674 Enhancement to overloaded function dispatch. The dispatcher is now aware of
11675 inheritance relationships. For example:
11678 class Bar : public Foo { };
11683 In this case, the dispatcher re-orders the functions so that spam(Bar *b) is
11684 checked first---it is more specific than spam(Foo *f).
11686 08/17/2002: beazley
11687 Added -Werror command line option. If supplied, warning messages are treated
11688 as errors and SWIG will return a non-zero exit code.
11690 08/17/2002: beazley
11691 Fixed [ 596135 ] Typedef of reference can't compile. For example:
11693 typedef int &IntRef;
11694 void foo(IntRef i);
11696 SWIG-1.3.14 generated code that wouldn't compile.
11698 Version 1.3.14 (August 12, 2002)
11699 ================================
11702 Static const members initialized during declaration, and
11707 static const int a = 1 ; // this one
11708 static const int b; // not this one
11711 are emitted like constants (equivalent to enums or
11712 explicit %constant).
11714 This is because they cannot be added directly to 'cvar'
11715 since they lack the needed reference (well, you can force
11716 them to have a real reference, but in an ugly way which
11717 goes completely again the original purpose of initialize
11718 them during declaration, you also have to deal with extra
11719 linking matters, and it take a while to figure out what is
11720 the problem and how to solve it).
11722 Please test it with your preferred target language, and
11723 not only the code generation, but really run the example
11724 in the test-suite (static-const-member-2.i) because the
11725 problem and the solution cannot be "fully" appreciated
11726 until you try to load the module and run it.
11728 In some target languages (python specially), this can
11729 produces a difference in the way that the static constant
11730 members 'a' and 'b' are internally wrapped. Hopefully,
11731 they still can be accessed in the same way.
11735 [python] Now static const members can be accessed in a more
11736 natural way, ie, if you have
11740 typedef unsigned int viewflags;
11741 static const viewflags forward_field = 0;
11742 static const viewflags backward_field;
11747 print A.backward_field
11752 print a.forward_field
11754 Note that if the static const members don't have an
11755 initializer (like backward_field), still you can access
11756 them in the same way in the python side, but the
11757 implementation is a quite different: backward_field will
11758 still appear in the cvar entity, and also, you are
11759 responsible to initialize it in some code unit, and link it
11760 properly. forward_field, by the other hand, will not
11761 appear in the cvar entity but only as a A member, similar
11762 to what happen with enum or %constant members.
11765 [python] Common code in the __setattr__/__getattr__ now
11766 goes to two "free" methods at the beginning of the proxy
11767 file, from where each class use it. This change reduces
11768 the size of the proxy file, specially if you wrap a lot of
11769 small classes in one module (up to 33% in some cases),
11770 making it faster to load too.
11772 08/09/2002: beazley
11773 [Perl5] If a function that returns char * returns NULL,
11774 undef is returned to the Perl interpreter.
11776 08/09/2002: beazley
11777 Fix to conversion operators and namespaces. For example:
11786 In the wrapper code, SWIG was using ->operator Foo*()
11787 when it should have been using ->operator ns::Foo*().
11789 Note: if using %rename with a conversion operator, you
11790 might have to do this:
11792 %rename(toFooPtr) ns::operator ns::Foo*();
11793 // ^^^^ note extra qualifier
11798 08/09/2002: beazley
11799 [Python] Minor enhancement to 'const' variable declarations.
11800 Normally const declarations are wrapped as read-only variables
11801 accessible only through the cvar attribute (see SWIG.html for
11802 a discussion of why). However, in many programs, "const"
11803 declarations may just be constants---making the cvar. access
11804 awkward. To fix this, "const" declarations are now available
11805 both through cvar. and as a simple name. For example:
11807 const int FOO = 42;
11811 >>> print example.cvar.FOO
11813 >>> print example.FOO
11816 Note: There are cases where the value of a "const" variable
11817 might change. For example:
11819 char *const BAR = "Hello World";
11821 In this case, the pointer itself can not change, but the
11822 data being pointed to could be modified. In these situations,
11823 cvar.BAR should be accessed to obtained the current value.
11825 08/08/2002: beazley
11826 [Python] Fixed generation of the proxy code (.py files) to more
11827 closely follow the order of declarations as they appear in
11828 the .i file. In the past, all of the class wrappers appeared
11829 first, followed by function stubs, inserted Python code, and
11832 08/08/2002: cheetah (William Fulton)
11833 [Java] Proxy method _delete() changed to delete(). There shouldn't ever
11834 be a wrapped function called delete() as it is a C++ keyword and there
11835 is no such thing as a member function in C.
11837 *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
11839 Backwards compatibility can be achieved by adding the function back in
11840 for all proxy classes:
11841 %typemap(javacode) SWIGTYPE %{
11842 public void _delete() {
11847 Java backwards compatibility summary
11848 ------------------------------------
11850 There are a number of changes that have been made in improving the Java module
11851 for ver 1.3.14. If at all possible change your code to take advantages of the
11852 improvements. If you were using proxy classes you may not notice any backwards
11853 compatibility issues. Here is an example which will help with most backwards
11854 compatibility problems where it is not possible to modify the code that uses
11855 the generated output:
11861 %module (jniclassname="modulename") modulename;
11862 %typemap(javacode) SWIGTYPE %{
11863 public long getCPtr$javaclassname() {
11866 public void _delete() {
11870 %pragma(java) jniclassclassmodifiers="public";
11872 The proxy constructors that took parameters (long cPtr, boolean cMemoryOwn)
11873 were public and are now protected. If you were making use of these then you'll
11874 have to modify your code and the best solution would be to use the new type
11877 The other main areas are the pragmas and global variable wrapping. Replace
11878 the pragmas with one of the new directives or typemaps mentioned below and use
11879 %rename on the variables.
11881 If you were not using proxy classes, you will have to define a jstype typemap
11882 as well as a jtype typemap.
11884 08/08/2002: cheetah (William Fulton)
11885 [Java] Fix for wrapping two dimension array variables.
11887 08/07/2002: beazley
11889 Object management now has a much better sense of ownership.
11890 Ownership bits is changed whenever an object is stored in a
11891 global variable or structure member. For example:
11904 >>> g.next = f # Assign a pointer
11905 >>> f.thisown # Notice ownership change
11909 This scheme is mostly a conservative heuristic designed to
11910 provide segmentation faults. It could cause a memory leak
11911 if ownership is changed unnecessarily. In this case, you can
11912 either write a typemap (that doesn't change ownership), or
11913 manually set the thisown attribute back to 1.
11915 08/07/2002: beazley
11916 [Tcl] Major usability improvements to the object interface.
11917 Suppose you had code like this:
11926 In past versions of SWIG, you could create objects and use
11934 The only problem is that if you tried to call blah(), it didn't
11938 Type Error. Expected _p_Foo
11941 Instead, you had to do this:
11943 % blah [f cget -this]
11945 SWIG now automatically extracts the -this pointer, avoiding this
11946 problem. This means that saying "blah f" is perfectly legal and
11947 everything will still work normally.
11949 Caveat: Since pointer strings start with a leading underscore (_),
11950 don't use this in object names. For example:
11953 % blah _f # Potential crash
11955 Objects now have a -thisown attribute that shows the ownership.
11956 This builds upon the CHANGES 11/24/2001 entry.
11958 08/07/2002: samjam, Sam Liddicott
11959 Properly implemented pointer system using php resources.
11960 Still need to work out whether or not to let script-users call
11961 destructors directly
11963 08/06/2002: beazley
11964 Upgraded mzscheme module to support version 201 and added
11965 overloading support.
11967 08/05/2002: beazley
11968 Added parsing support for extra grouping (in very limited cases).
11971 typedef int (FuncPtr)(int, double);
11973 *** EXPERIMENTAL ***
11975 08/03/2002: ljohnson (Lyle Johnson)
11976 [Ruby] Updates to typemaps.i as those done previously for Perl,
11977 Python and Tcl modules. Now supports reference types with INPUT,
11978 OUTPUT and INOUT typemaps.
11980 08/02/2002: beazley
11981 New library file cstring.i added. Provides macros for
11982 manipulating char * data.
11984 08/02/2002: beazley
11985 Deprecated the %new directive. Use %newobject instead. For
11992 %newobject follows the same rules as %rename, %ignore, %feature,
11995 *** POTENTIAL INCOMPATIBILITY ***
11997 08/01/2002: cheetah (William Fulton)
11998 [Java] New attribute 'jniclassname' for the module directive allows a way of
11999 changing the JNI class name from the default which uses the modulename with JNI
12002 %module (jniclassname="name") modulename
12004 If 'name' is the same as 'modulename' then the module class name gets changed
12005 from 'modulename' to modulenameModule.
12007 08/01/2002: beazley
12008 Fixed problem with file include order. Language specific
12009 directories should take precedence over generic directories.
12010 For example: "swig_lib/python/foo.i" should be loaded before
12011 "swig_lib/foo.i". I thought this was the case already, but
12012 apparently it has been broken for quite some time.
12014 08/01/2002: beazley
12015 Added std_deque.i library file. Work in progress.
12017 08/01/2002: beazley
12019 Improvements to typemaps.i. INPUT/INOUT typemaps perform better
12020 error checking. Typemaps are now supplied for references like
12021 int &OUTPUT, double &INOUT, etc.
12023 08/01/2002: beazley
12024 [Python] Deprecated the T_* and L_* typemaps in typemaps.i.
12025 Multiple return values are always placed in a tuple. Deprecated
12026 the BOTH typemaps. This is now INOUT (e.g., int *INOUT).
12028 *** POTENTIAL INCOMPATIBILITY FOR PYTHON MODULE ***
12030 08/01/2002: beazley
12031 Deprecated the array.i, carray.i, and timer.i library files.
12033 08/01/2002: beazley
12034 Deprecated the pointer.i library file. Use cpointer.i instead.
12035 *** POTENTIAL INCOMPATIBILITY ***
12037 08/01/2002: cheetah (William Fulton)
12038 [Java] For consistency the global variable getters and setters use the JavaBean
12039 property design pattern like member variables always have. This means if you are
12040 wrapping a variable called foo, the getter is called getFoo() and the setter is
12041 called setFoo(). Before the recent changes to the Java module the getters and
12042 setters were called get_foo() and set_foo(). If you really want the original
12043 function names use the %rename directive like this: %rename(_foo) Foo;
12045 07/31/2002: beazley
12046 Fixed casting problem with multiple inheritance. If you had this,
12049 class bar : public foo {};
12050 class baz : public foo {};
12051 class spam : public bar, public baz {};
12053 then the wrappers wouldn't compile due to an ambiguous cast.
12054 Reported by Art Yerkes.
12056 07/30/2002: cheetah (William Fulton)
12057 [Java] Due to new static typechecking all pointers held in a Java long are part of
12058 the internal workings and this pointer value in the Java long has become abstracted
12059 data. The type wrapper constructor and getCPtr() methods are as such protected.
12060 If you need to mess around with pointers from Java or for example create a proxy
12061 class or type wrapper class around a null pointer, add a function/constructor
12062 to do so with the %javacode typemap. You can also make getCPtr() public again with
12063 the %javagetcptr typemap.
12065 07/30/2002: cheetah (William Fulton)
12066 [Java] Fixes for %typemap(ignore). In particular when ignoring the last parameter
12067 in a function. Also for all parameters in constructors. These mods have also fixed
12068 multi-argument typemaps for proxy classes - SF 581791.
12070 07/30/2002: cheetah (William Fulton)
12071 [Java] %newobject (replacement for %new) now implemented for Java.
12073 07/29/2002: beazley
12074 Fixed problem with typemap copies, %apply, and %clear inside
12077 07/28/2002: cheetah (William Fulton)
12078 [Java] The JNI class now has package access as the class modifier
12079 has been changed from "public" to nothing. This has been done
12080 as this class is now more for the internal workings of SWIG since the module
12081 class has static type checking for all types.
12083 *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
12085 Backwards compatibility can be achieved by using the %jniclassclassmodifier
12086 pragma to change it back to "public".
12088 07/28/2002: cheetah (William Fulton)
12089 [Java] Proxy/Shadow classes are generated by default. The -proxy and
12090 -shadow command line options are deprecated. If you want to use the
12091 low-level functional interface then use the new -noproxy commandline option.
12093 *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
12095 07/28/2002: cheetah (William Fulton)
12096 [Java] Remaining pragmas shakeup. These were the remaining pragmas and their
12097 new names where changed:
12101 moduleclassmodifiers
12102 moduleimport => moduleimports
12103 moduleinterface => moduleinterfaces
12105 The moduleimports works slightly differently to how the moduleimport pragma worked.
12106 Now it actually takes code which gets placed before the class definition so the
12107 whole import statement has to be given, for example:
12109 %pragma(java) moduleimports=%{
12111 import java.math.*;
12114 The moduleinterfaces is slightly different to the old moduleinterface in that if
12115 more than one interface is required they must be comma separated in one use of
12116 the pragma, for example:
12118 %pragma(java) moduleinterfaces="Serializable, MyInterface"
12120 These last two pragmas are consistent with the javainterfaces and javaimports
12123 A similar set of pragmas has been introduced, namely:
12127 jniclassclassmodifiers
12131 These work in the same way as their module counterparts. Note that previously
12132 the moduleXXX pragmas worked on the old module class which is now called the
12133 JNI class (the class with the native functions). The jniclassXXX pragmas now
12134 work on the new module class (the class that has all the global functions and
12135 global variable getters and setters when using proxy classes, plus all other
12136 remaining functions when using the low-level procedural interface).
12138 In summary the contents of the pragmas make up a class like this:
12141 <jniclassmodifiers> class modulename extends <jniclassbase> implements <jniclassinterfaces> {
12143 ... SWIG generated functions ...
12146 *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
12148 07/28/2002: cheetah (William Fulton)
12149 [Java] Deprecated modulemethodmodifiers pragma and replaced with
12150 a better %feature based directive called %javamethodmodifiers.
12151 A useful example would be for synchronisation in multi-threaded apps:
12153 %javamethodmodifiers foo(int a) "public synchronized";
12155 Changes this function from the default ("public") to "public synchronized".
12157 *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
12159 07/26/2002: beazley
12160 Several directives now allow optional configuration parameters.
12163 %module(name="value", name="value", ...) modulename
12164 %import(name="value", ...) "filename.i"
12165 %extend(name="value", ...) classname {
12169 These currently have no effect and are reserved for
12172 07/26/2002: beazley
12173 Enhancements to smart-pointer handling. SWIG only provides
12174 extra support for a smart-pointer if operator->() returns
12175 a proper pointer. For example:
12179 If operator->() returns an object by value or reference,
12180 then SWIG examines the returned object to see if it also
12181 implements operator->(). If so, SWIG chases operator->()
12182 until it can find one that returns a pointer. This allows
12183 cases like this to work:
12205 >>> s.blah() # Invokes Foo::blah()
12207 The s.blah() call actually invokes:
12209 ((s.operator->()).operator->())->blah();
12211 07/26/2002: beazley
12212 Fixed a bug with typedef and references. For example:
12214 typedef Foo & FooRef;
12217 Previous versions of SWIG generated code that wouldn't
12220 07/25/2002: beazley
12221 Wrapping of static methods has been improved in proxy classes. In older
12222 versions of SWIG, if you had this:
12229 The static method was only available as a function Foo_bar(). For example:
12233 Now, the static method can also be invoked through an instance like this:
12236 >>> f.bar() # Invokes static method
12238 This works with all versions of Python. Additionally, for Python-2.2,
12239 the static method can be invoked as:
12243 The old-style function is still support for backwards compatibility. If
12244 you care about making your code across different versions of Python,
12245 either use Foo_bar() or access the method through an instance.
12247 07/25/2002: beazley
12248 Changes to the Python module. Proxy classes now utilize new Python-2.2
12249 features including properties and static methods. However, these features
12250 are supported in a way that provides backwards compatibility with older
12251 Python versions. In other words, proxy classes work with all versions
12252 of Python and only use new features when running on Python-2.2.
12255 07/25/2002: beazley
12256 Modified %extend so that overloaded methods can be added. For example:
12259 void bar(int x) { };
12260 void bar(char *s) { };
12264 This works with both C++ *and* C.
12266 07/24/2002: cheetah (William Fulton)
12267 [Java] More new typemaps so that the Java proxy classes and type wrapper classes
12268 can be further tailored by users. These are the default code for generating the
12269 finalize() methods (proxy classes only) and the getCPtr() methods for proxy
12270 classes and type wrapper classes:
12272 %typemap(javafinalize) SWIGTYPE %{
12273 protected void finalize() {
12278 %typemap(javagetcptr) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] %{
12279 public static long getCPtr($javaclassname obj) {
12280 return obj.swigCPtr;
12284 The javagetcptr typemap will enable users to handle Java null by overriding
12285 this typemap - a requested feature.
12287 The -nofinalize commandline option has been deprecated. The javafinalize
12288 typemap is more powerful as it will allow the removal of the finalize methods
12289 for all or any one or more particular proxy class.
12291 07/23/2002: cheetah (William Fulton)
12292 [Java] The getCPtrXXX() function has been changed to a static function and
12293 is now of the form:
12295 protected static long getCPtr(XXX obj) {...}
12297 This is a requested change which will allow Java null pointers to be used as null
12298 can be passed in for obj. However, to achieve this the appropriate code must be
12299 written using the new javagetcptr typemap directive.
12301 *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
12303 Backwards compatibility can be achieved by adding this function back in using the
12304 new javacode typemap:
12306 %typemap(javacode) SWIGTYPE %{
12308 // SWIG-1.3.12 and SWIG-1.3.13
12309 public long getCPtr$javaclassname() {
12312 // SWIG-1.3.11 and earlier
12313 public long getCPtr() {
12320 07/23/2002: cheetah (William Fulton)
12321 [Java] New directive to control constant code generation - %javaconst.
12322 The default handling for handling constants is to get the value through
12330 public final static int YELLOW = modulename.get_YELLOW();
12331 public final static long BIG = modulename.get_BIG();
12333 Earlier versions of the Java module initialised the value using the C value:
12335 public final static int YELLOW = 5;
12336 public final static long BIG = 1234LL;
12338 This works in most cases, but the value for BIG won't compile as 1234LL is not
12339 valid Java code and this is one of the reasons why the default is now to get the
12340 values through a JNI call. The side effect is that these 'constants' cannot be used
12341 in switch statements. The %javaconst directive allows one to specify the
12342 way the constant value is initialised and works like other %feature
12345 %javaconst(0); // all constants from this point on are initialised using the C value
12346 %javaconst(1) BIG; // just BIG initialised using JNI call (must be parsed before BIG is defined)
12348 07/23/2002: beazley
12349 *** IMPORTANT CHANGES TO THE PYTHON MODULE ***
12351 (1) The Python module now enables shadow/proxy classes by default.
12352 This means that two files are always created by SWIG. For
12353 instance, if you have this:
12359 Then swig generates two files "foo_wrap.c" and "foo.py".
12361 (2) The name of the low-level C extension module has been changed
12362 to start with a leading underscore. This means that you have
12363 to compile the module as follows:
12365 $ cc -c -I/usr/local/include/python2.2 foo_wrap.c
12366 $ cc -shared foo_wrap.o $(OBJS) -o _foo.so
12368 note extra underscore
12370 This naming scheme is consistent with other Python modules that
12371 utilize extension code. For instance, the socket module consists
12372 of "_socket.so" and "socket.py". In previous versions of SWIG,
12373 the shared object file was named "foocmodule.so".
12375 (3) A new directive can be used to insert Python code into
12376 the corresponding .py file. For example:
12380 print "Hello World"
12383 This directive allows you to create modules as a mix of C and Python.
12384 Python code is seamlessly added to the module.
12386 (4) The -shadow command line option is deprecated. This is turned on
12389 (5) To disable the generation of the extra python file, use the "-noproxy"
12390 command line option.
12392 *** POTENTIAL INCOMPATIBILITY ***
12393 This change will likely break the build environment of projects that
12394 utilize shadow classes. To fix this, you probably only need to
12395 change the name of the target .so file. For example, if you have
12396 Makefile information like this:
12398 TARGET = examplecmodule.so
12402 TARGET = _example.so
12404 *** DOCUMENTATION UPDATE ***
12405 The file Doc/Manual/Python.html has been updated to describe these changes.
12408 07/23/2002: beazley
12409 Added -noextern option. If supplied, SWIG will not generate
12410 extra extern declarations. This is sometimes an issue on
12411 non-unix platforms.
12413 07/23/2002: beazley
12414 Added a warning for ignored friend functions.
12416 07/23/2002: beazley
12417 Fixed [ 574498 ] -proxy and %include "pointer.i" clash.
12418 Reported by David Creasy.
12420 07/23/2002: beazley
12421 Fixed [ 576103 ] global destruction warning with shadow.
12422 Perl extensions should no longer report the warning
12424 "Use of uninitialized value during global destruction."
12426 when running with "perl -w". Reported by
12429 07/23/2002: beazley
12430 In C++ mode, SWIG now always defines namespace std. By default,
12431 it's empty. However, this will silence errors from programs
12432 that include statements such as "using namespace std;".
12433 This fixes Bug [ 584017 ] using namespace std generates error.
12434 Reported by Joseph Winston.
12436 07/22/2002: beazley
12437 Added a new warning message for %apply. If you use %apply but no typemaps
12438 are defined, you will get a warning message. This should help with
12439 problems like this:
12441 %apply char *OUTPUT { ... };
12443 In old versions of SWIG, this silently did nothing. Now you get an error like this:
12445 file:line. Warning. Can't apply (char *OUTPUT). No typemaps are defined.
12447 07/22/2002: cheetah (William Fulton)
12448 [Java] Started Java pragma deprecation. Replacements use %typemap based
12449 directives and enable proxy classes and the new type wrapper classes to be
12450 tailored in various ways. These are the new typemaps:
12452 %typemap(javabase) - base (extends) for Java class
12453 %typemap(javaclassmodifiers) - class modifiers for the Java class: default is "public"
12454 %typemap(javacode) - java code is copied verbatim to the Java class
12455 %typemap(javaimports) - import statements for Java class
12456 %typemap(javainterfaces) - interfaces (extends) for Java class
12458 And these are the %pragma directives being deprecated:
12460 allshadowclassmodifiers
12465 shadowclassmodifiers
12470 Note that it is possible to target a particular proxy class:
12471 %typemap(javaimports) Foo "import java.util.*";
12472 or a particular type wrapper class:
12473 %typemap(javaimports) double* "import java.math.*";
12474 Note that $javaclassname in these typemaps are substituted with either the proxy
12475 classname when using proxy classes or the SWIGTYPE class name.
12477 07/18/2002: cheetah (William Fulton)
12478 [Java] Java module overhaul to implement static type checking of all
12481 1) Changes when using Java Proxy classes
12482 ----------------------------------------
12484 Previously when wrapping global functions:
12487 void foo(SomeClass* s);
12490 The native method prototypes used a long for pointers and looked like this:
12492 public class modulename {
12494 public final static native void foo(long jarg1);
12495 public final static native long bar();
12498 and unlike member functions of a C++ class there was no wrapper around the native calls
12499 to make the use of them more user friendly. They would be used from Java like this:
12501 SomeClass s = new SomeClass(modulename.bar(), false);
12502 modulename.foo(s.getCPtrSomeClass());
12504 Note that the following will have the same effect, but then it would not have
12505 been possible to call any proxy member functions in SomeClass:
12507 long s = modulename.bar();
12510 Now wrapper functions are generated:
12512 public class modulename {
12513 public static void foo(SomeClass s) {
12514 // calls the native function
12517 public static SomeClass bar() {
12518 // calls the native function
12522 Which means these functions can now be used more naturally with proxy classes:
12524 SomeClass s = modulename.bar();
12527 2) Changes when not using Java Proxy classes
12528 --------------------------------------------
12530 The so called low-level interface was rather low-level indeed. The
12531 new static type checking implementation makes it less so but it remains a
12532 functional interface to the C/C++ world. Proxy classes are the obvious way to use
12533 SWIG generated code, but for those who want a functional interface all non-primitive
12534 types now have a simple Java class wrapper around the C/C++ type. Pointers and
12535 references to primitive types are also wrapped by type wrapper classes. The type
12536 wrapper classnames are based on the SWIG descriptors used by the other language
12537 modules. For example:
12539 C/C++ type Java type wrapper class name
12540 ---------- ----------------------------
12541 int* SWIGTYPE_p_int
12542 double** SWIGTYPE_p_p_double
12543 SomeClass* SWIGTYPE_p_SomeClass
12544 SomeClass& SWIGTYPE_p_SomeClass
12545 SomeClass SWIGTYPE_p_SomeClass
12547 Note that everything wrapped by SWIG is accessed via a pointer even when wrapping
12548 functions that pass by value or reference. So the previous example would now be
12551 SWIGTYPE_p_SomeClass s = example.bar();
12554 Note that typedefs that SWIG knows about are resolved, so that if one has
12559 then any use of Bar will require one to use SWIGTYPE_p_Foo;
12561 Some considerations:
12562 Make sure you make a firm decision to use either proxy classes or the functional
12563 interface early on as the classnames are different.
12565 3) Pointers and non-parsed types
12566 --------------------------------
12567 Sometimes SWIG cannot generate a proxy class. This occurs when the definition of
12568 a type is not parsed by SWIG, but is then used as a variable or a parameter.
12571 void foo(Snazzy sds);
12573 If SWIG has not parsed Snazzy it handles it simply as a pointer to a Snazzy.
12574 The Java module gives it a type wrapper class around the pointer and calls it
12575 SWIGTYPE_p_Snazzy. In other words it handles it in the same manner as types are
12576 handled in the low-level functional interface. This approach is used for all
12577 non-proxy classes, eg all pointer to pointers and pointers to primitive types.
12579 4) Backwards compatibility
12580 -----------------------
12581 Backwards compatibility is not an issue if you have been using proxy classes and
12582 no global variables/functions. Otherwise some changes will have to be made.
12583 The native methods still exist but they are now in a JNI class, which is called
12584 modulenameJNI. As this class is really part of the internal workings,
12585 it should not be required so the class has become protected. Some pragmas/directives
12586 will hopefully be added to help with backwards compatibility.
12588 *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
12590 07/18/2002: beazley
12591 Modified wrapping of uninstantiated templates returned by
12592 value. Just to be safe, they are now wrapped by SwigValueWrapper<>
12593 just in case they don't define a default constructor. This
12594 would be used if you had code like this
12597 void moreblah(Foo<int> x);
12599 but you didn't instantiate Foo<int> using %template.
12600 We should probably add a warning for this.
12602 07/17/2002: beazley
12603 Added an error check to detect shadowed template paramaters.
12606 template<class T> class Foo {
12611 This results in an error, not a warning. This warning is
12612 also needed to fix some rather insidious problems like
12619 template<class T> class Foo {
12621 typedef T Traits; // Which T is this????
12624 In this case, the template parameter T shadows the outer
12625 structure (which is what you want).
12627 07/16/2002: beazley
12628 Improved support for templates with integer arguments. SWIG is
12629 much more aware of situations such as this:
12631 const int Size = 100;
12633 %template(Foo100) Foo<100>;
12634 void bar(Foo<Size> *x); // Knows that Foo<Size> is the same as Foo<100>;
12636 07/15/2002: beazley
12637 Fixed bug with %feature/%ignore/%rename and namespaces.
12647 Reported by Marcelo Matus.
12649 07/09/2002: beazley
12650 Added parsing support for constructors that try to catch
12651 exceptions in initializers. For example:
12663 This has no effect on the generated wrappers. However, the try and catch
12664 parts of the declaration are ignored. See Stroustrup, 3rd Ed, section
12665 14.4.6.1 for details.
12667 07/06/2002: beazley
12668 Fixed bug in template symbol table management. This fixes
12669 two bugs. First, mixing abstract methods, templates, and
12670 inheritance no longer generates a failed assertion.
12675 virtual void foo() = 0;
12679 class B : public A<T>
12682 %template(A_int) A<int>;
12683 %template(B_int) B<int>;
12685 This fix also fixes a subtle problem with default values and
12686 templates. For example:
12690 typedef unsigned int size_type;
12691 static const size_type nindex = static_cast<size_type>(-1);
12692 void foo(size_type index = nindex);
12695 Bugs reported by Marcelo Matus.
12698 07/05/2002: ljohnson (Lyle Johnson)
12699 [Ruby] Changed the definition of the SWIG_ConvertPtr() function
12700 for the SWIG/Ruby runtime support so that it looks like the
12701 Python version. If the last argument (flags) is non-zero,
12702 SWIG_ConvertPtr() will raise an exception for type mismatches
12703 as before. If flags is zero, this function will return -1 for
12704 type mismatches without raising an exception.
12706 *** POTENTIAL INCOMPATIBILITY FOR RUBY MODULE ***
12708 07/04/2002: beazley
12709 Overloaded functions/methods/constructors now work in many language
12710 modules. The support is completely transparent--just call the
12711 function normally and SWIG will dispatch to the correct implementation.
12712 There are a variety of issues associated with this. Please refer
12713 to the overloading section of Doc/Manual/SWIGPlus.html for details.
12714 *** NEW FEATURE ***
12716 07/04/2002: beazley
12717 Fixed a bug with namespaces, enums, and templates. For example:
12720 enum Hello { Hi, Hola };
12725 typedef double value_type;
12728 traits<Hi>::value_type say_hi()
12730 return traits<Hi>::value_type(1);
12733 SWIG wasn't generating wrappers that properly qualified
12734 traits<Hi>. Reported by Marcelo Matus.
12736 06/30/2002: beazley
12737 Supplied array variable typemaps for Tcl module. If you have a
12738 variable like this:
12742 then a set function like this is generated:
12744 void foo_set(int *x) {
12745 memmove(foo,x,10*sizeof(int));
12748 06/30/2002: beazley
12749 New %fragment directive. When writing typemaps, it can be easy to
12750 get carried away and write a lot of code. However, doing so causes
12751 tremendous code bloat. A common way to solve this is to write
12752 helper functions. For example:
12755 void some_helper_function() {
12760 %typemap(in) type {
12761 some_helper_function(...);
12764 The only problem with this is that the wrapper file gets polluted
12765 with helper functions even if they aren't used. To fix this,
12766 a new fragment directive is available. For example:
12768 (corrected typo in line below - 06/26/2008)
12769 %fragment("type_header","header") %{
12770 void some_helper_function() {
12775 %typemap(in, fragment="type_header") type {
12776 some_helper_function(...);
12779 In this case, the code fragment is only emitted if the typemap is
12780 actually used. A similar capability is provided for declaration
12781 annotation and the %feature directive. For example:
12783 %feature("fragment","type_header") SomeDeclaration;
12785 The first argument to %fragment is the fragment name. The second argument
12786 is the file section where the fragment should be emitted.
12788 The primary use of this directive is for writers of language modules
12789 and advanced users wanting to streamline typemap code.
12791 *** EXPERIMENTAL NEW FEATURE ***
12793 06/30/2002: beazley
12794 Supplied memberin typemaps for all arrays in an attempt to eliminate
12795 confusion about their use.
12797 06/29/2002: beazley
12798 Experimental support for smart-pointers. When a class defines
12799 operator->() like this
12807 SWIG locates class Bar and tries to wrap its member variables and
12808 methods as part of Foo. For example, if Bar was defined like this:
12816 You could do this (in the target language):
12819 f.x = 4 # Accesses Bar::x
12820 f.spam() # Accesses Bar::spam
12822 The primary use of this feature is to emulate the behavior of C++
12823 smart-pointers---which allow attributes to accessed transparently
12824 through operator->.
12826 This feature is supported automatically in SWIG---no special directives
12827 are needed. To disable this behavior. Use %ignore to ignore
12829 *** NEW FEATURE ***
12831 06/26/2002: beazley
12832 Deprecated the %except directive. %exception should be used instead.
12834 06/25/2002: beazley
12835 Major cleanup of the modules directory. Eliminated most
12836 header files, consolidated module code into single files.
12838 06/24/2002: beazley
12839 Reworked the instantiation of language modules. All language
12840 modules must now define a factory function similar to this:
12842 extern "C" Language *
12843 swig_python(void) {
12844 return new PYTHON();
12847 This function is then placed in a table and associated with
12848 a command line option in swigmain.cxx.
12850 This approach has a number of benefits. It decouples the
12851 SWIG main program from having to know about the class
12852 definitions for each module. Also, by using a factory
12853 function, it will be easier to implement dynamic loading
12854 of modules (simply load the file and invoke the factory
12857 06/24/2002: beazley
12858 Fixed syntax error for reference conversions. For example:
12862 06/24/2002: beazley
12863 Fixed syntax error for operator new[] and operator delete[].
12865 06/24/2002: beazley
12866 Fixed code generation problem for constants and default arguments
12867 involving templates.
12869 06/19/2002: ljohnson (Lyle Johnson)
12870 [Ruby] Fixed a bug for the '-feature' command line argument;
12871 that setting was effectively being ignored and so the feature
12872 name was always set equal to the module name.
12874 06/17/2002: beazley
12875 Fixed problems with static members and enums in templates.
12877 Version 1.3.13 (June 17, 2002)
12878 ==============================
12880 06/16/2002: beazley
12881 Fixed a bug with __FILE__ expansion in the preprocessor. On Windows,
12882 the backslash (\) is now converted to (\\) in the string literal
12883 used for __FILE__. Reported by Steve Glaser.
12885 06/14/2002: beazley
12886 Fixed warning message about 'name private in this context'. The
12887 warning is only generated for public methods. Reported by
12890 06/14/2002: beazley
12891 Fixed some problems related to template instantiation
12892 and namespaces. When SWIG expands a template, it does
12893 so with fully resolved types. For example, if you have this:
12895 template<class T> class foo { };
12896 typedef double Double;
12897 %template(foo_d) foo<Double>;
12899 then, it is handled as foo<double> in the typesystem.
12900 This fixes a number of subtle problems with inheritance
12903 06/14/2002: ljohnson (Lyle Johnson)
12904 [Ruby] Added missing bool typemaps for INPUT, OUTPUT and
12905 INOUT in Lib/ruby/typemaps.i.
12907 05/29/2002: cheetah (William Fulton)
12908 [Java] Fix for a couple of broken pragmas.
12910 05/29/2002: cheetah (William Fulton)
12911 Fix for unnecessary cast when wrapping global variable where
12912 the type is not parsed by SWIG - Java variables example
12913 failure as reported by Larry Virden.
12915 06/10/2002: beazley
12916 Modified %template to allow for empty instantiations.
12918 %template() foo<int,int>;
12920 This registers foo<int,int> with the type system, but
12921 doesn't wrap it (same as %ignore). This may only be a
12922 temporary measure. SWIG might be able to automatically
12923 instantiate templates in certain cases.
12925 06/10/2002: beazley
12926 Fixed function prototype problems with Tcl 8.4
12928 06/09/2002: beazley
12929 Fixed problem with templates and location of base classes.
12930 This one is a little mind-bending, but here is an example
12933 template <class ArgType, class ResType>
12936 typedef ArgType arg_type;
12937 typedef ResType res_type;
12940 template <class ArgType, class ResType>
12945 template <class AF, class AG>
12946 struct Class : Function<typename traits<AF, AG>::arg_type,
12947 typename traits<AF, AG>::res_type>
12951 %template(traits_dd) traits <double, double>;
12952 %template(Function_dd) Function <double, double>;
12953 %template(Class_dd) Class <double, double>;
12956 In this example, the base class of 'Class' is determined from
12957 the Function template, but the types are obtained through typedefs.
12958 Because of this, SWIG could not locate the wrapped base class
12959 (Function<double,double>). Should be fixed in 1.3.13 even
12960 though I can think of a million other things that might
12963 06/07/2002: beazley
12964 Fixed a problem with conversion operators. If you had an
12965 operator like this,
12967 operator double() const;
12969 SWIG was ommitting the "const" qualifier. This affected
12970 %rename and other directives. Reported by Zhong Ren.
12972 06/07/2002: beazley
12973 Lessened the strictness of abstract class checking. If
12974 you have code like this:
12978 virtual int method() = 0;
12981 class Bar : public Foo {
12987 SWIG will go ahead and generate constructor/destructors
12988 for Bar. However, it will also generate a warning message
12989 that "Bar" might be abstract (since method() isn't defined).
12990 In SWIG-1.3.12, SWIG refused to generate a constructor at all.
12992 06/07/2002: beazley
12993 Change to %template directive. If you specify something like this:
12995 %template(vi) std::vector<int>;
12997 It is *exactly* the same as this:
13000 %template(vi) vector<int>;
13003 SWIG-1.3.12 tried to instantiate the template outside of the namespace
13004 using some trick. However, this was extremely problematic and full
13005 holes. This version is safer.
13007 06/07/2002: beazley
13008 Fixed bug with scope qualification and templates. For example:
13012 Before, this was separated as scopes A<B, C>, and DD. Fixed now.
13014 06/06/2002: beazley
13015 Allow the following syntax:
13018 struct B : A { ... };
13020 A base class without a specifier is assumed to be public for a struct.
13022 06/06/2002: beazley
13023 Fixed syntax error with template constructor initializers.
13024 Reported by Marcelo Matus.
13026 06/06/2002: beazley
13027 Fixed bug with default template arguments.
13028 Reported by Marcelo Matus.
13030 06/05/2002: beazley
13031 Fixed subtle problems with %rename directive and template
13034 Code like this should now work:
13036 %rename(blah) foo<double>::method;
13038 template<class T> class foo {
13043 %template(whatever) foo<double>;
13045 06/05/2002: beazley
13046 Resolved some tricky issues of multi-pass compilation and
13047 and inheritance. The following situation now generates
13050 class Foo : public Bar {
13058 The following code generates a warning about incomplete classes.
13061 class Foo : public Bar { };
13063 The following code generates a warning about an undefined class.
13065 class Foo : public Bar { }; // Bar undefined
13067 This fixes a failed assertion bug reported by Jason Stewart.
13069 06/05/2002: ljohnson
13070 [Ruby] Added a warning message for the Ruby module about the lack
13071 of support for multiple inheritance. Only the first base class
13072 listed is used and the others are ignored. (Reported by Craig
13075 06/03/2002: beazley
13076 Fixed a bug with struct declarations and typedef. For example:
13078 typedef struct Foo Foo;
13083 A few other subtle struct related typing problems were
13086 Version 1.3.12 (June 2, 2002)
13087 =============================
13089 05/30/2002: beazley
13090 Fixed problem related to forward template class declarations and
13091 namespaces. Bug reported by Marcelo Matus.
13093 05/30/2002: beazley
13094 Added 'make uninstall' target. Contributed by Joel Reed.
13096 05/29/2002: beazley
13097 Fixed rather insidious bug with %rename, %feature and template specialization.
13100 %exception vector::__getitem__ {
13101 ... some exception ...
13104 template<class T> class vector {
13106 T __getitem__(int index); // Fine
13110 template<> class vector<int> {
13112 T __getitem__(int index); // Oops.
13116 Now, the %exception directive (and other features) should correctly apply to
13117 both vector and specializations.
13119 05/29/2002: beazley
13120 Subtle changes to %template() directive. Template arguments are now
13121 reduced to primitive types in template matching. For example:
13123 template<class T> class vector<T *> {
13124 ... partial specialization ...
13127 typedef int *IntPtr; // Gross typedef
13129 // Gets the above partial specialization
13130 %template(vectorIntPtr) vector<IntPtr>;
13132 This change is extremely subtle, but it fixes a number of potential
13133 holes in Luigi's STL library modules. For example:
13135 typedef int Integer;
13136 %template(vectori) vector<int>;
13138 05/29/2002: beazley
13139 Fixed rather insidious typemap bug related to const. const
13140 was being discarded through typedefs.
13142 05/29/2002: ljohnson (Lyle Johnson)
13143 [Ruby] Added input typemaps for const references to primitive
13144 types (in Lib/ruby/ruby.swg).
13146 05/29/2002: cheetah (William Fulton)
13147 [Java] The java arrray support functions are enclosed by
13148 a SWIG_NOARRAYS #define. Useful if not using arrays and
13149 it is desirable to minimise the amount of compiled code.
13151 05/29/2002: cheetah (William Fulton)
13152 [Java] Enums were not renamed when using %name or %rename
13155 05/28/2002: ljohnson
13156 [Ruby] Modified the name of the wrapper functions for the
13157 "new" singleton method and "initialize" instance method for
13158 consistency with the other language modules. The wrapper name
13159 for the function that implements "new" is alloc_classname and
13160 the wrapper name for the function that implements "initialize"
13164 05/27/2002: beazley
13165 Changes to runtime. Pointer conversion/creation functions
13166 now almost always have an extra "flags" argument. For
13169 SWIG_ConvertPtr(obj, void **, swig_type_info *ty, int flags);
13171 This extra parameter is reserved for future expansion and will
13172 be used for more control over pointers in future versions.
13174 05/27/2002: beazley
13175 Fix for C++ classes with private assignment operators. It
13176 is now possible to safely return objects like this by value.
13177 Caveat: the class must provide a copy constructor.
13179 05/26/2002: beazley
13180 -proxy option added to many language modules. This is the
13181 same as -shadow. We are merely changing terminology.
13183 05/26/2002: beazley
13184 [perl] Fixed some inconsistencies in the -package option.
13185 -package merely sets the package name to be used on the
13186 wrappers. It does not change the name of the shared library
13187 file or the name of the generated .pm file. This was
13188 broken at some point, but works again now.
13190 05/25/2002: beazley
13191 [perl] Fixed [ 475452 ] memory leak in return-by-value.
13192 Problem related to static member variables returning newly
13193 allocated objects. Reported by Roy Lecates.
13195 05/25/2002: beazley
13196 [perl] Fixed [ 513134 ] %BLESSEDMEMBERS isn't always right.
13197 Reported by Fleur Diana Dragan.
13199 05/25/2002: beazley
13200 Fixed [ 540735 ] -importall and the -I option.
13202 05/25/2002: beazley
13203 [guile] Fixed [ 532723 ] Default arg for char* can SegV.
13204 Error in guile module. Reported by Brett Williams.
13206 05/25/2002: beazley
13207 Subtle change to typemap application code. The "freearg"
13208 typemap must exactly match up with the "in" or "ignore"
13209 typemap. For example:
13211 %typemap(in) (char *data, int len) { ... };
13212 %typemap(freearg) char *data { ... };
13214 void foo(char *data, int len);
13216 In this case, the "in" typemap is applied, but the
13217 freearg typemap is not. This is because the freearg
13218 typemap doesn't match up with the input argument sequence.
13220 05/25/2002: beazley
13221 Fixed [ 548272 ] Default argument code missing braces.
13222 Reported by Brett Williams.
13224 05/25/2002: beazley
13225 Fixed [ 547730 ] SwigValueWrapper needed for constructors.
13226 Reported by William Fulton.
13228 05/25/2002: beazley
13229 Undefined identifiers now evaluate to 0 when evaluating
13230 preprocessor expressions. For example:
13236 where FOO is undefined or set to some non-numeric value.
13238 Fixes [ 540868 ] #if defined whatever - not parsed.
13239 Reported by Adam Hupp.
13242 05/24/2002: beazley
13243 SWIG now ignores the C++ 'export' keyword.
13245 05/23/2002: beazley
13246 Some refinement of type-name mangling to account for pointers, arrays,
13247 references, and other embedded type constructs.
13249 05/23/2002: beazley
13250 Initial attempt at supporting template partial specialization. At
13251 the very least, it is parsed and the classes are stored. Matching
13252 of instantiations to specialized version is more limited and based on
13253 the SWIG default typemap rules:
13259 Now, why in the world would you want to use this feature? Other
13260 than allowing for slightly modified class APIs, this capability is
13261 primarily used to provide advanced wrapping support for STL-like
13262 objects. It can also be mixed with typemaps. Here is an example:
13265 /* Generic version */
13266 template<class T> class vector {
13267 %typemap(in) vector<T> * {
13268 // A container of objects
13271 /* Partial specialization (pointers) */
13272 template<class T> class vector<T *> {
13273 %typemap(in) vector<T> * {
13274 // A container of pointers to objects.
13277 /* Specialization (integers). */
13278 template<> class vector<int> {
13279 %typemap(in) vector<int> * {
13280 // A container of integers.
13284 *** EXPERIMENTAL FEATURE ***
13286 05/23/2002: beazley
13287 Enhancement to typemaps. Normally, typemap variables are
13288 renamed to avoid conflicts. For example:
13290 %typemap(in) int * (int temp) {
13294 This results in code that creates and uses variables "temp1","temp2",
13295 "temp3" and so forth depending on how many times the typemap is used.
13296 Sometimes you want a single variable instead. To do that, using
13297 the following naming scheme:
13299 %typemap(in) int *(int _global_temp) {
13302 Is this case, a single variable _global_temp is emitted in the
13303 wrapper functions. It is shared across all typemaps. Repeated
13304 typemaps do not replicate the variable---they use the first one
13306 *** NEW FEATURE ***
13308 05/23/2002: beazley
13309 Minor enhancement to typemaps. If you have this code,
13311 %typemap(in) Foo (int somevar = 3) {
13315 the default value for somevar is now emitted into the wrapper code.
13317 05/22/2002: beazley
13318 Fixed %extend to be better behaved in namespaces. If you have code
13329 SWIG matches the blah() method to a C function named
13330 void foo_bar_blah(foo::bar *self).
13332 This is consistent with the non-namespace version.
13333 Bug reported by Marcelo Matus.
13335 05/22/2002: beazley
13336 New library files: cpointer.i, carrays.i, cmalloc.i. These
13337 provide access to C pointers and memory allocation functions.
13338 See Doc/Manual/Library.html for details.
13340 05/22/2002: cheetah (William Fulton)
13341 [Java] C type char no longer maps to Java type byte, but to Java type char.
13342 It is now treated as a character rather than a signed number. This fits in
13343 with the other language modules and is a more natural mapping as char* is
13344 mapped as a string of characters. Note that the C signed char type is still
13345 mapped to a Java byte.
13347 *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
13349 05/22/2002: cheetah (William Fulton)
13350 [Java] Improved constants wrapping. Constants (#define and %constant) values
13351 are now obtained through a JNI call. Previously the value was compiled as
13352 Java code, but this didn't work for all cases, eg #define 123ULL.
13354 05/22/2002: beazley
13355 Fixed bogus error message with %extend directive and C++
13356 access specifiers. Reported by Marcelo Matus.
13358 05/22/2002: beazley
13359 Namespaces and enums now work correctly. For example:
13365 Bug reported by Marcelo Matus.
13367 05/21/2002: beazley
13368 The %types directive can now be used to specify inheritance relationships
13369 in the runtime type system. For example,
13373 specifies that Foo isa Bar. Using this is potentially quite dangerous.
13374 However, this is useful in certain cases (and in the SWIG library).
13376 05/20/2002: beazley
13377 %nodefault and %makedefault directives now require a trailing semicolon.
13384 In addition both directives can take a class name. For example:
13388 class Foo { /* No default constructor/destructor */
13391 class Bar { /* Default constructor/destructor generated */
13394 *** POTENTIAL INCOMPATIBILITY ***
13395 If you don't use the trailing semicolon, things will mysteriously break.
13397 05/20/2002: beazley
13398 More improvements to type system handling. SWIG now correctly handles
13399 template names and parameters in a namespace. For example:
13402 template<class T> class bar { };
13403 typedef int Integer;
13405 void blah(bar<Integer> *x);
13408 In the generated code, all of the typenames are properly qualified.
13410 05/17/2002: cheetah (William Fulton)
13411 [Java] deprecated broken -jnic and -jnicpp commandline options. The C or C++
13412 JNI calling convention is now determined from the -c++ commandline option.
13414 05/16/2002: cheetah (William Fulton)
13415 [Java] The JCALL macros which exist so that the same typemaps can be used
13416 for generating both the C and C++ JNI calling conventions no longer appear
13417 in the generated code. This is because the output is now passed through the
13418 SWIG preprocessor which does the macro expansion for either C or C++ (depending
13419 on whether -c++ is passed on the SWIG commandline).
13421 The generation of the functions used in the array typemaps have been adjusted
13422 to take account of this. The side effect is that any typemaps which contained
13423 JCALL macros within %{ %} brackets will have to be moved within {} brackets
13424 so that the SWIG preprocessor can expand the macros.
13426 *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
13428 05/13/2002: beazley
13429 Class templates may now be used as template parameters. For example:
13431 template<class T, template<class> class C> class Foo {
13434 template<class T> class Bar {
13438 %template(Fooi) Foo<int, Bar>;
13440 SWIG doesn't really do anything special with this---it's just
13441 another way of specifying a template parameter.
13443 05/13/2002: beazley
13444 Minor refinement of template support. Template parameter names are no longer
13445 required for types. For example:
13447 template<bool> class Foo {
13450 Obviously, names are required for template<class T>;
13452 05/12/2002: beazley
13453 New macro expansion in typemaps. The sequence:
13457 Will expand into the SWIG type descriptor structor for
13458 the given type. Type may be any abstract datatype.
13462 $descriptor(int (*)(int,double))
13463 $descriptor(vector<int> *)
13465 Caveat: It is *NOT* currently legal to use other typemap
13466 substitution variables in the macro. For example
13467 $descriptor($1_type).
13469 The primary purpose of this modification is to better
13470 support typemaps for container objects or to allow typemaps
13471 that might be performing type conversions.
13472 *** NEW FEATURE ***
13474 05/11/2002: beazley
13475 The wrapping of references to primitive types has been
13476 changed as follows:
13478 Arguments of type 'const primitive &' are now passed
13479 by value as opposed to pointers. Return values of
13480 type 'const primitive &' are returned as values instead of
13483 'primitive' is any one of int, short, long, long long,
13484 char, float, double, bool (as well as unsigned variants).
13486 This change is being made to better support C++ wrapping--especially
13487 code that makes use of templates and the STL.
13489 05/11/2002: beazley
13490 The %template directive can now be used to access templates
13491 in a namespace. For example:
13494 template<class T> class complex {
13497 complex(T _r = T(), T _i = T()) : re(_r), im(_i) { }
13498 T real() { return re; }
13499 T imag() { return im; }
13503 %template(complex) std::complex<double>;
13505 Note: There are some very subtle namespace/symbol table
13506 management issues involved in the implementation of this.
13507 It may not work in certain cases.
13509 05/10/2002: beazley
13510 Member template constructor support added. For example:
13512 template<typename _T1, typename _T2>
13516 pair() : first(_T1()), second(_T2()) { }
13517 template<class _U1, class _U2> pair(const pair<_U1,_U2> &x);
13520 To instantiate the template, use %template and %extend.
13521 For example, this expands the constructor into a default
13525 %template(pair) pair<_T1,_T2>;
13528 Highly experimental. Other uses may be broken.
13530 05/10/2002: beazley
13531 The %extend (%addmethods) directive no longer works unless
13532 it appears in the public section of a class. An error
13533 message is now generated (as opposed to a segmentation fault).
13535 05/09/2002: beazley
13536 New %warnfilter() directive. This directive attaches a warning
13537 filter to specific declarations and has the same semantics as
13538 %rename, %ignore, %feature, and so forth. For example:
13540 %warnfilter(501) foo; // Suppress overloaded warning
13546 %warnfilter(501) Object::foo(double);
13553 This feature only suppresses warnings in later stages of code
13554 generation. It does not suppress warnings related to preprocessing
13556 *** NEW FEATURE ***
13558 05/09/2002: beazley
13559 SWIG now supports C99 variadic preprocessor macros. For example:
13561 #define debugf(fmt,...) fprintf(stderr,fmt,__VA_ARGS__)
13563 The argument "..." is used to indicate variable arguments which
13564 are all placed into the special argument name __VA_ARGS__ in
13565 the macro expansion.
13567 SWIG also implements the GNU (##) extension for swallowing the
13568 preceding comma when __VA_ARGS__ is empty. For example:
13570 #define debugf(fmt,...) fprintf(stderr,fmt, ##__VA_ARGS__)
13572 Here is how this is expanded:
13574 debugf("%d", 3) --> fprintf(stderr,"%d",3)
13575 debugf("Hello") --> fprintf(stderr,"Hello" )
13577 (notice the deleted comma).
13578 *** NEW FEATURE ***
13580 05/08/2002: samjam (Sam Liddicott)
13581 Many changes to php module. Shadow classes are now implemented
13582 entirely in native C and no need for php-code shadow wrappers
13583 Populated template config.m4 and Makefile.in as needed by
13584 phpize are generated.
13586 05/08/2002: ljohnson (Lyle Johnson)
13587 [Ruby] A copy constructor is now turned into a "clone"
13588 instance method (see Dave's change for copy constructors
13589 dated 4/7/2002). This seems like the appropriate thing
13590 to do for Ruby code.
13592 05/08/2002: ljohnson (Lyle Johnson)
13593 [Ruby] Fixed [ 553864 ] Inline destructor code not written.
13595 05/08/2002: beazley
13596 %ignore behaves better with constructors, destructors, and the
13597 type system in general. For constructors and destructors,
13598 %ignore now suppresses the creation of a default constructor
13599 or destructor. For example:
13609 In SWIG-1.3.11, ~Foo() simply "disappeared" and the code generator
13610 created a wrapper for a default destructor (as if it was never
13611 declared in the interface). In SWIG-1.3.12, %ignore suppresses
13612 the creation of a destructor if one is actually defined.
13614 Similarly, even though a declaration is ignored, information
13615 may still be needed to properly handle types. For example, here
13616 is a very subtle error that is fixed by this change:
13618 %ignore std::string; // Prevent class wrapping
13623 %typemap(in) string * {
13628 void foo(std::string *s); // Broken.
13630 Before this fix, %ignore would cause the class definition to disappear.
13631 This, in turn, would cause the typemap to be misapplied.
13633 05/08/2002: beazley
13634 Minor changes to %rename, %ignore, %feature, and related directives
13635 for better support of destructors. Destructors can now be precisely
13636 tagged. For example:
13639 %feature("action") ~Bar {
13643 *Developer warning*
13644 Operations such as renaming and feature attachment for classes used to
13645 be applied to destructors as well. For instance, if you did this:
13649 The operation applied to the class itself, the constructor, and
13650 the destructor. This is no longer the case. Now such operations
13651 will only apply to the class and the constructor. Note: if you
13652 were relying on this for class renaming, be aware that renamed
13653 classes should really only be handled at the level of the class itself
13654 and not the level of individual declarations in the class (although
13655 they can be renamed individually if needed). As far as I know,
13656 the Language class is already taking care of this case correctly.
13658 05/07/2002: beazley
13659 New set of tests. The Examples/test-suite/errors directory contains
13660 tests that try to exercise all of SWIG's error and warning messages.
13662 05/07/2002: beazley
13663 Start of a warning framework. Warning messages are now assigned numeric values
13664 that are shown in warning messages. These can be suppressed using the
13665 -w option. For example:
13667 swig -w302 example.i
13668 swig -w302,305 example.i
13670 Alternatively, the #pragma preprocessor directive can be used to disable this:
13672 #pragma SWIG nowarn=302
13673 #pragma SWIG nowarn=302,305
13675 Note: Since SWIG is a multi-pass compiler, this pragma should
13676 only be used to change global settings of the warning filter. It should
13677 not be used to selectively enable/disable warnings in an interface file.
13678 The handling of #pragma occurs in the C++ preprocoessor and affects all
13679 subsequent stages of compilation.
13681 The -Wall option turns on all warnings and overrides any filters that
13682 might have been set.
13684 Warnings can be issued from an interface using %warn. For example:
13686 %warn "110:%section is deprecated"
13688 The first part of a warning message is an optional warning number.
13689 A complete set of warning numbers is found in Source/Include/swigwarn.h.
13690 *** NEW FEATURE ***
13692 05/07/2002: beazley
13693 Internal parsing change. Directives to include files now use brackets [ ... ]
13694 instead of { ... }.
13696 %includefile "foo.i" [
13700 The use of { ... } was a bad choice because they were included implicitly by
13701 the preprocessor and made it impossible to properly detect legitimate missing '}'
13705 05/02/2002: beazley
13706 SWIG European Tour: Paris-Amsterdam-Bath.
13708 04/23/2002: beazley
13709 The %addmethods directive has been renamed to %extend.
13717 int blah() { ... };
13722 Motivation: the %addmethods directive can be used for many
13723 other tasks including adding synthesized attributes, constructors,
13724 and typemaps. Because of this, "addmethods" is somewhat misleading.
13725 %extend more precisely describes this operation---extension of a
13726 class or structure.
13728 *** POTENTIAL INCOMPATIBILITY ***
13729 %addmethods still works via a macro definition. However,
13730 a warning message may be generated. Errors involving %addmethods
13731 will actually refer to the %extend directive.
13733 04/23/2002: beazley
13734 Further refinement of the type system. Typedef now
13735 propagates through functions, pointers to functions,
13736 and pointers to member functions.
13739 typedef int Integer;
13740 void foo(int (*x)(int), Integer (*y)(Integer));
13742 In this case, arguments 'x' and 'y' have exactly
13743 the same type (and would obviously accept objects
13746 Similarly, consider this:
13752 void bar(int (Foo::*x)(int), int (Bar::*y)(int));
13754 In this case, arguments x and y are the same
13755 type (via typedef).
13757 04/22/2002: beazley
13758 SWIG now generates a warning message if any part of
13759 an expression involves values from a private part of a class.
13766 void blah(int a, int b = X); // Warning
13769 In this case, the default argument is ignored. There
13770 are workarounds, but they are rather clumsy. For instance,
13773 %feature("action") blah(int,int) {
13775 result = blah(arg1);
13777 result = blah(arg1,arg2);
13780 void blah(int a, int b = 0);
13783 04/21/2002: beazley
13784 Use of the %inline directive inside a namespace is
13785 forbidden and now generates an error message. This is
13786 not allowed since the inlined code that is emitted is
13787 not placed inside a namespace. This confuses other
13790 04/21/2002: beazley
13791 Some bug fixes to casting operations and expression
13792 parsing. Due to some parsing issues, it is not
13793 currently possible to use casts for all possible
13794 datatypes. However, the common cases work.
13796 04/20/2002: beazley (Amsterdam)
13797 Member templates now work. Simply use the %template
13798 directive inside a class or %addmethods to create
13799 instantiations (see Doc/Manual/SWIGPlus.html). Supporting
13800 this was easy---earlier changes to templates made it
13801 possible using only a two-line modification to the parser
13802 and a few minor modifications elsewhere. Hmmm, come to
13803 think of it, the smoke was rather thick in that Internet "cafe".
13804 *** NEW FEATURE ***
13806 04/19/2002: beazley (TGV)
13807 Improved handling of non-type template parameters. For example:
13811 Simple numbers and strings can be used with the %template
13812 directive as well. For example:
13814 %template(vecint100) vector<int,100>;
13816 Note: Arithmetic expressions are not currently allowed.
13818 Default template arguments now work and do not have to
13819 be given to %template.
13821 04/18/2002: beazley (Paris)
13822 Change in internal template handling. Template
13823 parameters are now fully integrated into the type
13824 system and are aware of typedefs, etc. This builds
13825 upon the change below.
13827 *** DEVELOPER WARNING ***
13828 Word of caution to language module writers. The "name"
13829 parameter of certain parse tree nodes (classes, functions, etc.)
13830 may be parameterized with types. This parameterization is
13831 done using SWIG type-strings and not the underlying C version.
13834 int max<int *>(int *,int *)
13836 has a name of "max<(p.int)>". If you use the name directly,
13837 you may get syntax errors in the generated code. To fix this,
13838 use SwigType_namestr(name) to convert a parameterized name
13839 to a C name with valid syntax. The internal version is
13840 used to reduce template types to a common representation
13841 and to handle issues of typedef.
13843 04/16/2002: beazley (somewhere over the Atlantic)
13844 Enhancement of typedef resolution. The type system is now
13845 aware of template arguments and typedef. For example:
13847 typedef int Integer;
13849 foo(vector<int> *x, vector<Integer> *y);
13851 In this case, vector<int> and vector<Integer> are
13852 the same type. There is some interaction between this
13853 mechanism and the implementation of typemaps. For example,
13854 a typemap defined for vector<int> * would apply to either type.
13855 However, a typemap for vector<Integer> * would only apply to
13858 Typedefs and typemaps and matched by left-most expansion.
13861 vector<Integer,Integer> -->
13862 vector<int, Integer> -->
13866 04/24/2002: cheetah (William Fulton)
13867 [Java] Changes to Java shadow classes.
13868 Overcomes a bug where the module assumed that a pointer to a derived
13869 class could be used in place of a pointer to a base class. Thanks
13870 to Stephen McCaul for analysing the bug and submitting patches.
13872 A consequence is that the getCPtr() method in each shadow class has
13873 disappeared and has been replaced with a getCPtrXXX(), where XXX is the
13874 shadow class name. If you have code that previously used getCPtr(),
13875 and the associated class is wrapping a C struct or a C++ class that
13876 is not involved in an inheritance chain, just use the new method. If
13877 however, the class is involved in an inheritance chain, you'll have
13878 to choose which pointer you really want. Backwards compatibility
13879 has been broken as not using the correct pointer can lead to weird bugs
13880 through ill-defined behaviour. If you are sure you want the old methods,
13881 you could add them back into all shadow classes by adding this at the
13882 beginning of your interface file:
13884 %pragma(java) allshadowcode=%{
13885 public long getCPtr(){
13890 Please see entry dated 07/23/2002 to see how to do this after the deprecation
13891 of the allshadowcode pragma.
13893 *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
13895 04/13/2002: beazley
13896 Fixed problem with default arguments and references. Declarations such
13897 as this should now work:
13899 void foo(const string &x = "Hello");
13901 04/12/2002: beazley
13902 Added typemap $* substitutions for typemaps involving arrays.
13903 Requested by William Fulton.
13905 04/11/2002: beazley
13906 Template specialization is now supported. For example:
13908 template<> class vector<int> {
13912 When the %template directive is used, it will use a specialization
13913 if one is defined. There are still some limitations. Partial
13914 specialization is not supported. A template of type <void *> does
13915 not match all pointers.
13916 *** NEW FEATURE ***
13918 04/11/2002: beazley
13919 Major change to template wrapping internals. Template declarations are
13920 no longer processed as macros but now result in real parse-tree
13921 nodes. The %template directive expands these nodes into a
13922 specific instantiation. This change enables a number of
13923 new and interesting capabilities:
13925 Directives such as %rename, %feature, and %addmethods can
13926 now be applied to uninstantiated templates. For example:
13928 %rename(barsize) vector::bar(char *buf, int len);
13930 template<typename T> class vector {
13933 void bar(char *buf);
13934 void bar(char *buf, int len); // Renamed
13938 %template(intvector) vector<int>; // Renaming carries through
13941 By parsing templates into an internal data structure, it will
13942 be possible to support specialization (and maybe partial
13945 This is highly experimental and a work in progress.
13947 *** POTENTIAL INCOMPATIBILITY ***
13948 In SWIG-1.3.11, template declarations were simply processed
13949 as weird macros. No other information was retained. This
13950 made it impossible to support more advanced features and
13951 complicated many other parts of the implementation.
13953 04/09/2002: beazley
13954 Change to template class wrapping. There were a variety of
13955 "issues" with the old approach related to parsing, the type
13956 system, and namespaces. These changes are meant to rectify
13957 some of these problems:
13959 A specific instantiation of a template can now be specified
13960 by including the class inline like this:
13962 class vector<int> {
13969 This is template specialization, but partial specialization is
13970 not yet implemented.
13972 The %template directive has been modified to expand roughly as
13975 %template(vecint) vector<int>;
13979 %rename(vecint> vector<int>;
13980 class vector<int> {
13986 Note that this simply builds upon the code above (templates
13989 This modified approach to wrapping fixes some subtle type
13990 issues. For instance, you can now define typemaps and typedefs
13993 %typemap(in) vector<int> * {
13996 typedef vector<int> intvector;
13998 void blah(intvector *v); // Gets the above typemap
14000 This did not work in SWIG-1.3.11 due to a peculiarity of
14001 the template implementation.
14003 %template(name) no longer installs the template as a class
14004 with name "name". This might break %addmethods as described
14005 in the manual. For example:
14007 %template(vecint) vector<int>;
14008 %addmethods vecint { // Fails. vecint not a class
14012 To fix this, just use the template name instead:
14014 %addmethods vector<int> {
14018 Note: This technique might be a way to implement some bizarre
14019 template specialization techniques. For example:
14021 %addmethods vector<int> {
14022 // Only applied if vector<int> instantiated later
14023 %typemap(in) vector<int> * {
14029 *** POTENTIAL INCOMPATIBILITY ***
14031 04/08/2002: beazley
14032 Fixed [ 540868 ] #if defined whatever - not parsed. SWIG should
14033 now correctly handle preprocessor directives like this:
14035 #if defined __cplusplus
14039 Note: was implemented previously, but there was a minor bug.
14040 Reported by Adam Hupp.
14042 04/07/2002: beazley
14043 %readonly and %readwrite are deprecated due to a change in the
14044 implementation. Instead of being pragmas, mutability is now
14045 controlled as a "feature" using the following two directives:
14048 int x; // read-only variable
14049 int y; // read-only variable
14051 int z; // Modifiable
14053 %immutable and %mutable are much more powerful than their older
14054 counterparts. They can now pinpoint a specific declaration like
14057 %immutable x; /* Any x */
14058 %immutable Foo::x; /* x in class Foo */
14060 In fact, the matching algorithm is the same as for %rename,
14061 %ignore, and other directives. This means that the declaration
14065 would not only apply to class Foo but to all derived classes
14068 *** POTENTIAL INCOMPATIBILITY ***
14069 %immutable and %mutable must be terminated by a semi-colon. This
14070 differs slightly from the older %readonly and %readwrite directives.
14071 Since %immutable and %mutable can be applied to declarations the
14072 semicolon is needed to distinguish between a global feature and
14073 one targeted to a single declaration. Note: this incompatibility is the
14074 primary reason for changing the name of the directive.
14076 04/07/2002: beazley
14077 New handling of copy constructors. If a class defines
14078 constructors like this:
14083 Foo(const Foo &); // Copy constructor
14087 SWIG now generates a function copy_Foo() for the copy
14090 In previous verions, this generated a name-clash and an
14091 error message. To preserve backwards compatibility, SWIG
14092 does not change the behavior if %rename is used to resolve
14093 the name conflict. However, if no name resolution is made,
14094 this new approach is used.
14096 Copy constructors may be handled as a special case in the
14097 target language. However, this is up to the language module
14100 04/07/2002: beazley
14101 The %template directive is now namespace aware. This allows
14105 template<typename T> max(T a, T b) { return a > b ? a : b; }
14108 using namespace foo;
14109 %template(maxint) max<int>; // Ok
14113 %template(maxdouble) max<double>; // Ok
14116 Caveat: the template name supplied to %template must be defined in the
14117 same scope in which the %template directive appears. This code is
14120 %template(maxint) foo::max<int>;
14122 04/07/2002: beazley
14123 Minor enhancement to preprocessor. The preprocessor can now perform
14124 string comparison. For example:
14132 The primary use of this is in SWIG macros. For example:
14136 /* Special handling for int */
14141 Normal users can probably safely ignore this feature. However, it may
14142 be used in parts of the SWIG library.
14144 04/07/2002: beazley
14145 Further refinement of default constructor/destructor wrapper generation.
14146 SWIG is now much more aware of pure virtual methods. For instance:
14148 class A { /* Abstract */
14150 virtual void method1() = 0;
14151 virtual void method2() = 0;
14153 class B : public A { /* Abstract */
14155 virtual void method1() { };
14158 class C : public B { /* Ok */
14160 virtual void method2() { };
14163 In this case, SWIG will only generate default constructors for C.
14164 Even though B looks fine, it's missing a required method and is abstract.
14166 04/04/2002: beazley
14167 Subtle change to structure data member access. If you
14168 have a structure like this:
14174 The accessor functions for b are generated as follows:
14176 (1) If b is *not* defined as a structure or class:
14178 Bar Foo_b_get(Foo *self) {
14181 void Foo_b_set(Foo *self, Bar value) {
14185 (2) If b *is* defined as a structure or class:
14187 Bar *Foo_b_get(Foo *self) {
14190 void Foo_b_set(Foo *self, Bar *value) {
14193 See the "Structure data members" section of Doc/Manual/SWIG.html
14194 for further details.
14196 *** POTENTIAL INCOMPATIBILITY ***
14197 This may break interfaces that relied on a lot of a undeclared
14198 structure and class names. To get the old behavior, simply
14199 use a forward declaration such as "struct Bar;"
14201 04/04/2002: beazley
14202 C++ namespace support added. SWIG supports all aspects of
14203 namespaces including namespace, using, and namespace alias
14204 declarations. The default behavior of SWIG is to flatten
14205 namespaces in the target language. However, namespaces are
14206 fully supported at the C++ level and in the type system.
14207 See Doc/Manual/SWIGPlus.html for details on the implementation.
14209 04/02/2002: cheetah (William Fulton)
14210 [Java] Sun has modified javac in jdk1.4 to no longer compile
14211 an import of an unnamed namespace. To fix this SWIG no longer
14212 generates the import for packageless classes.
14213 http://developer.java.sun.com/developer/bugParade/bugs/4361575.html
14214 As reported SF #538415.
14216 03/27/2002: ljohnson (Lyle Johnson)
14217 [Ruby] Added support for pointer-to-member, similar to that
14218 for the Python module. Remarkably similar. Also added a new
14219 example for this (Examples/ruby/mpointer), which is remarkably
14220 similar to the Python example of the same name.
14222 03/26/2002: ljohnson (Lyle Johnson)
14223 [Ruby] Made a few minor edits to the "Advanced Topics"
14224 chapter of the SWIG manual and added a new major section
14225 about how to create multi-module Ruby packages with SWIG.
14227 03/26/2002: ljohnson (Lyle Johnson)
14228 [Ruby] Removed all of the old Ruby pragmas. If any of this
14229 functionality is truly missed we can resurrect it, preferably
14230 with some kind of feature-based directive.
14232 03/25/2002: ljohnson (Lyle Johnson)
14233 [Ruby] Fixed SWIG exception library support for Ruby, which
14234 has apparently been broken for some time. Luckily, no one seems
14237 03/23/2002: beazley
14238 C++-namespace support in SWIG directives.
14242 The %addmethods directive now accepts a fully qualified classname
14243 and can be used inside C++ namespace declarations. For example:
14245 // Attaches to the class Foo::Bar below
14246 %addmethods Foo::Bar {
14247 int somemethod() { ... }
14256 // Attaches to the class Bar above
14258 int othermethod() { ... };
14262 %feature, %rename, %ignore, %exception, and related directives:
14264 Namespaces are fully integrated into the the renaming and declaration
14265 matcher. For example:
14267 %rename(display) Foo::print; // Rename in namespace Foo
14268 %ignore Foo::Bar::blah; // Ignore a declaration
14270 %rename directives can be placed inside namespace blocks as well. For
14274 %rename(display) print; // Applies to print below
14279 Most other SWIG directives should work properly inside namespaces.
14280 No other changes are needed.
14282 03/22/2002: beazley
14283 Some changes to internal symbol table handling. SWIG no longer
14284 manages structures and unions in a separate namespace than normal
14285 declarations like ANSI C. This means you can't have a structure
14286 with the same name as a function. For example:
14294 This approach is more like C++. It's not clear that SWIG ever
14295 really supported the ANSI C anyways---using the same name would
14296 almost certainly generate a name-clash in the target language.
14298 03/22/2002: ljohnson (Lyle Johnson)
14299 [Ruby] Fixed [ 517302 ] for handling of renamed overloaded
14300 constructors. Now, renamed overloaded constructors are converted
14301 into class singleton methods (basically acting as "factory"
14304 03/21/2002: beazley
14305 Fixed [ 532957 ] %ignore parse error and casting operator.
14306 Reported by William Fulton.
14308 03/18/2002: beazley (** ADVANCED USERS ONLY **)
14309 Added support for dynamic casting in return values. A somewhat
14310 common problem in certain C++ programs is functions that hide
14311 the identity of underlying objects when they are returned
14312 from methods and functions. For example, a program might include
14313 some generic method like this:
14317 However, Node * may just be base class to a whole hierarchy
14318 of different objects. Instead of returning this generic Node *,
14319 it might be nice to automatically downcast the object into the
14320 appropriate type using some kind dynamic cast.
14322 Assuming you understand the peril involved, a downcast can now
14323 be performed using the following function in the run-time type
14326 swig_type_info *SWIG_TypeDynamicCast(swig_type_info *, void **ptr);
14328 This function checks to see if the type can be converted to another
14329 type. If so, a different type descriptor (for the converted type)
14330 is returned. This type descriptor would then be used to create
14331 a pointer in the target language.
14333 To use this, you would write a typemap similar to this:
14335 %typemap(out) Node * {
14336 swig_type_info *ty = SWIG_TypeDynamicCast($1_descriptor, (void **) &$1);
14337 $result = SWIG_NewPointerObj($1, ty);
14342 %typemap(out) Node * = SWIGTYPE *DYNAMIC;
14344 To make the typemap have any effect, you have to write a supporting
14345 function that knows how to perform downcasting. For example:
14348 static swig_type_info *
14349 Node_dynamic_cast(void **ptr) {
14350 Node **nptr = (Node **) ptr;
14351 Element *e = dynamic_cast<Element *>(*nptr);
14354 return SWIGTYPE_p_Element;
14356 Data *d = dynamic_cast<Data *>(*nptr);
14359 return SWIGTYPE_p_Data;
14365 There is no restriction on how types are determined. dynamic_cast<>
14366 uses C++ RTTI. However, if you had some other mechanism for determining
14367 the type, you could use that here. Note: it is important to save
14368 the new pointer value back into the argument as shown. When downcasting,
14369 the value of the pointer could change.
14371 Finally, to make the casting function available, you have to register
14372 it with the run-time type checker. Put this macro in your interface file.
14374 DYNAMIC_CAST(SWIGTYPE_p_Node, Node_dynamic_cast);
14376 Note: this feature does not introduce a performance penalty on
14377 normal SWIG operation. The feature is only enabled by writing
14378 a new typemap that explicitly calls SWIG_TypeDynamicCast() to
14381 Examples/test-suite/dynamic_cast.i contains a simple example.
14382 This feature is not supported in the Java module due to differences
14383 in the type-checking implementation.
14385 *** EXPERIMENTAL FEATURE ***
14387 03/17/2002: beazley
14388 Small change to type-name handling of unnamed structures and
14389 typedef. If a structure of this form appears:
14395 Then 'Foo' is used as the proper typename for the structure.
14396 Furthermore, Foo can now be used as a name in C++ inheritance.
14397 SWIG was already kind of doing this, but this modification refines
14398 the implementation to more closely follow the C++ ARM, section
14399 7.1.3, p. 106. This fixes a couple of obscure corner cases.
14401 03/16/2002: beazley
14402 Modified C++ inheritance with a few enhancements. First, type information
14403 needed for casting and type-equivalence is generated even when base-classes
14404 aren't defined in the interface. For example:
14406 class Foo : public Bar { /* Bar unspecified */
14413 In this case, the blah() function still accepts Foo * even though nothing
14414 is really known about Bar. Previous SWIG versions would just generate
14417 Inheritance has also been modified to work through typedef. For example:
14422 typedef Bar OtherBar;
14423 class Foo: public OtherBar {
14426 In this case, the base class of OtherBar is correctly resolved back to
14427 Bar. The use of the name OtherBar is lost in this resolution (the wrappers
14428 will simply use Bar instead of the typedef name OtherBar).
14430 03/13/2002: beazley
14431 %typemap, %apply, and related directives can now appear inside
14434 03/13/2002: beazley
14435 Fixed a variety of problems related to compiling SWIG on 64-bit
14438 03/12/2002: beazley
14439 Fixed problem with "ignore" and "in" typemaps. Local variables
14440 associated with "in" were being added to the wrapper function even
14441 though they were never used. Mostly harmless, but it would lead
14442 to a variety of compilation warnings.
14444 03/12/2002: beazley
14445 Some changes to the internal type system and handling of nested C++
14446 types. In previous versions of SWIG, if you had the following:
14452 class Bar : public Foo {
14454 void somemethod(Blah x);
14457 The argument type in somemethod() would implicitly be set to Bar::Blah.
14458 Although this is technically allowed, it breaks typemaps. For example:
14460 %typemap(in) Foo::Blah { ... }
14462 doesn't match like you expect. This has been changed in SWIG-1.3.12.
14463 Now, types are expanded using the class in which they were defined.
14464 So, the argument type in somemethod() will be Foo::Blah---since the
14465 type Blah was defined in Foo.
14467 03/10/2002: beazley
14468 Fixed some subtle type scoping problems with typedef and C++ classes.
14474 typedef double Blah;
14475 void foo(Blah x, ::Blah y);
14479 03/10/2002: beazley
14480 Highly experimental change to handle variable length arguments.
14481 First, there is no portable or reliable way to wrap
14482 a varargs function in full generality. However, you *can* change
14483 the function signature using %varargs.
14485 %varargs(char *) fprintf;
14487 void fprintf(FILE *f, char *fmt, ...);
14489 In this case, the variable length parameter "..." is
14490 simply replaced by the parameters given in %varargs. This
14491 results in a function like this:
14493 void fprintf(FILE *f, char *fmt, char *s);
14495 More than one argument can be used and default values
14496 can be defined. For example, this code specifies a
14497 maximum of four arguments.
14499 %varargs(char *x1 = 0, char *x2 = 0, char *x3 = 0, char *x4 = 0) fprintf;
14501 *** EXPERIMENTAL NEW FEATURE ***
14503 03/10/2002: beazley
14504 Change to handling of variable length arguments. varargs
14505 is now handled as a proper parameter and is passed to the
14506 code generator. However, it still can't be handled correctly
14507 (and will generate a typemap warning). This change has been
14508 made to better incorporate variable length arguments with other
14509 directives such as %ignore, %rename, %feature, and so forth.
14511 03/10/2002: beazley
14512 Fixed [ 522555 ] Syntax error parsing "define" construct. SWIG
14513 is a little more restrictive in determining #define statements
14514 that will be wrapped as constants. Also added a better parser
14515 error rule for handling bad constants.
14517 03/08/2002: cheetah (William Fulton)
14518 [Java] Bug fix: Classes renamed with %rename that are derived from
14519 another class generate more appropriate shadow class code.
14521 03/08/2002: cheetah (William Fulton)
14522 [Java] Fixed SF [ #523632 ] and [ #513335 ] both reported by Israel
14523 Tanner. Support for types that are used which are in a typedef. The
14524 appropriate shadow class name is generated. Also generated correct
14525 shadow classname when a templated class is used within another
14526 templated class. See the cpp_typedef.i testcase.
14528 03/08/2002: cheetah (William Fulton)
14529 [Java] Bug fix: No type was generated in shadow classes for types
14530 that weren't wrapped by SWIG. The type is treated as a raw
14531 pointer, ie no shadow class.
14533 02/22/2002: beazley
14534 Refined the matching algorithm used by %rename, %ignore, and
14535 %feature. If a type signature is supplied, it must exactly
14536 match that used in the declaration---including any use of
14537 const. For example:
14539 %rename(foo1) foo(int);
14540 %rename(bar1) bar(int) const;
14544 void foo(int); // Matched --> foo1
14545 void foo(int) const; // Not matched
14546 void bar(int); // Not matched
14547 void bar(int) const; // Matched --> bar1
14550 In previous versions, a non-const specification would match
14551 both the non-const and const declarations. However, the whole
14552 point of %rename and related directives is that they be able
14553 to precisely pinpoint exact declarations in an interface. This
14556 02/21/2002: beazley
14557 Reworked the handling of default constructor and destructors.
14558 SWIG now makes a preliminary pass over the parse tree to discover
14559 which classes support default allocation. This fixes a number
14560 of very subtle issues in code generation and call/return by value.
14562 02/18/2002: cheetah (William Fulton)
14563 Improved support on Cygwin: Perl, Python, Tcl, Ruby and Java should
14564 work out of the box, barring the runtime library. Removed dllwrap
14565 and replaced with newly working gcc -shared instead for Cygwin.
14566 All this will require the new improved binutils 20010802 and later,
14567 but the latest Cygwin is usually the best recommendation.
14569 02/15/2002: beazley
14570 Fixed some problems related to wrapping of global variables
14571 and Perl shadow classes. Reported by Chia-liang Kao.
14573 02/15/2002: ljohnson (Lyle Johnson)
14574 [Ruby] Made a fix to the code generation for C++ class
14575 constructors so that we get both a "new" singleton method
14576 and an "initialize" instance method for each class. This
14577 change enables developers to derive new Ruby classes from
14578 SWIG-wrapped C++ classes and then override their initialize
14579 methods to provide subclass-specific instance initialization.
14581 02/15/2002: ljohnson (Lyle Johnson)
14582 [Ruby] Massive documentation update for the Ruby module,
14583 contributed by Craig Files.
14585 02/14/2002: ljohnson (Lyle Johnson)
14586 [Ruby] Bug fix: An error in the SWIG runtime support for Ruby
14587 was causing several of the examples to fail. Reported by
14590 02/14/2002: ljohnson (Lyle Johnson)
14591 [Ruby] Bug fix: Enumerations defined within a class (such
14592 as those seen in the Examples/ruby/enum example) were not
14593 being exported with the correct names. Reported by William
14596 02/13/2002: ljohnson (Lyle Johnson)
14597 [Ruby] Added a warning message when we run across overloaded
14598 class constructors for C++ code, that this is currently not
14599 supported (even if the overloads have been %renamed). For an
14600 example of where this doesn't work, see Examples/ruby/operator.
14602 02/13/2002: ljohnson (Lyle Johnson)
14603 [Ruby] Added an "ignored" warning message when the parser runs
14604 across an operator!=() declaration for C++ code.
14606 02/11/2002: ljohnson (Lyle Johnson)
14607 [Ruby] Added the "import", "import_template", "operator" and
14608 "template" examples.
14610 02/11/2002: ljohnson (Lyle Johnson)
14611 [Ruby] Added multi-module support.
14613 02/09/2002: ljohnson (Lyle Johnson)
14614 [Ruby] Added the missing "#define SWIG_NOINCLUDE" at the top of
14615 the wrapper code when the '-c' option is used.
14617 02/09/2002: ljohnson (Lyle Johnson)
14618 Corrected a minor off-by-one error for the size of the
14619 swig_types[] array that's generated in the wrapper code.
14621 02/08/2002: beazley
14622 Fixed SF [ #515058 ] Wrong code for C++ templates.
14623 Reported by Israel Taller.
14625 Version 1.3.11 (January 31, 2002)
14626 =================================
14628 01/30/2002: beazley
14629 Fix to pass/return by value for C++ objects that define
14630 no default constructor. Changes to the typemap system
14631 made it impossible to wrap C++ objects with no default
14632 constructor. This has been fixed, but the solution
14633 involves some clever template magic contributed by
14634 William Fulton. Please see the comments in the file
14635 Lib/swig.swg for further details. This solution is
14636 experimental and may be refined in a future release.
14638 01/30/2002: beazley
14639 Global variables and member data of type "const char *"
14640 can be set, but the old value is silently discarded without
14641 any garbage collection. This may generate a memory leak.
14642 This change is needed to more safely handle variables
14645 const char *foo = "Hello World\n";
14647 In this case, it's not safe to free the old value. However,
14648 SWIG can dynamically allocate a new value and make foo point
14649 to it. To fix this memory leak, you can probably do this:
14651 %clear const char *foo;
14652 %apply char * {const char *foo};
14654 *** POTENTIAL INCOMPATIBILITY ***
14656 01/30/2002: beazley
14657 Two minor typemap enhancements have been added. First,
14658 typemaps can issue a warning message by including a special
14659 warning attribute. For example:
14661 %typemap(in,warning="I'm going to do something dangerous") ...
14663 The warning message will show up whenever the typemap is
14666 Second, a typemap can force a no-match by defining
14668 %typemap(in) sometype "pass";
14670 If this is used, the typemap system will *not* record a
14671 typemap match for "sometype". This can be used to block
14672 selected typemaps. For example, if you wanted to disable
14673 a typemap feature for some type, you could do this.
14675 // Do not allow global variables of type 'const char *' to be set.
14676 %typemap(varin) const char * "pass";
14678 It might also be possible to use this to do subtle and
14679 strange things with typemaps. For example, if you wanted to
14680 make 'blah *' an output value and 'const blah *' an input
14681 parameter, you might do this:
14683 %typemap(ignore) blah *(blah temp) {
14686 %typemap(argout) blah * {
14687 ... return a value ...
14689 /* Block unqualified typemaps defined above */
14690 %typemap(ignore) const blah * "pass";
14691 %typemap(argout) const blah * "pass";
14692 %typemap(in) const blah * {
14693 ... get input value ...
14696 (This potential applications of typemaps suggested by Greg Stein).
14697 *** NEW FEATURE ***
14699 01/29/2002: cheetah (william fulton)
14700 [Java] Bug fix: No enumerations were wrapped when the -shadow
14701 commandline option was not specified. Reported by Israel Taller.
14703 01/28/2002: cheetah (william fulton)
14704 [Java] Global arrays are successfully wrapped. In fact they started
14705 mostly working in SWIG-1.3.10.
14707 01/28/2002:richardp
14708 Added first attempt at C++ and -shadow support for PHP4 module,
14709 please test and mail me if any problems/ideas on improving it.
14711 There is a known problem with uninitialized member variables,
14712 please see Examples/php4/sync/README for details.
14714 Also more PHP documentation added to Doc/Manual/Php.html
14717 The ANSI C size_t type is now recognized as an integer by default.
14720 long long and unsigned long long support added to many language modules.
14721 This is not a portable feature and will require compiler support
14722 for the long long type. In target languages that do not support
14723 long long (e.g., Tcl and Perl), numbers are converted to a string
14724 of digits. This prevents their use in arithmetic calculations, but
14725 still allows values to be set from a string.
14727 long long support requires the use of the strtoll() and strtoull()
14728 functions as well as the 'lld' and 'llu' format specifiers
14732 Fixed [ #501827 ] Delete method is not called. The Tcl
14733 module wasn't correctly calling destructors when they
14734 were defined using %addmethods. This has been fixed.
14735 Reported by Reinhard Fobbe.
14737 01/26/2002: beazley
14738 Better support for long long and unsigned long long. Typemaps
14739 have been included in a number of modules for handling these types.
14740 In addition, the parser has been modified to accept long long
14741 literals such as 1234LL and 1234ULL.
14743 01/27/2002: cheetah (william fulton)
14744 [Java] A C char[] is mapped to a Java String which is the default
14745 SWIG handling of char[] and char*. It used to be mapped to byte[].
14746 Note that a C signed char[] array is mapped to byte[].
14748 *** POTENTIAL INCOMPATIBILITY ***
14750 01/25/2002: beazley
14751 Fixed a problem with return-by-value, C++, and
14752 objects that define no default constructor.
14753 Reported by Joel Reed.
14755 01/25/2002: cheetah (william fulton)
14756 [Java] Overhaul of the Java module. The C code generation is now
14757 done from typemaps.
14759 01/24/2002: cheetah (william fulton)
14760 [Java] Support for arrays of enum pointers
14762 01/20/2002: cheetah (william fulton)
14763 [Java] Error checking for null Java objects being passed to native
14764 functions. Exception thrown now whereas before the JVM crashed.
14766 01/18/2002: cheetah (william fulton)
14767 [Java] Corrected behaviour for functions that take arrays. For
14768 example, when this c function:
14770 void arrayfn(int array[]);
14772 is wrapped the corresponding native function
14774 public final static native void arrayfn(int[] array);
14776 is produced. Previously if the C function made any changes to the
14777 array elements, these were not reflected back into the Java array.
14778 This has now been corrected so that the changes are propogated back
14779 to Java and the calling function will see these changes. This is
14780 how pure Java functions work, ie arrays are passed by reference.
14783 [Guile] New file cplusplus.i with C++ typemaps contributed
14784 by Marcio Luis Teixeira <marciot@holly.colostate.edu>.
14786 01/11/2002: cheetah (william fulton)
14787 [Java] Changed mapping of C long to Java type. Was mapped to Java
14788 long, now mapped to Java int. If you want the previous mapping to
14789 Java long use this approach in your interface file:
14792 %typemap(jni) long "jlong"
14793 %typemap(jtype) long "long"
14794 %typemap(jstype) long "long"
14797 %typemap(jni) long[ANY] "jlongArray"
14798 %typemap(jtype) long[ANY] "long[]"
14799 %typemap(jstype) long[ANY] "long[]"
14800 %typemap(in) long[ANY] {write me for array support}
14801 %typemap(out) long[ANY] {write me for array support}
14802 %typemap(argout) long[ANY] {write me for array support}
14803 %typemap(freearg) long[ANY] {write me for array support}
14805 *** POTENTIAL INCOMPATIBILITY ***
14807 This new mapping is more appropriate when interfacing to 32 bit
14808 applications which are used in the current 32-bit JVMs. For future
14809 64-bit JVMs you may have to change these mappings - eg on Unix LP64
14810 systems, but not on Microsoft 64bit Windows which will be using a
14811 P64 IL32 model. This may be automated in a future version of SWIG.
14814 Fixed [ 501677 ] %init block in wrong place. Reported
14817 01/09/2002: cheetah (william fulton)
14818 [Java] Default support for the long long type. signed long long is
14819 mapped to a Java long. unsigned long long is mapped to BigInteger.
14822 Experimental change to parser to better support mixing of
14823 int, long, short, unsigned, float, and double. The parser
14824 should now support types like this:
14831 This change also enables a type of 'long double' (previously
14832 unsupported) to be used.
14833 *** NEW FEATURE ***
14835 01/05/2002: cheetah (william fulton)
14836 [Java] Casting fix for when function return type is a pointer as
14837 reported by Gary Pennington 2002-01-05. The upper 32bits of the
14838 64 bit jlong will have contained junk for 32bit pointers.
14840 01/05/2002: cheetah (william fulton)
14841 [Java] Better pointer handling in Java is possible as the
14842 INPUT, OUTPUT and INOUT typemaps have been added into typemaps.i.
14844 01/05/2002: cheetah (william fulton)
14845 [Java] $null can be used in input typemaps to return early from JNI
14846 functions that have either void or a non-void return type. Example:
14848 %typemap(check) int * %{
14850 SWIG_exception(SWIG_IndexError, "Array element error");
14855 If the typemap gets put into a function with void as return, $null
14856 will expand to nothing:
14860 SWIG_exception(SWIG_IndexError, "Array element error");
14866 otherwise $null expands to zero, where javareturntype is either a
14867 pointer or a primitive type:
14869 javareturntype jni_fn(...) {
14871 SWIG_exception(SWIG_IndexError, "Array element error");
14877 01/02/2002: cheetah (william fulton)
14878 [Java] The Java module incorrectly used argout typemaps for
14879 strings. This is now corrected and the code now resides
14880 in the freearg typemap. The argout array typemaps have been split into
14881 argout and freearg typemaps. This correction may require some user
14882 written typemaps to be modified.
14883 *** POTENTIAL INCOMPATIBILITY ***
14885 12/28/2001: cheetah (william fulton)
14886 [Java] Multi typemaps now working for Java see multimap example.
14887 [Java] Fix for recently introduced bug - freearg typemap code was appearing
14888 before the function call.
14890 12/28/2001: cheetah (william fulton)
14891 [Java] JCALL macro for JNI calls that work in both C and C++ typemaps
14892 have been replaced with JCALL0, JCALL1, JCALL2, JCALL3 and JCALL4
14894 *** POTENTIAL INCOMPATIBILITY ***
14897 Resolved some inconsistent behavior with %rename and class renaming.
14898 If you specify the following:
14908 Then the %rename directive applies to the class itself, the constructor,
14909 and the destructor (all will be renamed to Foo).
14911 If a class defines more than one constructor, the overloaded variants
14912 can still be renamed by specifying parameters to %rename. For example:
14914 %rename(Bar_copy) Bar(Bar &);
14922 There are still some odd corner cases. If you specify
14924 %rename(Foo) ::Bar;
14926 then only the name of the class is changed and the constructor/destructor
14927 names are left unmodified. If you specify
14929 %rename(Foo) *::Bar;
14931 then the names of the constructor/destructor functions are modified but
14932 the name of the class is not.
14934 12/21/2001: cheetah (william fulton)
14935 [Java] jni, jtype and jstype typemaps no longer hardcoded but real
14936 typemaps. New variable substitution, $javaclassname, can be used in
14937 the jstype typemaps. It is replaced with the Java shadow class name
14939 [Java] Fix for recently introduced bug to do with inheritance when
14941 [Java] A few more bug fixes, todo with %rename and using the kind
14943 void fn(union uni myuni, struct str mystr, class cl mycl);
14946 Fixed [ #494524 ] Preprocessor bug - apostrophe and #subst.
14949 Added SWIG_VERSION preprocessor symbol. This is a hexadecimal
14950 integer such as 0x010311 (corresponding to SWIG-1.3.11). This can
14951 be used in the interface as follows:
14953 #if SWIG_VERSION >= 0x010311
14954 /* Use some fancy new feature */
14957 Note: The version symbol is not defined in the generated SWIG
14960 *** NEW FEATURE ***
14963 [MzScheme]: Renamed mzswig_make_boolean to
14964 swig_make_boolean, as the latter is used in the typemaps.
14965 Reported by Luigi Ballabio.
14968 [Guile]: Rewrote list-vector.i using multi-dispatch
14969 typemaps. Updated pointer-in-out.i. Make the
14970 deprecated typemap-substitution of "$source" in "argout"
14974 [Guile]: Fixed macros %values_as_list, %values_as_vector,
14975 %multiple_values to use the proper %pragma syntax. New
14976 Guile example/test "multivalue"; new Guile run-test for
14977 test-suite item "list-vector" (currently broken).
14980 [Guile]: Fixed typemap-substition bug for "varin". Relaxed
14981 valid-identifier check to allow all R5RS identifiers.
14984 Version 1.3.10 (December 10, 2001)
14985 ==================================
14988 Modified %typemap so that %{ ... %} can also be used as a
14989 code block (mostly for completeness). For example:
14991 %typemap(in) blah %{
14995 This form does not introduce a new block scope. Also, the
14996 code enclosed in %{ ... %} is not processed by the preprocessor.
14999 Fixed [ #459614 ] SWIG with multiple TCL interpreters.
15002 Fixed [ #417141 ] rubydec.swg is wrong
15003 Reported by Paul Brannan.
15006 Fixed [ #410557 ] Problem with %addmethods on NT.
15007 Reported by Magnus Ljung.
15010 Fixed [ #445233 ] Enhancement: handle access change.
15011 SWIG now parses (but ignores) C++ access changes for the
15016 void something() { }
15021 class B : private A {
15025 A::something; <---- Parsed, but ignored
15028 Suggested by Krzysztof Kozminski.
15030 12/08/2001: cheetah (william fulton)
15031 Fix for Ruby to work using Visual C++.
15034 Fixed [ #465687 ] unsigned short parameters fail.
15035 Reported by Gerald Williams.
15038 Fixed SF [ #489594 ] PyString_FromString can't take NULL arg.
15039 Reported by John Merritt. SWIG now converts string values
15040 to Python using code like this:
15042 resultobj = result ? PyString_FromString(result) : Py_BuildValue("");
15045 Fixed SF [ #463561 ] Type conversions not generated.
15046 Reported by Gerald Williams.
15049 Fixed SF [ #470217 ] Tcl default argument handling.
15050 Reported by Shaun Lowry.
15053 Fixed SF [ #472088 ] defined(MACRO) expanded everywhere.
15054 Embedded preprocessor directives such as
15058 are not expanded by the SWIG preprocessor.
15059 Reported by Gerald Williams.
15062 Fixed SF [ #476467 ] Problems with #define & commas.
15065 Fixed SF [ #477547 ] wrong declaration of pointer functions.
15066 Bad prototypes in Lib/tcl/ptrlang.i.
15069 Fixed SF [ #483182 ] Constants can take args by mistake.
15070 When swig -perl5 -const is used, constants are declared
15071 with a void prototype. For example:
15073 sub ICONST () { $examplec::ICONST }
15075 Patch submitted by Rich Wales.
15078 New %exception directive. This is intended to replace %except.
15079 It works in exactly the same manner except it does not accept a
15080 language specifier. For example:
15091 %exception is also name aware---allowing it to be applied to
15092 specific declarations in an interface. For example:
15096 exception for any function/method foo
15100 %exception Foo::bar {
15102 exception for method bar in class Foo
15106 %exception Foo::bar(double) {
15108 exception for method bar(double) in class Foo
15112 The semantics of this name matching is exactly the same as for %rename.
15113 *** NEW FEATURE ***
15116 Substantial cleanup of the Python shadow class code. Shadow classes
15117 used to be created in this rather complicated manner involving about
15118 a half-dozen strings created in bits and pieces. Shadow classes
15119 are now generated in a more straightforward manner--in the same
15120 order that appears in the interface file.
15122 *** POTENTIAL INCOMPATIBILITY ***
15123 The order in which declarations appear in the shadow file may differ.
15126 The %insert directive (%{ ... %}, %runtime, %header, %wrapper, etc.)
15127 can now be used inside of a class definition. This has potential
15128 uses when generating shadow class code. For example:
15132 %insert("shadow") %{
15140 The support for class code insertion depends on the language module.
15141 However, the intent of this feature is to simplify the task of extending
15142 shadow class code. In the Python module, this inserts code with the
15143 proper level of indendation (regardless of what was used in the SWIG
15145 *** NEW FEATURE ***
15147 11/29/2001: cheetah (william fulton)
15148 Modifications for Java and Python modules to work on cygwin.
15149 Unfortunately a lot of the python module has started to produces code
15150 which cannot be auto-imported using cygwin libtools so most of it is
15154 The %rename and %feature directive can now be used inside
15155 of a class definition. For example:
15158 %rename(foo_i) foo(int);
15159 %rename(foo_d) foo(double);
15167 When used in this manner, the %rename directive only applies
15168 to members of the class in which it appears as well as all
15169 derived classes. In fact, this is really just the same
15172 %rename(foo_i) Foo::foo(int);
15173 %rename(foo_d) Foo::foo(double);
15178 *** NEW FEATURE ***
15181 Added the experimental %feature directive. %feature can be
15182 used to attach arbitrary string attributes to parse tree nodes.
15185 %feature("except") blah {
15195 %feature("set") *::x_set "x";
15199 %feature("blah") Foo::bar(int,double) const "spam";
15201 The syntax is borrowed from the %rename directive. In fact, the
15202 exact same semantics apply (inheritance, matching, etc.).
15204 %feature is a very powerful low-level primitive that can be used to
15205 customize individual language modules and to provide hints to
15206 any stage of code generation. Features are attached to
15207 parse tree nodes as attributes with names like "feature:*" where *
15208 is replaced by the feature name (e.g., "feature:except", "feature:set",
15209 etc.). Language modules can then look for the features using
15210 a simple attribute lookup.
15212 %feature is intended to be a replacement for a number of
15213 older SWIG directives including %except and specialized
15214 pragmas. It is more powerful (due to its parameterized
15215 name matching) and it provides very precise control over
15216 how customization features are attached to individual
15217 declarations. There are future expansion plans that will
15218 build upon this capability as well.
15220 It's not certain that %feature will ever be used directly
15221 by SWIG users. Instead, it may be a low-level primitive
15222 that is used in high-level macro definitions. For instance,
15223 to support properties, you might define a macro like this:
15225 %define %property(name, setf, getf)
15226 %feature("set") setf #name;
15227 %feature("get") getf #name;
15230 Which allows a user to specify things like this:
15232 %property(p, get_p, set_p);
15240 *** EXPERIMENTAL NEW FEATURE ***
15243 The Tcl module has been expanded with some new features for
15244 managing object ownership. For example:
15246 set c [Circle -args 20]
15247 $c area # Invoke a method
15248 $c -disown # Releases ownership of the object
15249 $c -acquire # Acquires ownership of the object
15251 If Tcl owns the object, its destructor is invoked when the
15252 corresponding object command is deleted in Tcl.
15254 To simplify the destruction of objects, the following syntax
15257 $c -delete # Delete an object
15259 This is an alternative for the more obscure variant of
15263 These features also add functionality at the C API level.
15264 The following functions manage ownership from C and
15265 can be used in typemaps.
15267 SWIG_Acquire(void *ptr);
15268 SWIG_Disown(void *ptr);
15270 A new function for constructing instances is also available:
15273 SWIG_NewInstanceObj(Tcl_Interp *interp, void *ptr,
15274 swig_type_info *type, int own);
15276 When used in a typemap, this creates a pointer object and
15277 an interpreter command that can be used to issue methods and
15278 access attributes as shown above.
15279 *** NEW FEATURE ***
15282 All Python-related %pragma operations have been eliminated.
15283 Most of these were written for older SWIG versions in order to
15284 compensate for limitations in earlier releases. In an effort
15285 to reduce the amount of code-clutter and potential for errors,
15286 it is easier to simply eliminate the pragmas and to start over
15287 (if needed). To be honest, I'm not even sure the pragmas
15288 worked in 1.3.9 and recent releases.
15290 Note: If you need to insert code into the shadow class file
15291 created by SWIG, simply use the %shadow directive like this:
15294 def some_python_code():
15298 *** POTENTIAL INCOMPATIBILITY ***
15301 Sweeping changes to the way in which the Python module handles
15302 shadow classes. In early implementations, shadow classes were
15303 merely Python wrappers around typed pointer objects. However,
15304 some users actually wanted to receive the shadow class object in C.
15305 To accomodate this, the dereferencing of the "this" pointer in
15306 a shadow class was moved to C as described in CHANGES [8/8/99].
15307 However, the process of returning pointers to Python was still
15308 somewhat problematic. Specifically, shadow classes never worked
15309 in situations such as these:
15311 - Use of any kind of output typemap ('out' or 'argout')
15312 - Global variables (broken as far as I can tell).
15314 In the past, some users have dealt with this by manually trying
15315 to create shadow class objects themselves from C/C++. However,
15316 this was difficult because the C wrappers don't really know how
15317 to get access to the corresponding Python class.
15319 The Python module has now been modified to automatically attach
15320 shadow class objects to pointers when they are returned to
15321 Python. This process occurs in the function SWIG_NewPointerObj()
15322 so the process is completely transparent to users. As a result,
15323 shadow classes are now more seamlessly integrated with typemaps
15324 and other features of SWIG.
15326 This change may introduce a number of incompatibilities. The
15327 SWIG_NewPointerObj() now takes an extra parameter "own" to
15328 indicate object ownership. This can be used to return a pointer
15329 to Python that Python should destroy. In addition, older code
15330 that tries to manually construct shadow class objects or which
15331 expects bare pointers may break---such pointers may already be
15332 encapsulated by a shadow class.
15333 *** POTENTIAL INCOMPATIBILITY ***
15336 Modified the %insert directive to accept single braces { ... }.
15339 %insert("header") {
15343 This works exactly like %{ ... %} except that the code in the
15344 braces is processed using the preprocessor. This can be useful
15345 in certain contexts such as low-level code generation in
15347 *** NEW FEATURE ***
15350 Command line options are now translated into preprocessor
15351 symbols. For example:
15353 ./swig -python -shadow -module blah interface.i
15355 Creates the symbols:
15359 SWIGOPT_MODULE blah
15361 Modules can look for these symbols to alter their code generation
15363 *** NEW FEATURE ***
15366 Massive overhaul of the Perl5 module. A lot of code generation is
15367 now driven by tables and typemaps. The generated wrapper code
15368 also makes use of tables to install constants, variables, and
15369 functions instead of inlining a bunch of procedure calls. The
15370 separate variable initialization function is gone. Most
15371 code generation is controlled via the perl5.swg file in the
15373 *** POTENTIAL INCOMPATIBILITY ***
15376 Added parsing support for the C++ typename keyword. Primarily this
15377 is added to better support templates. For example:
15379 template<typename T> void blah(C& v) {
15380 typename C::iterator i = v.begin();
15383 Note: typename is supported in the parser in the same way as 'struct'
15384 or 'class'. You probably shouldn't use it anywhere except in templates.
15385 *** NEW FEATURE ***
15388 Massive overhaul of the language module API. Most functions now
15389 use a common, very simple, API. There are also a number of
15390 interesting semantic side-effects of how code is actually generated.
15391 Details will be forthcoming in Doc/Manual/Extending.html.
15393 *** POTENTIAL INCOMPATIBILITY *** Language modules written for
15394 previous versions of SWIG will no longer work,
15397 Fixed a very subtle bug due to unnamed class wrapping. For example, if
15402 } gdPoint, *gdPointPtr;
15404 void foo(gdPointPtr x);
15406 Then the foo function would get a type-error. The problem has
15407 to do with internal typedef handling and the fact that the typedef
15408 declarations after the struct appear later in the parse tree.
15409 It should work now. Problem reported by Vin Jovanovic.
15412 Subtle change to "out" typemaps (and related variations). The name
15413 that is attached to the typemap is now the raw C identifier that
15414 appears on a declaration. This changes the behavior of
15415 member functions. For example:
15417 %typemap(out) int foo {
15423 int foo(); // typemap gets applied
15426 Previous versions never really specified how this was supposed to
15427 work. In SWIG1.1, you could probably write a typemap for the
15428 wrapper name like this:
15430 %typemap(out) int Blah_foo { ... }
15432 However, this old behavior is now withdrawn and not supported.
15433 Just use the member name without any sort of special prefix.
15434 *** POTENTIAL INCOMPATIBILITY ***
15437 Changes to Tcl module initialization:
15439 (1) SWIG now automatically includes the code needed to work with
15440 Tcl stubs. Simply compile with -DUSE_TCL_STUBS.
15442 (2) SWIG now automatically calls Tcl_PkgProvide to register
15443 a package name. The package name is the same as the name
15444 specified with the %module directive. The version number is
15445 set to "0.0" by default. To change the version number, use
15446 swig -pkgversion 1.2 interface.i.
15448 *** POTENTIAL INCOMPATIBILITY ***
15449 Modules that provided stubs and Tcl_PkgProvide on their own might
15450 break. Simply remove that code.
15453 Changed code generation of constants in the Tcl module. Constants
15454 are now stored in a large table that get installed at module startup.
15455 There are also no longer any static variables so it should generate
15456 somewhat less code.
15459 The "const" typemap has been renamed to "constant" in many language
15460 modules. "const" is a C keyword which made the handling of the typemap
15461 directive somewhat awkward in the parser.
15462 *** POTENTIAL INCOMPATIBILITY ***
15465 %typemap directive can now accept nearly arbitrary keyword parameters.
15468 %typemap(in,parse="i",doc="integer") int "...";
15470 The purpose of the keyword parameters is to supply code generation
15471 hints to the target language module. The intepretation of the
15472 parameters is language specific.
15473 *** NEW FEATURE ***
15476 Slight semantic change to internal call/return by value handling.
15477 In previous versions of SWIG, call-by-value was translated
15478 into pointers. For example:
15480 double dot_product(Vector a, Vector b);
15484 double wrap_dot_product(Vector *a, Vector *b) {
15485 return dot_product(*a,*b);
15488 This translation was normally performed by the SWIG core, outside
15489 of the control of language modules. However, a side effect
15490 of this was a lot of bizarre typemap behavior. For example,
15491 if you did something like this:
15493 %typemap(in) int32 {
15497 You would find that int32 was transformed into a pointer everywhere!
15498 (needless to say, such behavior is unexpected and quite awkward to
15499 deal with). To make matters worse, if a typedef was also used,
15500 the pointer behavior suddenly disappeared.
15502 To fix this, the pointer transformation is now pushed to the
15503 language modules. This produces wrappers that look roughly
15506 double wrap_dot_product(Vector *a, Vector *b) {
15509 return dot_product(arg1,arg2);
15512 This change also makes it easy to define typemaps for
15513 arbitrary undefined types. For example, you can do this (and it
15514 will work regardless what int32 is):
15516 %typemap(in) int32 {
15517 $1 = (int32) PyInt_AsLong($input);
15520 *** POTENTIAL IMCOMPATIBILITY ***
15521 This change may break call/return by value code generation in
15522 some language modules.
15525 Changed the name of the default typemaps to the following:
15527 %typemap() SWIGTYPE {
15530 %typemap() SWIGTYPE * {
15533 %typemap() SWIGTYPE & {
15534 ... a reference ...
15536 %typemap() SWIGTYPE [] {
15539 %typemap() enum SWIGTYPE {
15540 ... an enum value ...
15542 %typemap() SWIGTYPE (CLASS::*) {
15543 ... pointer to member ...
15547 These types are used as the default for all types that don't match
15548 anything else. See CHANGES log entry for 8/27/2000 for the
15549 old behavior. The role of these types is also described in
15550 Doc/Manual/Typemaps.html
15552 *** POTENTIAL INCOMPATIBILITY ***
15555 Modified Guile and Mzscheme modules to support
15556 multi-argument typemaps.
15558 10/25/2001: cheetah (william fulton)
15559 [Java] Fix to handle pointers to arrays.
15562 Defining a typemap rule for enum SWIGENUM can now be used
15563 to define default behavior for enum variables.
15566 Ruby module modified to support multi-argument typemaps.
15569 The Ruby module can now handle functions with an arbitrary
15570 number of arguments. Previous versions were limited to
15571 to functions with only 9 or 16 arguments depending on
15572 the use of default arguments. Note: from some inspection
15573 of the Ruby interpreter source, the new approach might be
15574 a little faster as well.
15577 Fixed a bug with forward class declarations and
15582 Bug reported by Irina Kotlova.
15585 Support for multivalued typemaps added. The typemaps
15586 are specified using the syntax below. Within each
15587 typemap, variable substitution is handled as follows:
15589 %typemap(in) (int argc, char *argv[]) {
15590 $arg; // The input object in the target language
15591 $1; // C local variable for first argument
15592 $2; // C local variable for second argument
15594 // These variables refer to either argument
15595 $1_type, $1_ltype, $1_basetype, etc... (argc)
15596 $2_type, $2_ltype, $2_basetype, etc... (argv[])
15598 // Array dimension of argv
15602 Basically any variable that was available in normal typemaps
15603 is available for either argument by prefacing the variable
15604 name by '$n_' where n is the argument position.
15607 (1) Multi-valued typemaps can only be applied to a single
15608 object in the target scripting language. For example,
15609 you can split a string into a (char *, int) pair or
15610 split a list into a (int, char []) pair. It is not
15611 possible to map multiple objects to multiple arguments.
15613 (2) To maintain compatibility with older SWIG versions, the
15614 variables such as $target and $type are preserved and
15615 are mapped onto the first argument only.
15617 (3) This should not affect compatibility with older code.
15618 Multi-valued typemaps are an extension to typemap handling.
15619 Single valued typemaps can be specified in the usual
15622 The old $source and $target variables are officially
15623 deprecated. Input variables are referenced through
15624 $arg$ and output values are reference through $result$.
15626 *** NEW FEATURE ***
15629 Added parsing support for multivalued typemaps. The syntax
15630 is a little funky, but here goes:
15632 // Define a multivalued typemap
15633 %typemap(in) (int argc, char *argv[]) {
15634 ... typemap code ...
15637 // Multivalued typemap with locals
15638 %typemap(in) (int argc, char *argv[])(int temp) {
15639 ... typemap code ...
15642 // Copy a multivalued typemap
15643 %typemap(in) (int argcount, char **argv) = (int argc, char *argv[]);
15645 // Apply a multivalued typemap
15646 %apply (int argc, char *argv[]) { (int argcount, char **argv) };
15648 Note: this extra parsing support is added for future extension.
15649 No language modules currently support multi-valued typemaps.
15652 Modified the typemap matching code to discard qualifiers when
15653 checking for a match. For example, if you have a declaration
15656 void blah(const char *x);
15658 The typemap checker checks for a match in the following order:
15665 If typedef's are involved, qualifier stripping occurs before
15666 typedef resolution. So if you had this,
15668 typedef char *string;
15669 void blah(const string x);
15671 typemap checking would be as follows:
15682 The primary reason for this change is to simplify the implementation
15683 of language modules. Without qualifier stripping, one has to write
15684 seperate typemaps for all variations of const and volatile (which
15687 *** POTENTIAL INCOMPATIBILITY *** Typemaps might be applied in
15688 places where they weren't before.
15692 SWIG now generates wrappers that properly disambiguate
15693 overloaded methods that only vary in constness. For
15703 To handle this, the %rename directive can be used normally.
15705 %rename(blah_const) blah() const;
15707 In the resulting wrapper code, method calls like this
15710 (obj)->blah() // Non-const version
15711 ((Foo const *)obj)->blah() // const version
15713 This should force the right method to be invoked.
15714 Admittedly, this is probably obscure, but we might
15715 as well get it right.
15718 The preprocessor now ignores '\r' in the input.
15719 This should fix the following bug:
15720 [ #468416 ] SWIG thinks macro defs are declarations?
15723 Added support for ||, &&, and ! in constants. This
15724 fixes SF [ #468988 ] Logical ops break preprocessor.
15725 However, at this time, constants using these operators
15726 are not supported (the parser will issue a warning).
15729 Added -show_templates command line option. This makes
15730 SWIG display the code it actually parses to generate
15731 template wrappers. Mostly useful for debugging.
15732 *** NEW FEATURE ***
15735 Change to semantics of %template directive. When
15736 using %template, the template arguments are handled
15737 as types by default. For example:
15739 %template(vecint) vector<int>;
15740 %template(vecdouble) vector<double>;
15742 To specify a template argument that is *not* a type, you
15743 need to use default-value syntax. For example:
15745 %template(vecint) vector<int,int=50>;
15746 %template(vecdouble) vector<int,size=100>;
15748 In this case, the type name doesn't really matter--only
15749 the default value (e.g., 50, 100) is used during
15750 expansion. This differs from normal C++, but I couldn't
15751 figure out a better way to do it in the parser. Might
15752 implement an alternative later.
15753 *** POTENTIAL INCOMPATIBILITY ***
15756 Major changes to template handling in order to provide
15757 better integration with the C++ type-system. The main
15758 problem is as follows:
15760 Suppose you have a template like this:
15762 template<class T> void blah(const T x) { stuff };
15764 Now suppose, that you instantiate the template on a
15765 type like this in SWIG:
15767 %template(blahint) blah<int *>;
15769 In C++, this is *supposed* to generate code like this:
15771 void blah(int *const x) { stuff };
15773 However, in SWIG-1.3.9, the template substitution gets it wrong
15776 void blah(const int *x) { stuff };
15778 (notice the bad placement of the 'const' qualifier).
15780 To fix this, the SWIG parser now generates implicit typedefs
15781 for template type arguments that produces code roughly
15782 equivalent to doing this:
15784 typedef int *__swigtmpl1;
15785 %template(blahint) blah<__swigtmpl1>;
15787 which generates code like this:
15789 void blah(const __swigtmpl1 x) { stuff };
15791 Since this is correct in both C++ and SWIG, it provides the right
15792 semantics and allows everything to compile properly. However,
15793 to clean up the generated code a little bit, the parser keeps
15794 track of the template types and performs back-substitution to
15795 the original type when building the parse tree. Thus, even
15796 though the implicit typedef is used in the input and may appear
15797 in the generated wrapper file (for proper compilation), the parse
15798 tree will hide a lot of these details. For example:
15800 void blah(const __swigtmpl1 x) { stuff };
15802 will look like it was declared as follows (which is what
15805 void blah(int *const x) { stuff }
15807 The only place you are likely to notice the typedef hack
15808 is in bodies of template functions. For example, if you
15811 template<class T> class blah {
15821 you will find that 'T tempvalue' got expanded into some
15822 strange typedef type. This *still* compiles correctly
15823 so it's not a big deal (other than looking kind of ugly
15824 in the wrapper file).
15827 Fixed some inheritance problems in Tcl Object interface.
15830 Tcl module has changed to use byte-backed pointer strings. This
15831 implementation should be safe on 64-bit platforms. However,
15832 the order in which digits appear in pointer values no longer
15833 directly corresponds to the actual numerical value of a
15834 pointer (on little-endian machines, pairs of digits appear
15838 Perl5 module is now driven by a configuration file 'perl5.swg'
15839 in the SWIG library.
15842 The perl5 module no longer tries to apply the "out" typemap
15843 in code generated for magic variables. I'm surprised that
15844 this ever worked at all (since all of the code that was there
15845 was wrong anyways). Use the "varout" typemap to handle
15849 Fixed a bug related to character array members of structures.
15856 SWIG is normally supposed to return a string, but this was
15857 broken in 1.3.9. The reason it was broken was actually
15858 due to a subtle new feature of typemaps. When a data member
15859 is set to an array like this, the return type of the related
15860 accessor function is actually set to an array. This means
15861 that you can now write typemaps like this:
15863 %typemap(python,out) char [ANY] {
15864 $target = PyString_FromStringAndSize($source,$dim0);
15867 This functionality can be used to replace the defunct
15868 memberout typemap in a more elegant manner.
15871 Some further refinement of qualified C++ member functions.
15880 (i) The SWIG parser was extended slightly to allow 'volatile'
15881 and combinations of 'const' and 'volatile' to be used. This
15882 is probably rare, but technically legal. Only added for
15885 (ii) For the purposes of overloading, qualified and non-qualified
15886 functions are different. Thus, when a class has methods like this:
15891 Two distinct methods are declared. To deal with this, %rename
15892 and similar directives have been extended to recognize const.
15893 Thus, one can disambiguate the two functions like this:
15895 %rename(fooconst) Foo::foo() const;
15897 or simply ignore the const variant like this:
15899 %ignore Foo::foo() const;
15901 Note: SWIG currently has no way to actually invoke the const
15902 member since the 'const' is discarded when generating wrappers
15906 New directive. %namewarn can be used to issue warning
15907 messages for certain declaration names. The name
15908 matching is the same as for the %rename directive.
15909 The intent of this directive is to issue warnings for
15910 possible namespace conflicts. For example:
15912 %namewarn("print is a python keyword") print;
15914 The name matching algorithm is performed after a name
15915 has been resolved using %rename. Therefore, a
15916 declaration like this will not generate a warning:
15918 %rename("Print") print;
15920 void print(); /* No warning generated */
15922 Since the warning mechanism follows %rename semantics, it is
15923 also to issue warnings for specific classes or just for
15924 certain member function names.
15926 (Dave - I've been thinking about adding something like this
15927 for quite some time. Just never got around to it)
15928 *** NEW FEATURE ***
15932 Enhanced the %ignore directive so that warning messages
15933 can be issued to users. This is done using %ignorewarn
15936 %ignorewarn("operator new ignored") operator new;
15938 The names and semantics of %ignorewarn is exactly the
15939 same as %ignore. The primary purpose of this directive
15940 is for module writers who want to ignore certain types
15941 of declarations, but who also want to alert users about it.
15942 A user might also use this for debugging (since messages
15943 will appear whenever an ignored declaration appears).
15944 *** NEW FEATURE ***
15947 Super-experimental support for overloaded operators.
15948 This implementation consists of a few different parts.
15950 (i) Operator names such as 'operator+' are now allowed
15951 as valid declarator names. Thus the 'operator' syntax
15952 can appear *anyplace* a normal declarator name was used
15953 before. On the surface, this means that operators can
15954 be parsed just like normal functions and methods.
15955 However, it also means that operator names can be used
15956 in many other SWIG directives like %rename. For example:
15958 %rename(__add__) Complex::operator+(const Complex &);
15960 (ii) Operators are wrapped *exactly* like normal functions
15961 and methods. Internally, the operator name is used
15962 directly meaning that the wrapper code might contain
15963 statements like this:
15965 arg0->operator*((Complex const &)*arg1);
15967 This all seems to parse and compile correctly (at least
15970 (iii) SWIG will no longer wrap a declaration if its symbol
15971 table name contains illegal identifier characters. If
15972 illegal characters are detected, you will see an error
15975 Warning. Can't wrap operator* unless renamed to a valid identifier.
15977 The only way to fix this is to use %rename or %name to bind
15978 the operator to a nice name like "add" or something. Note:
15979 the legal identifier characters are determined by the target
15982 There are certain issues with friend functions and operators.
15983 Sometimes, friends are used to define mixed operators such
15984 as adding a Complex and a double together. Currently, SWIG
15985 ignores all friend declarations in a class. A global operator
15986 declaration can probably be made to work, but you'll have to
15987 rename it and it probably won't work very cleanly in the
15988 target language since it's not a class member.
15990 SWIG doesn't know how to handle operator specifications
15991 sometimes used for automatic type conversion. For example:
15995 operator const char*();
15999 (this doesn't parse correctly and generates a syntax error).
16001 Also: operators no longer show up as separate parse-tree
16002 nodes (instead they are normal 'cdecl' nodes). I may
16003 separate them as a special case later.
16005 See Examples/python/operator for an example.
16007 *** SUPER-EXPERIMENTAL NEW FEATURE ***
16009 Version 1.3.9 (September 25, 2001)
16010 ==================================
16013 Fixed parsing problem with type declarations like
16014 'char ** const'. SWIG parsed this correctly, but the
16015 internal type was represented incorrectly (the pointers
16016 and qualifiers were in the wrong order).
16019 Withdrew experimental feature (noted below) that was
16020 causing serious parsing problems.
16022 Version 1.3.8 (September 23, 2001)
16023 ==================================
16026 Included improved distutils setup.py file in the Tools
16027 directory (look for the setup.py.tmpl file). Contributed by
16031 Included two new RPM spec files in the Tools directory. Contributed
16032 by Tony Seward and Uwe Steinmann.
16035 Fixed SF Bug [ #463635 ] Perl5.swg does not compile in Visual C++
16038 Two new directives control the creation of default
16039 constructors and destructors:
16044 These replace %pragma nodefault and %pragma makedefault.
16045 (old code will still work, but documentation will only
16046 describe the new directives).
16049 Fixed SF Bug [ #462354 ] %import broken in 1.3.7.
16053 Parser modified to ignore out-of-class constructor
16054 and destructor declarations. For example:
16056 inline Foo::Foo() :
16061 inline Foo::~Foo() {
16064 Suggested by Jason Stewart.
16065 *** EXPERIMENTAL FEATURE ***
16068 Modified the parser to ignore forward template class
16069 declarations. For example:
16071 template <class V, long S> class MapIter;
16073 Suggested by an email example from Irina Kotlova.
16076 Fixed problem with undeclared tcl_result variable in
16077 the "out" typemap for Tcl. Reported by Shaun Lowry.
16080 Incorporated changes to make SWIG work with ActivePerl.
16081 Contributed by Joel Reed.
16084 Slight change to the parsing of C++ constructor initializers.
16087 class Foo : public Bar {
16089 Foo() : Bar(...) {...}
16092 SWIG now discards the contents of the (...) regardless of
16093 what might enclosed (even if syntactically wrong). SWIG
16094 doesn't need this information and there is no reason to
16095 needless add syntax rules to handle all of the possibilities
16099 Change to typemaps for structure members. If you have a
16100 structure like this:
16106 The member name 'bar' is now used in any accessor functions.
16107 This allows the "in" typemap to be used when setting the value.
16108 For example, this typemap
16110 %typemap(python,in) int *bar {
16114 now matches Vector::bar. It should be noted that this will also
16115 match any function with an argument of "int *bar" (so you should
16117 *** NEW FEATURE. POTENTIAL INCOMPATIBILITY ***
16120 Fixed SF bug #462642 setting string values in structures
16123 Fixed SF bug #462398 problem with nested templates.
16126 Fixed SF bug #461626 problem with formatting and C++ comments.
16129 Fixed SF bug #462845 Wrong ownership of returned objects.
16132 Fixed SF bug #459367. Default constructors for classes
16133 with pure virtual methods.
16136 Fixed problem with default arguments and class scope. For
16141 enum bar { FOO, BAR };
16142 void blah(bar b = FOO);
16146 SWIG now correctly generates a default value of "Foo::FOO" for
16147 the blah() method above. This used to work in 1.1, but was
16148 broken in 1.3.7. Bug reported by Mike Romberg.
16150 Version 1.3.7 (September 3, 2001)
16151 ==================================
16154 Added special %ignore directive to ignore declarations. This
16155 feature works exactly like %rename. For example:
16157 %ignore foo; // Ignore all declarations foo
16158 %ignore ::foo; // Only ignore foo in global scope
16159 %ignore Spam::foo; // Only ignore in class Spam
16160 %ignore *::foo; // Ignore in all classes
16162 %ignore can also be parameterized. For example:
16165 %ignore ::foo(int);
16166 %ignore Spam::foo(int);
16167 %ignore *::foo(int);
16169 *** NEW FEATURE ***
16172 9/02/2001: cheetah (william fulton)
16173 [Java] shadowcode pragma modified so that the code that is output
16174 in the shadow file is placed relative to where it is placed in the
16175 c/c++ code. This allows support for JavaDoc function comments.
16178 Fixed SF Patch [ #447791 ] Fix for python -interface option.
16179 Submitted by Tarn Weisner Burton.
16182 SWIG no longer generates default constructors/destructors
16183 for a class if it only defines a private/protected constructor
16184 or destructor or if any one of its base classes only has
16185 private constructors/destructors. This was reported in
16186 SF Patch [ #444281 ] nonpublic/default/inhereted ctor/dtor
16190 Added patch to Perl5 module that allows constants to be
16191 wrapped as constants that don't require the leading $.
16192 This feature is enabled using the -const option.
16193 Patch contributed by Rich Wales.
16194 *** NEW FEATURE ***
16197 Added parsing support for the 'volatile' type qualifier.
16198 volatile doesn't mean anything to SWIG, but it is
16199 needed to properly generate prototypes for declarations
16200 that use it. It's also been added to make the SWIG type
16201 system more complete.
16202 *** NEW FEATURE ***
16205 Added support for parameterized %rename directive. *** This
16206 new feature can be used to greatly simplify the task of
16207 resolving overloaded methods and functions. ***
16209 In prior versions of SWIG, the %rename directive was
16210 used to consistently apply an identifier renaming. For
16211 example, if you said this:
16215 Every occurrence of 'foo' would be renamed to 'bar'.
16216 Although this works fine for resolving a conflict with a
16217 target language reserved word, it is useless for
16218 for dealing with overloaded methods. This is because
16219 all methods are simply renamed to the same thing
16220 (generating the same conflict as before).
16222 Therefore, the only way to deal with overloaded methods
16223 was to go through and individually rename them all using
16224 %name. For example:
16228 virtual void bar(void);
16229 %name(bar_i) virtual void bar(int);
16233 To make matters worse, you had to do this for all
16234 derived classes too.
16236 class Spam : public Foo {
16238 virtual void bar(void);
16239 %name(bar_i) virtual void bar(int);
16243 Needless to say, this makes it extremely hard to resolve
16244 overloading without a lot of work and makes it almost
16245 impossible to use SWIG on raw C++ .h files.
16247 To fix this, %rename now accepts parameter declarators.
16248 The syntax has also been changed slightly. For example,
16249 the following declaration renames all occurrences of 'bar(int)'
16250 to 'bar_i', leaving any other occurrence of 'bar' alone.
16252 %rename(bar_i) bar(int);
16254 Using this feature, you can now selectively rename
16255 certain declarations in advance. For example:
16257 %rename(bar_i) bar(int);
16258 %rename(bar_d) bar(double);
16260 // Include raw C++ header
16261 %include "header.h"
16263 When %rename is used in this manner, all occurrence of bar(int)
16264 are renamed wherever they might occur. More control is obtained
16265 through explicit qualification. For example,
16267 %rename(bar_i) ::bar(int);
16269 only applies the renaming if bar(int) is defined in the global scope.
16272 %rename(bar_i) Foo::bar(int);
16274 applies the renaming if bar(int) is defined in a class Foo.
16275 This latter form also supports inheritance. Therefore, if you
16276 had a class like this:
16278 class Spam : public Foo {
16283 The Spam::bar(int) method would also be renamed (since Spam
16284 is a subclass of Foo). This latter feature makes it easy
16285 for SWIG to apply a consistent renaming across an entire
16286 class hierarchy simply by specifying renaming rules for
16289 A class wildcard of * can be used if you want to renaming
16290 all matching members of all classes. For example:
16292 %rename(bar_i) *::bar(int);
16294 will rename all members bar(int) that are defined in classes.
16295 It will not renamed definitions of bar(int) in the global
16298 The old use of %rename is still supported, but is somewhat
16301 %rename(foo) bar; // Renames all occurrences of 'bar'.
16302 %rename(foo) ::bar; // Rename all 'bar' in global scope only.
16303 %rename(foo) *::bar; // Rename all 'bar' in classes only.
16304 %rename(foo) Foo::bar; // Rename all 'bar' defined in class Foo.
16306 *** NEW FEATURE ***
16309 Added support for data-member to member-function
16310 transformation. For example, suppose you had a
16311 structure like this:
16317 Now suppose that you wanted to access x and y
16318 through a member function interface instead
16319 of the usual SWIG behavior. For example:
16321 f.set_x(3.4) # instead of f.x = 3.4
16322 x = f.get_x() # instead of x = f.x
16324 To do this, simply use the new %attributefunc
16325 directive. For example:
16327 %attributefunc(get_%s,set_%s)
16333 The arguments to %attributefunc are C-style printf
16334 format strings that determine the naming convention
16335 to use. %s is replaced with the actual name of the
16336 data member. SWIG provides a number of printf
16337 extensions that might help. For example, if you
16338 wanted to title case all of the attributes, you
16341 %attributefunc(get%(title)s,set%(title)s);
16343 This will turn an attribute 'bar' to 'getBar()' and 'setBar()'.
16345 (someone requested this long ago, but I finally figured
16346 how to implement it in a straightforward manner).
16347 *** EXPERIMENTAL NEW FEATURE ***
16350 SWIG now automatically generates default constructors
16351 and destructors if none are defined. This used to be
16352 enabled with a command line switch -make_default, but
16353 most people want these functions anyways. To turn
16354 off this behavior use the -no_default option or include
16355 the following pragma in the interface file:
16357 %pragma no_default;
16359 This may break certain interfaces that defined their
16360 own constructors/destructors using the same naming
16361 convention as SWIG. If so, you will get duplicate
16362 symbols when compiling the SWIG wrapper file.
16363 *** POTENTIAL INCOMPATIBILITY ***
16366 Changes to Perl5 shadow class code generation. Iterators
16367 are no longer supported (FIRSTKEY, NEXTKEY). Also, attribute
16368 access has been changed to rely on inheritance in order
16369 to provide better behavior across modules.
16372 Various obscure improvements to the type system and classes.
16373 Strange declarations like this are now wrapped correctly
16374 (i.e., the generated wrapper code doesn't cause the C++
16375 compiler to die with a type error).
16379 typedef double Real;
16380 Real foo(Real (*op)(Real,Real), Real x, Real y);
16383 Inheritance of types is also handled correctly.
16386 Changes to class wrappers. When SWIG sees two classes like this,
16394 class Y : public X {
16400 it now only generates two wrapper functions:
16402 X_foo(X *x) { x->foo(); }
16403 Y_bar(Y *y) { y->bar(); }
16405 Unlike SWIG1.15, the foo() method does *not* propagate to a wrapper
16406 function Y_foo(). Instead, the base class method X_foo() must be
16409 This change should not affect modules that use shadow classes, but
16410 it might break modules that directly use the low-level C wrappers.
16411 This change is being made for a number of reasons:
16413 - It greatly simplifies the implementation of SWIG--especially
16414 with anticipated future changes such as overloaded methods.
16416 - It results in substantially less wrapper code--especially
16417 for big C++ class hierarchies (inherited declarations
16418 are no longer copied into every single derived class).
16420 - It allows for better code generation across multiple
16421 SWIG generated modules (code isn't replicated in
16422 every single module).
16424 *** POTENTIAL INCOMPATIBILITY ***
16426 8/22/2001: cheetah (william fulton)
16427 Provided some Windows documentation in the Win directory and some
16428 Visual C++ project files for running examples on Windows.
16431 [Guile] Handle renamed overloaded functions properly;
16432 thanks to Marc Zonzon <Marc.Zonzon@univ-rennes1.fr> for the
16433 patch. See the new test case name_cxx.
16436 [Tcl] Removed lots of warnings issued by the Sun Forte
16437 compilers, which were caused by mixing function pointers
16438 of different linkages (C++/C).
16441 Improved the MzScheme module by porting Guile's pointer
16442 type checking system and making type dispatch
16446 Entirely new symbol table processing. SWIG should be able to
16447 report much better error messages for multiple declarations.
16448 Also, the new symbol table allows for overloaded functions
16449 (although overloading isn't quite supported in the language
16452 8/22/2001: cheetah (william fulton)
16453 * [Java] %new support added.
16454 * [Java] Package JNI name refixed!
16457 Python module modified to support pointers to C++ members. This
16458 is an experimental feature.
16459 *** NEW FEATURE ***
16462 Added limited parsing and full type-system support for pointers to
16463 members. None of SWIG's language modules really know how to deal with
16464 this so this is really only provided for completeness and future
16465 expansion. Note: SWIG does not support pointers to members which
16466 are themselves pointers to members, references to pointers to members,
16467 or other complicated declarations like this.
16468 *** NEW FEATURE ***
16471 SWIG is much better at parsing certain C++ declarations. Operators and
16472 friends generally don't cause anymore syntax errors. However, neither
16473 are really supported.
16476 Added *highly* experimental support for wrapping of C++
16477 template declarations. Since C++ templates are essentially
16478 glorified macros and SWIG has a fully operational C
16479 preprocessor with macro support, the parser now converts
16480 template declarations to macros. For example, a function
16483 template<class T> T max(T a, T b);
16485 is internally converted into a macro like this:
16487 %define %_template_max(__name,T)
16488 %name(__name) T max(T a, T b);
16491 To instantiate a version of the template, a special %template declaration
16494 %template(maxint) max<int>;
16495 %template(maxdouble) max<double>;
16497 The parameter to the %template directive must be proper C identifier that's
16498 used to uniquely name the resulting instantiation. When used, the
16499 the expanded macro looks like this:
16501 %name(maxint) int max(int a, int b);
16502 %name(maxdouble) double max(double a, double b);
16504 A similar technique is used for template classes. For instance:
16506 template<class T> class vector {
16510 vector(int nitems);
16515 Gets converted into a macro like this:
16517 %define %_template_vector(__name, T)
16519 typedef vector<T> __name;
16525 __name(int nitems);
16529 typedef __name vector<T>;
16532 An a specific instantiation is created in exactly the same way:
16534 %template(intvec) vector<int>;
16536 The resulting code parsed by SWIG is then:
16539 typedef vector<int> intvec;
16545 intvec(int nitems);
16549 typedef intvec vector<int>;
16551 Note: the last typedef is non-standard C and is used by SWIG to provide
16552 an association between the name "intvec" and the template type
16555 CAUTION: This is an experimental feature and the first time SWIG has
16556 supported C++ templates. Error reporting is essential non-existent.
16557 It will probably break in certain cases.
16558 *** EXPERIMENTAL NEW FEATURE ****
16561 Change to wrapping of multi-dimensional arrays. Arrays
16562 are now properly mapped to a pointer to an array of
16563 one less dimension. For example:
16565 int [10]; --> int *
16566 int [10][20]; --> int (*)[20];
16567 int [10][20][30]; --> int (*)[20][30];
16569 This change may break certain SWIG extensions because
16570 older versions simply mapped all arrays into a single
16571 pointer such as "int *". Although possibly unusual,
16572 the new version is correct in terms of the C type system.
16573 *** POTENTIAL INCOMPATIBILITY ***
16575 8/06/2001: cheetah (william fulton)
16576 * [Java] Array setters generated for struct/class array members.
16579 Many improvements to Tcl/Perl/Python modules to better
16580 work with multiple interface files and the %import directive.
16583 Fixed up the behavior of %import in the Python module.
16584 SWIG no longer pollutes the module namespace by using
16585 'from module import *' to refer to the other module.
16586 Instead, it does a proper 'import module'. Also, SWIG
16587 may work a lot better when importing modules that include
16588 references to other imported modules.
16591 Added new typemap substitutions, generalizing those of the
16592 Guile-specific 5/27/2001 changes:
16593 * $descriptor is the same as SWIGTYPE$mangle, but also
16594 ensures that the type descriptor of this name gets
16596 * $*type, $*ltype, $*mangle, $*descriptor are the same as
16597 the variants without star, but they REMOVE one level of
16598 pointers from the type. (This is only valid for pointer
16600 * $&type, $<ype, $&mangle, $&descriptor are the same as
16601 the variants without ampersand, but they ADD one level of
16602 pointers to the type.
16603 The Guile-specific substitution $basedescriptor was removed
16604 because it was useless.
16607 The %extern directive is now deprecated and withdrawn. The
16608 purpose of this directive was to import selected definitions
16609 from other interface files and headers. However, the same
16610 functionality is better handled through %import. This
16611 leaves SWIG with two file inclusion directives:
16613 %include filename - Inserts into current interface
16614 %import filename - Import types and classes from
16617 *** POTENTIAL INCOMPATIBILITY ***
16620 Added new support for wrapping C/C++ callback functions.
16621 A common problem with some C libraries is that many
16622 functions take a function pointer as an argument. For example:
16624 int do_op(..., int (*op)(int,int), ...);
16626 Unfortunately, the only way to call such a function is to
16627 pass it a function pointer of some compatible type. In
16628 previous versions of SWIG, you had to solve this problem
16629 with some really gross hacks. For example, if you wanted to
16630 use the following function as a callback,
16634 you had to install a pointer to it as a constant. For example:
16636 %constant int (*FOO)(int,int) = foo;
16640 const int (*FOO)(int,int) = foo;
16642 or if you had a really old SWIG version:
16644 typedef int (*OP_FUNC)(int,int);
16645 int do_op(..., OP_FUNC, ...);
16646 const OP_FUNC FOO = foo;
16649 Now, you can do one of two things:
16651 %constant int foo(int,int);
16653 This creates a constant 'foo' of type int (*)(int,int).
16654 Alternatively, you can do this:
16661 In this case, the functions are installed as constants where
16662 the name is defined by the format string given to %callback().
16663 If the names generated by the format string differ from the
16664 actual function name, both a function wrapper and a callback
16665 constant are created. For example:
16667 %callback("%(upper)s");
16672 Creates two wrapper functions 'foo', 'bar' and additionally
16673 creates two callback constants 'FOO', 'BAR'.
16675 Note: SWIG still does not provide automatic support for
16676 writing callback functions in the target language.
16677 *** NEW FEATURE ***
16679 8/06/2001: cheetah (william fulton)
16680 * struct nesting fixes as per SF bug #447488.
16683 The %name directive now applies to constants created with
16684 #define and %constant. However, most language modules
16685 were never written to support this and will have to be
16686 modified to make it work. Tcl, Python, and Perl modules
16688 *** NEW FEATURE ***
16691 Massive changes and simplification of C declaration parsing.
16692 Although SWIG is still not a full C parser, its ability
16693 to handle complex datatypes including pointers to functions
16694 and pointers to arrays has been vastly improved.
16696 8/03/2001: cheetah (william fulton)
16697 * Distribution fixes: autoconf no longer needed to install SWIG.
16700 Removed two undocumented parsing features. SWIG no longer
16701 supports out-of-class static function or variable
16702 declarations. For example:
16704 static int Foo::bar;
16706 This feature may return if there is sufficient demand.
16707 However, since SWIG is most often used with header files,
16708 it is more likely for these definitions to be included
16709 in the class definition.
16710 *** POTENTIAL INCOMPATIBILITY ***
16712 8/02/2001: cheetah (william fulton)
16713 * Cleanup of the GIFPlot examples. Upgraded Java GIFPlot example.
16715 8/01/2001: cheetah (william fulton)
16716 * [Java] Efficiency changes: _cPtr used where possible rather than
16717 getCPtr(). Bug fixes for inheritance - derived class sometimes
16718 didn't delete the c memory when _delete() was called.
16719 * [Java] Abstract c++ classes are wrapped with a java abstract shadow
16720 class. Also a pure virtual function is mapped with an abstract method.
16721 * The default output file has always been <module>_wrap.c. It is now
16722 <module>_wrap.cxx if the -c++ commandline option is passed to swig.
16723 This has been done as otherwise c++ code would appear in a c file.
16724 *** POTENTIAL INCOMPATIBILITY ***
16727 Modified the %constant directive to be more C-like in syntax.
16730 %constant NAME = VALUE;
16731 %constant TYPE NAME = VALUE;
16735 %constant Foo *Bar = &Spam;
16737 A more subtle case is as follows:
16739 %constant int (*FOO)(int,int) = blah;
16741 *** POTENTIAL INCOMPATIBILITY *** Modules that were using
16742 the %constant directive directly will need to be modified.
16745 Removed obscure and undocumented form of the %inline directive:
16747 %inline int blah(int a, int b) {
16751 *** POTENTIAL INCOMPATIBILITY ***
16752 (note: this feature was never documented and is withdrawn)
16755 Removed support for functions with no explicitly declared
16756 return type. For example:
16760 In C, such functions were implicitly assumed to return an 'int'.
16761 In C++, this is illegal. Either way, it's considered bad
16762 style. Removing support for this in SWIG will simplify
16763 certain issues in parsing.
16764 *** POTENTIAL INCOMPATIBILITY ***
16767 * Partial merge from the CVS trunk. The Source/DOH directory
16768 and most of the Source/Swig directory is up-to-date now.
16769 * [Guile] %scheme is now a macro for %insert("scheme").
16770 New syntax: %scheme "FILENAME";
16771 New syntax: %scheme %{ SCHEME-CODE %}
16772 New macros %multiple_values, %values_as_list,
16776 %readonly and %readwrite have been turned into SWIG pragmas.
16777 %pragma(swig) readonly and %pragma(swig) readwrite. Macros
16778 are used to provide backwards compatibility.
16781 Minor changes to %pragma directive. %pragma must always
16782 be directed to a specific language. For example:
16784 %pragma(swig) make_default;
16785 %pragma(perl5) include = "blah.i";
16787 Also extended the pragma directive to allow code blocks
16789 %pragma(foo) code = %{
16793 *** POTENTIAL INCOMPATIBILITY ***
16796 Change to the way 'const' variables are wrapped. In
16797 previous versions of SWIG, a 'const' variable was
16798 wrapped as a constant. Now, 'const' variables are
16799 wrapped as read-only variables. There are several
16800 reasons for making this change, mostly pertaining to
16801 subtle details of how 'const' actually works.
16803 This will probably break old interfaces that used 'const'
16804 to create constants. As a replacement, consider using this:
16806 const int a = 4; ===> %constant int a = 4;
16807 *** POTENTIAL INCOMPATIBILITY ***
16810 Reorganization and simplification of type parsing.
16811 Types with 'const' should work correctly now.
16814 Most swig directives related to the documentation system
16815 are now deprecated.
16818 Removed support for Objective-C in order to simplify
16819 parser reconstruction. Will return if there is sufficient
16821 *** POTENTIAL INCOMPATIBILITY ***
16824 Code inclusion has been modified in the parser. A common
16825 directive %insert is now used for everything. This
16826 inserts a file into the output:
16828 %insert(header) "foo.swg"
16830 This inserts some inline code into the output
16836 There are five predefined targets for the insert directive:
16838 "header" - Header section of wrapper file
16839 "runtime" - Runtime section of wrapper file
16840 "wrapper" - Wrapper section
16841 "init" - Initialization function
16842 "null" - Nothing. Discard.
16844 The following directives are still supported, but are
16845 now defined in terms of macros:
16847 %{ ... %} -> %insert(header) %{ ... %}
16848 %init %{ ... %} -> %insert(init) %{ ... %}
16849 %wrapper %{ ... %} -> %insert(wrapper) %{ ... %}
16850 %runtime %{ ... %} -> %insert(runtime) %{ ... %}
16852 Language modules can define new named targets by using the
16853 C API function Swig_register_filebyname() (see main.cxx).
16854 For example, if you wanted to expose a shadow class file,
16857 Swig_register_filebyname("shadow", f_shadow);
16859 Then in the interface file:
16861 %insert(shadow) %{ ... %}
16863 Note: this change should not affect any old interfaces, but
16864 does open up new possibilities for enhancements.
16867 SWIG now always includes a standard library file 'swig.swg'.
16868 This file defines a large number of macro definitions
16869 that define the behavior of various SWIG directives.
16870 Previously, all SWIG directives were handled as special
16871 cases in the parser. This made the parser a large
16872 bloated mess. Now, the parser is stripped down to a few
16873 simple directives and macros are used to handle everything else.
16875 7/26/2001: cheetah (william fulton)
16876 * Fixes for Sourceforge bug #444748 - new testcase cpp_static:
16877 [TCL] Class with just static member variable/function fix
16878 [Java] Fixed static variables support
16879 [Ruby] Static variables workaround removed
16882 * stype.c (SwigType_default): Strip qualifiers first. The
16883 default type of "int * const" is now "SWIGPOINTER *".
16884 * main.cxx: Define "__cplusplus" in SWIG's preprocessor if
16886 * [Guile]: Added some support for arrays and C++
16887 references, fixing the "constant_pointers" test case.
16888 * Moved most tests from the old Guile-specific test-suite
16889 to the new test-suite. Also moved perl5/pointer-cxx
16892 7/26/2001: cheetah (william fulton)
16893 * Test-suite added.
16894 * Initial testcases: constant_pointers cpp_enum defines
16895 sizeof_pointers unions virtual_destructor
16896 * Make clean improvements.
16898 7/24/2001: cheetah (william fulton)
16899 * [Java] Underscores in the package name and/or module name
16900 no longer give linking problems.
16902 7/17/2001: cheetah (william fulton)
16903 * More parser bug fixes for constant pointers
16906 * [Guile] Aesthetic improvement in variable wrappers.
16909 * Fixed core-dump problem in pointer library when
16910 freeing character arrays.
16911 SF Bug [ #415837 ] pointer lib core dump
16914 * Fixed problem with default destructors and shadow
16915 classes. SF bug #221128.
16918 * To provide better line-number tracking in interfaces
16919 with lots of macros, special locator comments are
16920 now generated by the SWIG preprocessor. For example:
16922 /*@foo.i,42,BLAH@*/expanded macro/*@@*/
16924 The first /*@...@*/ sequence sets the context
16925 to point to the macro code. The /*@@*/ comment
16926 terminates the context. The SWIG parser should
16927 ignore all of the locator comments as should
16928 the C compiler (should such comments end up
16929 in generated wrapper code).
16932 * The parser now handles severely constified types in
16933 typemaps. This introduced a new shift/reduce conflict, but
16934 only with a heuristic function-pointer catch-all rule.
16935 * [Guile]: Added typemaps for severely constified types.
16936 * Fixed the "template-whitespace" problem by canonicalizing
16937 whitespace, especially around angle brackets and commas.
16940 * [Guile]: A Scheme file is emitted if the -scmstub FILE.SCM
16941 command-line option is used. The %scheme directive
16942 (implemented as a macro for a pragma) allows to insert
16943 arbitrary code here. In "simple" and "passive" linkage,
16944 the file gets filled with define-module and export
16947 7/17/2001: cheetah (william fulton)
16948 * Parser bug fix to support constant pointers, eg int* const ptr.
16949 Fixed everywhere - variables, parameters, return types etc. Note that
16950 when wrapping a constant pointer variable only the getter is generated.
16953 * Fixed SF bug #441470 (#define X "//" would not be parsed,
16954 see test-suite entry "preproc-1"), reported by T. W. Burton
16955 <twburton@users.sf.net>.
16956 * Changed the type of character constants to "char", rather
16957 than "char *". Changed the individual language modules
16958 to keep the old behaviour, except for the Guile module,
16959 where it is desired to make them Scheme characters. This
16960 fixes SF bug #231409, test-suite entry "char-constant".
16961 * Applied patch for DOH/Doh/memory.c by Les Schaffer
16962 <schaffer@optonline.net> (avoid required side effects in
16965 7/17/2001: cheetah (william fulton)
16966 * Bug fix in parser for virtual destructor with void as parameter
16967 * Bug fix in parser #defines embedded within classes/structs/unions
16968 Consequently %constant can now also be placed within a struct/class/union.
16969 * Bug fix in parser to allow sizeof(*I_am_a_pointer) within a #define
16972 * Added changes for the Macintosh contributed by Luigi
16973 Ballabio <ballabio@mac.com>.
16974 * Some "const" fixes in the code.
16975 * [Guile]: Made the constant-wrapper functions much shorter.
16978 * [Guile]: Some "const" fixes for Guile version 1.3.4.
16979 * Handle anonymous arguments with default values and static
16980 array members of classes. Both bugs reported by Annalisa Terracina
16981 <annalisa.terracina@datamat.it>; see the files
16982 Examples/guile/test-suite/static-array-member.i and
16985 Version 1.3.6 (July 9, 2001)
16986 =============================
16988 7/09/2001: cheetah (william fulton)
16989 * GIFPlot examples: FOREGROUND and BACKGROUND definition missing
16990 after TRANSPARENT #define fix in GIFPlot
16993 Fixed up the version numbers so that the release is known
16994 as 1.3.6. All future releases should have a similar
16998 * [Python]: Prevent the problem of self.thisown not being
16999 defined if the C++ class constructor raised an exception.
17000 Thanks to Luigi Ballabio <ballabio@mac.com>.
17003 * More portability fixes; fixed "gcc -Wall" warnings.
17005 6/29/2001: cheetah (william fulton)
17006 * GIFPlot examples: TRANSPARENT #define multiple times on Solaris
17007 (clashes with stream.h).
17008 * Multiple definition bug fix for shadow classes. The perl and python
17009 modules had workarounds which have been replaced with fixes in
17010 the core. Many of the Language::cpp_xxxx functions now set a
17011 flag which the derived classes can access through
17012 is_multiple_definition() to see whether or not code should be
17013 generated. The code below would have produced varying degrees
17014 of incorrect shadow class code for the various modules:
17019 TestClass(int a) {};
17021 unsigned long xyz(short k) {};
17022 unsigned long xyz(int n) {};
17023 static void static_func() {};
17024 static void static_func(int a) {};
17026 void delete_TestClass(int a);
17029 * [Perl] Another const-related portability fix.
17031 6/26/2001: cheetah (william fulton)
17032 * [Java] Added in cpp_pragma() support with a host of new pragmas - see
17033 jswig.html. These are designed for better mixing of Java and c++. It
17034 enables the user to specify pure Java classes as bases and/or interfaces
17035 for the wrapped c/c++.
17036 * [Java] Old pragmas renamed. Warning given for the moment if used.
17037 *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
17040 * Incorporated more build changes contributed by Wyss Clemens
17041 <WYS@helbling.ch> for swig/ruby on cygwin.
17043 6/20/2001: cheetah (william fulton)
17044 * Makefile mods so that 'make check' uses the swig options in the makefiles
17045 * [Java] Removed Generating wrappers message
17046 * [Java] NULL pointer bug fix
17047 * [Java] Bug fix for Kaffe JVM
17050 * SWIG_TypeQuery from common.swg now returns a
17051 swig_type_info* rather than a void*. This fixes a problem
17052 when using pointer.i and C++, as illustrated by the new
17053 test-suite example perl5/pointer-cxx.
17054 * Portability fixes (const char *).
17055 * Incorporated build changes contributed by Wyss Clemens
17056 <WYS@helbling.ch>, which make swig runnable on cygwin.
17058 6/19/2001: cheetah (william fulton)
17059 * [Java] Bug fix for SF bug #211144. This fix is a workaround
17060 until fixed in the core.
17063 * [Guile]: Portability fixes for use with the Sun Forte
17065 * [Tcl]: Portability fix (const char *).
17066 * [Tcl]: Configure now first tries to find a tclConfig.sh
17067 file in order to find the Tcl include directory, library
17068 location and library name.
17069 * [Python]: Added a few possible library locations.
17072 * [Guile]: Don't call scm_c_export if nothing is to be
17073 exported. Don't warn on %module if module has been set
17074 already (this frequently occurs when %import is used).
17077 * [Guile]: New "passive" linkage, which is appropriate for
17078 multi-module extensions without Guile module magic.
17081 * [Guile]: Fixed printing of smobs (space and angle were
17083 * Properly generate type information for base classes
17084 imported with the %import directive. Thanks to Marcelo
17085 Matus <mmatus@acms.arizona.edu> for the report and the
17086 patch; this closes SF bug #231619; see also
17087 Examples/guile/test-suite/import*.
17088 * [Guile]: Fix casting between class and base class; the
17089 runtime type system had it the wrong way around; see
17090 Examples/guile/test-suite/casts.i
17091 * Make typemaps for SWIGPOINTER * with arg name take
17092 precedence over those without arg name, to match normal
17093 typemap precedence rules.
17094 * Fixed the random-line-numbers problem reported as SF bug
17095 #217310; thanks to Michael Scharf <scharf@users.sf.net>.
17096 * [Guile]: Handle the %name and %rename directives.
17097 * New syntax: %name and %rename now optionally take double
17098 quotes around the scripting name. This is to allow scripting
17099 names that aren't valid C identifiers.
17102 Made a minor change to the way files are loaded in
17103 order to get file/line number reporting correct in
17107 * The parser now understands the (non-standard) "long long"
17108 types. It is up to the individual language modules to
17109 provide typemaps if needed. Reported by Sam Steingold, SF
17111 * The parser now understands arguments like "const int *
17112 const i". This fixes SF bug #215649.
17113 * Fixed the Guile test-suite.
17116 Partial merge from the CVS trunk at tag
17117 "mkoeppe-merge-1". This covers the following changes:
17120 | Wrote table of contents for Doc/engineering.html. Added section
17121 | on CVS tagging conventions. Added copyright to other docs.
17122 | 9/25/00 : beazley
17123 | Modified the preprocessor so that macro names can start with a '%'.
17124 | This may allow new SWIG "directives" to be defined as macros instead
17125 | of having to be hard-coded into the parser.
17127 | *** Also a yet-to-be-documented quoting mechanism with backquotes
17128 | *** has been implemented?
17131 * When configure does not find a language, don't use default
17132 paths like /usr/local/include; this only causes build
17134 * New directory: Examples/Guile/test-suite, where a few
17135 bugs in 1.3a5 are demonstrated.
17136 * Handle C++ methods that have both a "const" and a "throw"
17137 directive (see Examples/Guile/test-suite/cplusplus-throw.i);
17138 thanks to Scott B. Drummonds for the report and the fix.
17139 * Handle C++ pointer-reference arguments (like "int *& arg")
17140 (see Examples/Guile/test-suite/pointer-reference.i,
17141 reported as SF bug #432224).
17142 * [Ruby] Fixed typo in rubydec.swg; thanks to Lyle Johnson!
17143 * Don't stop testing when one test fails.
17144 * [Guile, MzScheme] Don't print "Generating wrappers...".
17147 [Guile] VECTORLENINPUT and LISTLENINPUT now have separate
17148 list length variables. TYPEMAP_POINTER_INPUT_OUTPUT
17149 attaches argument documentation involving SCM_TYPE to the
17150 standard pointer typemaps. INOUT is now an alias for BOTH.
17152 6/12/2001: cheetah (william fulton)
17153 Some Java documentation added.
17154 [Java] Fixed bugs in import pragma and shadow pragma.
17157 Fix declarations of SWIG_define_class
17158 (Lib/ruby/rubydec.swg) and SWIG_TypeQuery
17159 (Lib/common.swg). Thanks to Lyle Johnson
17160 <ljohnson@resgen.com> for the patches.
17163 [Guile] Use long instead of scm_bits_t; this makes the
17164 generated wrapper code compatible with Guile 1.3.4
17165 again. Thanks to Masaki Fukushima for pointing this out.
17167 6/11/2001: cheetah (william fulton)
17168 The generic INSTALL file from autoconf added. Few changes to README file.
17171 Fixed typo in Makefile.in; thanks to Greg Troxel
17174 6/08/2001: cheetah (william fulton)
17175 make check works again. Examples/GIFPlot configure generated by
17176 top level autoconf now.
17179 Another build change: The new script autogen.sh runs
17180 autoconf in the appropriate directories. The top-level
17181 configure also configures in Examples/GIFPlot.
17184 Made the Makefile work with non-GNU make again.
17186 6/07/2001: cheetah (william fulton)
17187 [Java] Class/struct members that are arrays of pointers to classes/structs -
17188 Shadow class's get/set accessors now use Java classes instead of longs (pointers).
17189 [Java] Shadow classes will now clean up memory if function return type
17191 [Java] New example called reference based on the same example from other modules.
17194 New configure option --with-release-suffix allows for
17195 attaching a suffix to the swig binary and the swig runtime
17196 libraries. Minor changes to the build system. "swig
17197 -swiglib" works again. If invoked with the new option
17198 "-ldflags", SWIG prints a line of linker flags needed to
17199 link with the runtime library of the selected language
17203 [Guile] gswig_list_p is an int, not a SCM. This typo
17204 caused warnings when compiling with a Guile configured with
17205 strict C type checking. In INPUT and BOTH typemaps
17206 generated by the SIMPLE_MAP macro, use the SCM_TO_C
17207 function to convert from Guile to C (rather than C_TO_SCM).
17208 Use scm_intprint to print pointers (rather than
17209 sprintf). Allow using "-linkage" instead of "-Linkage".
17211 6/05/2001: cheetah (william fulton)
17212 [Java] Mods for using inherited c++ classes from Java
17213 [Java] New example called class based on the same example from other modules
17215 6/05/2001: cheetah (william fulton)
17216 [Java] destructor (_delete()) was not aware of %name renaming
17217 [Java] extends baseclass did not know about %name renaming
17218 [Java] extends baseclass did extend even when the baseclass was not known to swig
17219 [Java] sometimes enum-declarations occured before the Java class declaration
17220 [Java] unrelated enum initialisations no longer appear in Java class
17221 [Java] if module ends in '_' correct JNI names are now produced
17223 6/04/2001: cheetah (william fulton)
17224 [Java] Shadow class mods - Modified constructor replaces
17225 newInstance(). _delete() now thread safe. getCPtr() replaces
17226 _self. _selfClass() removed as now redundant.
17227 *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
17229 [Java] Not all output java files had SWIG banner. New banner.
17231 [Java] Shadow class finalizers are output by default: Command
17232 line option -finalize deprecated and replaced with -nofinalize.
17233 *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE ***
17236 [Guile] Cast SCM_CAR() to scm_bits_t before shifting it.
17237 This is required for compiling with a Guile configured with
17238 strict C type checking.
17241 Added configure option "--with-swiglibdir".
17244 [Guile] Support multiple parallel lists or vectors in
17245 the typemaps provided by list-vector.i. New typemaps file,
17248 5/25/2001: cheetah (william fulton)
17249 [Java] HTML update for examples.
17252 Minor changes to the build system. Added subdirectory for
17253 Debian package control files.
17256 [Guile] Build a runtime library, libswigguile.
17259 [Guile] New typemap substitution $*descriptor. Use the {}
17260 syntax, rather than the "" syntax for the standard
17261 typemaps, in order to work around strange macro-expansion
17262 behavior of the SWIG preprocessor. This introduces some
17266 [Guile] Handle pointer types with typemaps, rather than
17267 hard-coded. New typemap substitutions $descriptor,
17268 $basedescriptor; see documentation. Some clean-up in the
17269 variable/constants wrapper generator code. New convenience
17270 macro SWIG_Guile_MustGetPtr, which allows getting pointers
17271 from smobs in a functional style. New typemap file
17272 "list-vector.i", providing macros that define typemaps for
17273 converting between C arrays and Scheme lists and vectors.
17275 5/25/2001: cheetah (william fulton)
17276 [Java] STL string moved into its own typemap as it is c++ code and
17277 it break any c code using the typemaps.i file.
17278 - Fixes for wrappers around global variables - applies to primitive
17279 types and user types (class/struct) and pointers to these.
17280 - Structure member variables and class public member variables getters
17281 and setters pass a pointer to the member as was in 1.3a3 and 1.1
17282 (1.3a5 was passing by value)
17283 - Parameters that were arrays and return types were incorrectly
17284 being passed to create_function() as pointers.
17285 - Fix for arrays of enums.
17286 [Java] Updated java examples and added two more.
17287 [Java] Java module updated from SWIG1.3a3 including code cleanup etc.
17288 [Java] enum support added.
17289 [Java] Array support implemented
17290 [Java] Shadow classes improved - Java objects used rather than
17291 longs holding the c pointer to the wrapped structure/c++class
17294 [Guile] Fixed extern "C" declarations in C++ mode. Thanks
17295 to Greg Troxel <gdt@ir.bbn.com>.
17298 [Guile] New linkage "module" for creating Guile modules for
17299 Guile versions >= 1.5.0.
17302 [MzScheme] Added typemaps for passing through Scheme_Object
17306 [MzScheme] Added typemaps for `bool'. Inclusion of headers
17307 and support routines is now data-driven via mzscheme.i.
17308 Headers come from the new file mzschemdec.swg. Don't abort
17309 immediately when a type-handling error is reported. When
17310 searching for typemaps for enums, fall back to using int,
17311 like the Guile backend does. Support char constants. Emit
17312 correct wrapper code for variables.
17315 [Guile] Fixed typemaps for char **OUTPUT, char **BOTH.
17318 [Guile] Every wrapper function now gets a boolean variable
17319 gswig_list_p which indicates whether multiple values are
17320 present. The macros GUILE_APPEND_RESULT, GUILE_MAYBE_VALUES
17321 and GUILE_MAYBE_VECTOR use this variable, rather than
17322 checking whether the current return value is a list. This
17323 allows for typemaps returning a list as a single value (a
17324 list was erroneously converted into a vector or a
17325 multiple-value object in this case).
17328 [Guile] Added support for returning multiple values as
17329 vectors, or passing them to a muliple-value
17330 continuation. By default, multiple values still get
17331 returned as a list.
17334 [Guile] Added a "beforereturn" pragma. The value of this
17335 pragma is inserted just before every return statement.
17338 [Guile] Added support for Guile 1.4.1 procedure
17339 documentation formats, see internals.html.
17342 [Guile] Made the wrapper code compile with C++ if the
17343 "-c++" command-line switch is given. Thanks to
17344 <monkeyiq@dingoblue.net.au>.
17347 [Guile] Now two type tables, swig_types and
17348 swig_types_initial, are used, as all other SWIG language
17349 modules do. This removes the need for the tricky
17350 construction used before that the broken Redhat 7.0 gcc
17351 doesn't parse. Reported by <monkeyiq@dingoblue.net.au>.
17354 [Guile] Fixed typemaps for char *OUTPUT, char *BOTH; a bad
17355 free() would be emitted. Added typemap for SCM.
17358 Version 1.3 Alpha 5
17359 ===================
17362 [Python] Python module generates more efficient code for
17363 creating the return value of a wrapper function. Modification
17364 suggested by Jon Travis.
17367 Library files specified with the -l option are now included at the
17368 end of the interface file (reverting to the old behavior).
17371 Fixed some problems with enum handling. enums are now manipulated as
17372 'int', but cast into the enum type when values are passed to the
17373 corresponding C function.
17376 [Guile] Removed "-with-smobs" command-line option, as this is the
17377 default now. Added "-emit-setters" command-line option,
17378 which turns on generating procedures-with-setters; see
17382 Incorporated patch #101430, fixing bugs in the Guile module:
17383 1. Some arguments were erroneously taken as *optional* arguments when
17384 ignored arguments were present.
17385 2. Guile 1.3.4 was not supported since functions introduced in Guile
17387 3. Added handling of `const char *'.
17390 Fixed problem with failed assertion and large files.
17393 Fixed problem with the '%' character appearing in added methods
17394 and function bodies. Preprocessor bug.
17396 Version 1.3 Alpha 4 (September 4, 2000)
17397 =======================================
17400 Added instructions for maintainers in Examples/README on how
17401 to make examples also be useful in the testing framework.
17402 Also, "make check" now uses ./Lib by via env var `SWIG_LIB'.
17403 This is overridable like so:
17404 make chk-swiglib=/my/experimental/swig/Lib check
17407 Added $typemap variable to typemaps. This gets replaced with
17408 a string indicating the typemap that is applied. Feature
17409 request from rsalz.
17412 Experimental optimization to code generation for virtual
17413 member functions. If you have two classes like this:
17416 virtual void foo();
17419 class B() : public A {
17420 virtual void foo();
17423 Swig now will generate a single wrapper function for this
17429 and use it as the implementation of both A_foo() and B_foo().
17430 This optimization only takes place if both methods are declared
17431 as virtual and both take identical parameters.
17432 *** EXPERIMENTAL FEATURE ***
17435 Restored the "memberin" typemap for setting structure members.
17436 Unlike the old version, the new version is expanded inline in the
17437 wrapper function allowing access to scripting language
17438 internals (a sometimes requested feature). The "memberout" typemap
17439 is gone. Use the "out" typemaps instead.
17440 *** POTENTIAL INCOMPATIBILITY ***
17443 Attribute set methods no longer return the value of a member.
17451 now gets set as follows:
17453 void Foo_x_set(Foo *f, int x) {
17457 In SWIG1.1 it used to be this:
17459 int Foo_x_set(Foo *f, int x) {
17463 This has been changed due to the complexity created by trying
17464 to do this with more exotic datatypes such as arrays. It also
17465 complicates inlining and handling of the "memberin" typemap.
17466 *** POTENTIAL INCOMPATIBILITY ***
17469 Removed the ptrcast() and ptrmap() functions from the
17470 pointer.i library file. Old implementation is incompatible
17471 with new type system.
17472 *** POTENTIAL INCOMPATIBILITY ***
17475 New runtime function SWIG_TypeQuery(const char *name) added.
17476 This function can be used to extract the type info structure
17477 that is used for type-checking. It works with either the
17478 nice C name or mangled version of a datatype. For example:
17480 swig_type_info *ty = Swig_TypeQuery("int *");
17481 swig_type_info *ty = Swig_TypeQuery("_p_int");
17483 This is an advanced feature that has been added to support some
17484 exotic extension modules that need to directly manipulate
17485 scripting language objects.
17486 *** NEW FEATURE ***
17489 New directive %types() added. This is used to
17490 explicitly list datatypes that should be included in
17491 the runtime type-checking code. Normally it is never
17492 necessary to use this but sometimes advanced extensions
17493 (such as the pointer.i library) may need to manually
17494 add types to the type-checker.
17495 *** NEW FEATURE ***
17498 Improved handling of string array variables. For example,
17499 a global variable of the form "char name[64]" is automatically
17500 managed as a 64 character string. Previously this didn't
17501 work at all or required the use of a special typemap.
17502 *** NEW FEATURE (Tcl, Perl, Python) ***
17505 Added Makefile target `check-c++-examples', which uses new
17506 files under Examples/C++ contributed by Tal Shalif. Now "make
17507 check" also does "make check-c++-examples". Also, expanded
17508 actions in `check-gifplot-example' and `check-aliveness'.
17511 Major clean-up in the Guile module. Added typemap-driven
17512 documentation system. Changed to handle more than 10
17513 args. Updated and extended examples.
17514 *** NEW FEATURE ***
17517 Added new %insert directive that inserts the contents of a file
17518 into a portion of the output wrapper file. This is only intended
17519 for use by writers of language modules. Works as follows:
17521 %insert(headers) "file.swg";
17522 %insert(runtime) "file.swg";
17523 %insert(wrappers) "file.swg";
17524 %insert(init) "file.swg";
17526 *** NEW FEATURE ***
17529 Added new %runtime directive which includes code into the runtime
17530 portion of the wrapper code. For example:
17533 ... some internal runtime code ...
17536 There is no practical reason for ordinary users to use this
17537 feature (almost everything can be done using %{ ... %}
17538 instead). However, writers of language modules may want to
17539 use this in language configuration files.
17540 *** NEW FEATURE ***
17543 Typemaps can now be specified using string literals like
17546 %typemap(in) int "$target = SvIV($source);";
17548 When code is specified like this, it is *NOT* enclosed
17549 inside a local scope (as with older typemap declarations).
17550 Note: character escape sequences are interpreted in the
17551 code string so if you want to include a quote or some
17552 other special character, make sure you use a (\).
17553 *** NEW FEATURE ***
17556 Typemaps have been modified to follow typedef declarations.
17557 For example, if you have this:
17559 typedef int Number;
17562 ... get an integer ...
17565 void foo(Number a);
17567 The typemap for 'int' will be applied to the argument 'Number a'.
17568 Of course, if you specify a typemap for 'Number' it will take
17569 precedence (nor will it ever be applied to an 'int').
17570 *** POTENTIAL INCOMPATIBILITY ***
17573 Default typemap specification has changed. In older
17574 versions of swig, you could do this:
17576 %typemap(in) int SWIG_DEFAULT_TYPE {
17580 To specify the default handling of a datatype. Now that
17581 SWIG follows typedef declarations, this is unnecessary.
17582 Simply specifying a typemap for 'int' will work for all
17583 variations of integers that are typedef'd to 'int'.
17585 Caveat, specifying the default behavior for pointers,
17586 references, arrays, and user defined types is a little
17587 different. This must be done as follows:
17589 %typemap() SWIGPOINTER * {
17592 %typemap() SWIGREFERENCE & {
17593 ... a reference ...
17595 %typemap() SWIGARRAY [] {
17598 %typemap() SWIGTYPE {
17599 ... a user-defined type (by value) ...
17601 *** POTENTIAL INCOMPATIBILITY ***
17604 The file swig-1.3a1-1.spec has been added to the Tools directory.
17605 It can be used to build a redhat package for SWIG, although it
17606 will need to be updated for the next public release.
17609 Typemaps have been completely rewritten. Eventually they may be
17610 replaced with something better, but for now they stay. However,
17611 there are a number of a significant changes that may trip some
17614 1. Typemap scoping is currently broken. Because of this, the
17615 following code won't work.
17617 %typemap(in) blah * {
17624 %typemap(in) blah *; /* Clear typemap */
17626 (this breaks because the code for the class Foo is actually
17627 generated after the entire interface file has been processed).
17628 This is only a temporary bug.
17630 2. In SWIG1.1, the %apply directive worked by performing a
17631 very complex type-aliasing procedure. From this point on,
17632 %apply is simply a generalized typemap copy operation.
17635 %apply double *OUTPUT { double *x, double *y };
17637 Copies *ALL* currently defined typemaps for 'double *OUTPUT' and
17638 copies them to 'double *x' and 'double *y'.
17640 Most people probably won't even notice this change in
17641 %apply. However, where it will break things is in code like
17644 %apply double *OUTPUT { double *x };
17645 %typemap(in) double *OUTPUT {
17649 void foo(double *x);
17651 In SWIG1.1, you will find that 'foo' uses the 'double *OUTPUT' rule
17652 even though it was defined after the %apply directive (this is
17653 the weird aliasing scheme at work). In SWIG1.3 and later,
17654 the 'double *OUTPUT' rule is ignored because it is defined
17655 after the %apply directive.
17657 3. The %clear directive has been modified to erase all currently
17658 defined typemaps for a particular type. This differs from
17659 SWIG1.1 where %clear only removed rules that were added using
17660 the %apply directive.
17662 4. Typemap matching is now performed using *exact* types.
17663 This means that things like this
17665 %typemap(in) char * { }
17666 %typemap(in) const char * { }
17668 are different typemaps. A similar rule applies for pointers,
17669 arrays, and references. For example:
17671 %typemap(in) double * { }
17673 used to apply to 'double &', 'double []', Now, it only applies
17674 to 'double *'. If you want a 'double &', you'll need to handle
17677 5. Array matching has been simplfied. In SWIG1.1, array matching
17678 was performed by trying various combinations of dimensions.
17679 For example, 'double a[10][20]' was matched as follows:
17686 In SWIG1.3, only the following matches are attempted:
17691 On the positive side, typemap matching is now *significantly* faster
17693 *** POTENTIAL INCOMPATIBILITY ***
17696 Secret developer feature. Since datatypes are now represented as
17697 strings internally, you can bypass limitations of the parser and
17698 create a wild datatype by simply enclosing the raw string encoding
17699 in backticks (``) and sticking it in the interface file anywhere a
17700 type is expected. For example, `a(20).a(10).p.f(int,int)`. This
17701 feature is only intended for testing (i.e., you want to see what
17702 happens to your language module if it gets a reference to a pointer
17703 to an array of pointers to functions or something).
17707 Completely new type-system added to the implementation.
17708 More details later.
17711 Cleaned up some of the I/O handling. SWIG no longer generates
17712 any temporary files such as _wrap.wrap, _wrap.ii, _wrap.init.
17713 Instead, these "files" are kept around in memory as strings
17714 (although this is transparent to language modules).
17717 Added Makefile target "check" and variants.
17718 This can be used like "make check" or, to explicitly skip a
17719 language LANG: "make skip-LANG=true check". LANG is skipped
17720 automatically if ./configure determines that LANG support is
17723 Currently, the check is limited to doing the equivalent of
17724 "make all" in some of the Examples directories. This should
17725 be expanded both horizontally (different types of tests) and
17726 vertically (after "make all" in an Examples subdir succeeds,
17727 do some additional tests with the resulting interpreter, etc).
17730 Added Makefile target "distclean", which deletes all the
17731 files ./configure creates, including config.status and friends.
17734 java changes??? [todo: document changes]
17737 Typemaps have been modified to key off of the real datatypes
17738 used in the interface file. This means that typemaps for
17739 "const char *" and "char *" will be difference as will typemaps
17740 for "Vector" and "Vector *."
17741 *** POTENTIAL INCOMPATIBILITY ***
17742 This is likely to break interfaces that rely on the odd type
17743 handling behavior of typemaps in SWIG1.1--especially with
17744 respect to interfaces involving pass-by-value.
17747 New %constant directive. This directive can be used to
17748 create true constants in the target scripting language.
17749 It's most simple form is something like this:
17753 In this case, the type is inferred from the syntax of the
17754 value (in reality, all #define macros are translated into
17755 directives of this form).
17757 An expanded version is as follows:
17759 %constant(Foo *) FOO = &FooObj;
17761 In this case, an explicit type can be specified. This
17762 latter form may be useful for creating constants that
17763 used to be specified as
17765 const Foo *FOO = &FooObj;
17767 (which are now treated as variables).
17768 *** EXPERIMENTAL FEATURE *** The syntax may change in
17772 Modified the parser so that variable declarations of the form
17773 "const type *a" are handled as variables, not constants.
17774 Note: SWIG1.1 handled this case erroneously because
17775 const char *a is a pointer variable that can be reassigned.
17776 *** POTENTIAL INCOMPATIBILITY ***
17777 Note: just because this is the "right" way to do things,
17778 doesn't mean it's the most appropriate interpretation.
17779 I suspect that many C programmers might use 'const char *'
17780 with the intent of creating a constant, without realizing
17781 that they've created a reassignable global variable.
17784 The C/C++ wrapping layer has been completely redesigned and
17785 reimplemented. This change should iron out a few rough
17786 spots with the handling of datatypes. In addition, the
17787 wrapper code is somewhat cleaner.
17788 *** POTENTIAL INCOMPATIBILITY ***
17789 This change may break interfaces that involve
17790 subtle corner-cases with typemaps and the %addmethods
17791 directive since some of these features had somewhat
17792 type handling behavior in SWIG1.1.
17795 The "memberin" and "memberout" typemaps are gone for the
17796 moment, but they might return as soon as I figure out
17797 how to integrate them with some of the streamlined C wrapper
17799 *** POTENTIAL INCOMPATIBILITY ***
17802 A variety of old type handling functions such as print_type(),
17803 print_full(), print_mangle(), etc... are gone and have been
17804 replaced with a smaller set of functions. See the file
17805 Doc/internals.html for details. This will break all third
17806 party language modules.
17807 *** POTENTIAL INCOMPATIBILITY ***
17810 Deprecated the %val and %out directives. These directives
17811 shouldn't really be necessary since typemaps can be used
17812 to achieve similar results. This also cleans up the
17813 handling of types and parameters quite a bit.
17814 *** POTENTIAL INCOMPATIBILITY ***
17817 Fixed unspecified-module bug in Guile support and removed
17818 more non-"with-smobs" functionality using patches submitted
17819 by Matthias Koeppe.
17821 Re-enable recognition of "-with-smobs" (with no effect since
17822 we use smobs by default now) for the time being. After the
17823 1.3a4 release, this option will signal an error.
17826 Fixed NULL-input bug in parameter list handling.
17827 Reported by Matthias Koeppe.
17830 Fixed memory leak in Python type-checking code. Reported by
17831 Keith Davidson. Bug #109379.
17834 Changed internal data structures related to function parameters.
17837 Fixed some bugs related to the handling of the %name() directive
17838 and classes in the Tcl module. Problem reported by James Bailey.
17841 Fixed parsing and enum handling problems with character constants.
17842 Reported by Greg Kochanski.
17845 Removed WrapperFunction class from the core and updated the language
17846 module. This will break third party modules.
17847 *** POTENTIAL INCOMPATIBILITY ***
17850 Implementation of SWIG no longer makes use of C++ operator overloading.
17851 This will almost certainly break *all* third party language modules
17852 that are not part of the main SWIG CVS tree. Sorry.
17853 *** POTENTIAL INCOMPATIBILITY ***
17856 Removed the experimental and undocumented "build" typemap that
17857 was intended to work with multiple arguments. Simply too weird
17858 to keep around. Besides, a better replacement is in the works.
17861 Removed non-"with-smobs" functionality (Guile support), i.e.,
17862 "-with-smobs" is now the default and no longer needs to be
17863 specified on the command-line.
17866 Incorporated Ruby support contributed by Masaki Fukushima.
17869 Applied more-than-10-args bugfix patch contributed
17870 by Matthias Koeppe.
17873 Rewrote some of the string handling and eliminated the C++
17874 implementation (which is now just a wrapper).
17877 Added Doc/index.html and Doc/internals.html. The target
17878 audience for the latter is new SWIG developers.
17881 Version 1.3 Alpha 3 (June 18, 2000)
17882 ===================================
17885 Removed the naming.cxx, hash.cxx, and symbol.cxx files from
17886 the SWIG1.1 directory. Continued to migrate things away
17887 from the C++ base (although there's still a lot of work to do).
17890 Added a few more examples to the Examples directory. Still
17891 need to do a lot of work on this.
17894 Added -includeall to follow all #include statements in the
17898 Tried to fix as many C++ warnings as possible when compiling
17899 with the Sun Workshop C++ compiler. Unfortunately, this means
17900 that there are a lot of statements that contain string literals
17901 of the form (char*)"Blah".
17904 A variety of cleanup and performance optimization in the
17905 low-level DOH library. This seems to result in a speedup
17906 of 50-100% for preprocessing and other related tasks.
17909 Applied variable-wrapping bugfix patch contributed
17910 by Matthias Koeppe.
17913 Updated MzScheme support contributed by Oleg Tolmatcev.
17914 We now use a `Scheme_Type'-based structure to wrap pointers.
17917 Incorporated further Guile-support patch by Matthias Koeppe.
17918 Typemaps previously deleted have been re-added. There is now
17919 exception handling (see Doc/engineering.html). `SWIG_init' is now
17920 declared extern only for simple linkage. Some bugs were fixed.
17923 Incorporated MzScheme support contributed by Oleg Tolmatcev.
17924 This includes new directories Lib/mzscheme and Examples/mzscheme.
17927 Added Examples/guile and children. This is an adaptation of
17928 the same-named directory from the SWIG-1.1p5 distribution.
17929 Added Guile-specific section to Doc/engineering.html.
17932 Incorporated new guilemain.i by Martin Froehlich.
17933 Incorporated Guile-support rewrite patch by Matthias Koeppe.
17934 The command line option "-with-smobs" enables implementation of
17935 pointer type handling using smobs, the canonical mechanism for
17936 defining new types in Guile. Previous implementation (using
17937 strings) is at the moment still supported but deprecated. At
17938 some point, "-with-smobs" will be the default and no longer
17942 Added purify patches submitted by Ram Bhamidipaty.
17945 Added support for different Guile "linkage" schemes.
17946 Currently, "-Linkage hobbit" works.
17949 Version 1.3 Alpha 2 (March 1, 2000)
17950 ===================================
17953 Made SWIG ignore the 'mutable' keyword.
17956 Incorporated some patches to the Perl5 module related to
17957 the -hide option and the destruction of objects.
17958 Patch submitted by Karl Forner.
17961 Incorporated Guile support contributed by Matthias Koeppe.
17962 This includes a cpp macro in Lib/guile/guile.swg and the
17963 entire file Lib/guile/typemaps.i.
17966 Modified configure.in and Makefile.in files to support
17967 non-local build (useful in multi-arch environments).
17970 Incorporated Guile support contributed by Clark McGrew.
17971 This works with Guile 1.3, but since it depends heavily
17972 on the gh_ interface, it should work for all later versions.
17973 It has not been tested with versions before 1.3.
17974 WARNING: Code is unstable due to experimentation by ttn.
17977 A variety of performance improvements to the Python shadow
17978 class code generation. Many of these result in substantial
17979 runtime performance gains. However, these have come at
17980 a cost of requiring the use of Python 1.5.2. For older
17981 versions, use 'swig -noopt -python' to turn off these
17982 optimization features.
17984 Version 1.3 Alpha 1 (February 11, 2000)
17985 =======================================
17987 2/11/00 : Added 'void' to prototype of Python module initializer.
17988 Reported by Mark Howson (1/20/00).
17991 Modified the Python shadow class code to discard ownership of an
17992 object whenever it is assigned to a member of another object.
17993 This problem has been around for awhile, but was most recently
17994 reported by Burkhard Kloss (12/30/99).
17997 Added braces around macros in the exception.i library. Reported
17998 by Buck Hodges (12/19/99)
18001 Fixed bug in the constraints.i library. Reported by Buck
18005 The %native directive now generates Tcl8 object-style command calls.
18006 A full solution for Tcl7 and Tcl8 is still needed. Patch suggested
18007 by Mike Weiblen (11/29/99)
18010 Modified the typemap code to include the $ndim variable for arrays.
18011 Patch provided by Michel Sanner (11/12/99).
18014 Modified the Python module to raise a Runtime error if an attempt
18015 is made to set a read-only member of a shadow class. Reported by
18016 Michel Sanner (11/5/99).
18018 2/10/00 : The documentation system has been removed. However, it is likely
18019 to return at some point in the future.
18021 2/1/00 : Added a number of performance enhancements to the Python shadow
18022 classing and type-checking code. Contributed by Vadim Chugunov.
18024 1. Remove _kwargs argument from the shadow wrappers when -keyword
18025 option is not specified. This saves us a construction of keyword
18026 dictionary on each method call.
18028 def method1(self, *_args, **_kwargs):
18029 val = apply(test2c.PyClass1_method1, (self,) + _args, _kwargs)
18034 def method1(self, *_args):
18035 val = apply(test2c.PyClass1_method1, (self,) + _args)
18038 2. Incorporate self into the _args tuple. This saves at least one tuple
18039 allocation per method call.
18041 def method1(self, *_args):
18042 val = apply(test2c.PyClass1_method1, (self,) + _args)
18047 def method1(*_args):
18048 val = apply(test2c.PyClass1_method1, _args)
18051 3. Remove *Ptr classes.
18052 Assume that we are SWIGging a c++ class CppClass.
18053 Currently SWIG will generate both CppClassPtr class
18054 that hosts all methods and also CppClass that is derived
18055 from the former and contains just the constructor.
18056 When CppClass method is called, the interpreter will try
18057 to find it in the CppClass's dictionary first, and only then
18058 check the base class.
18060 CppClassPtr functionality may be emulated with:
18063 _new_instance = new.instance
18064 def CppClassPtr(this):
18065 return _new_instance(CppClass, {"this":this,"thisown":0})
18067 This saves us one dictionary lookup per call.
18069 <DB>The new module was first added in Python-1.5.2 so it
18070 won't work with older versions. I've implemented an
18071 alternative that achieves the same thing</DB>
18073 4. Use CObjects instead of strings for pointers.
18075 Dave: This enhancements result in speedups of up to 50% in some
18076 of the preliminary tests I ran.
18078 2/1/00 : Upgraded the Python module to use a new type-checking scheme that
18079 is more memory efficient, provides better performance, and
18080 is less error prone. Unfortunately, it will break all code that
18081 depends on the SWIG_GetPtr() function call in typemaps.
18082 These functions should be changed as follows:
18084 if (SWIG_GetPtr(string,&ptr,"_Foo_p")) {
18090 if (SWIG_ConvertPtr(pyobj, &ptr, SWIG_TYPE_Foo_p) == -1) {
18094 Note: In the new implementation SWIG_TYPE_Foo_p is no longer
18095 a type-signature string, but rather an index into a type
18096 encoding table that contains type information.
18097 *** POTENTIAL INCOMPATIBILITY ***
18100 Conditionaly compile experimental code with --enable-experiment
18102 Fix .cvsignore to ignore configrue & yacc generated files
18105 Apply automake everywhere
18106 Keep configure scripts so that people are not *forced* to autoconf
18107 Keep sources generated by yacc so that compilation without yacc
18109 Source/LParse/cscanner.c: change lyacc.h into parser.h to please
18110 default yacc generation rules.
18111 Use AC_CONFIG_SUBDIRS in configure.in instead of hand made script.
18112 Update all relevant .cvsignore to include .deps
18113 Fixed missing ; line 136 Source/Swig/swig.h
18116 Fixed a number of minor end-of-file parsing problems in the
18120 Added -freeze option that forces SWIG to freeze upon exit.
18121 This is only used as a debugging tool so that I can more
18122 easily examine SWIG's memory footprint.
18125 Added patch to guile module for supporting optional arguments
18126 Patch contributed by Dieter Baron.
18129 Added .cvsignore, Examples/.cvsignore, Source/DOH/Doh/.cvsignore
18130 Source/SWIG1.1/main.cxx: Fixed -I handling bug
18131 Source/Modules1.1/java.cxx: fixed char* -> const char* warnings that are
18132 errors when compiling with gcc-2.95.2
18133 Source/SWIG1.1/main.cxx: cast const char* to char* for String_replace
18134 token and rep should really be const.
18137 Added Harco's Java modules.
18140 Revoked the %ifdef, %ifndef, %endif, %if, %elif, and %else
18141 directives. These are no longer needed as SWIG now has a real
18143 *** POTENTIAL INCOMPATIBILITY ***
18146 Moved the documentation modules from the SWIG directory
18147 to the Modules directory (where they really should have been
18151 Removed the -stat option for printing statistics. The
18152 statistics reporting was inadequate and mostly broken
18154 *** POTENTIAL INCOMPATIBILITY ***
18157 Removed the -t option for reading a typemap file. More
18158 trouble than it's worth. Just include typemaps at the top
18159 of the interface file.
18160 *** POTENTIAL INCOMPATIBILITY ***
18163 Removed the %checkout directive.
18164 *** POTENTIAL INCOMPATIBILITY ***
18167 Removed the -ci option for file checkin. Too problematic
18168 to implement. Probably better to just put your SWIG library
18170 *** POTENTIAL INCOMPATIBILITY ***.
18173 Deleted the LATEX module. Sorry... Didn't know anyone
18174 who was using it. Besides, I'm looking to simplify
18175 the documentation system.
18176 *** POTENTIAL INCOMPATIBILITY ***
18179 Modified the ASCII documentation module to use a .txt
18180 suffix for its output file instead of .doc.
18183 Added the long-lost SWIG preprocessor back to the system.
18184 It should be enabled by default. Raw preprocessed output
18185 can be viewed using swig -E file.i.
18186 *** NEW FEATURE ***
18188 1/11/00 : beazley and djmitche
18189 Completely reorganized the SWIG directory structure. The
18190 basic organization is now:
18192 Source/ SWIG source code
18193 Lib/ SWIG library files (swig_lib)
18197 More directories will be added as needed.
18199 12/08/99: Loic Dachary (loic@senga.org)
18200 Enhanced package handling for perl5 and c++.
18202 With new option -hide Foo::Bar, every perl5 object (Frob) is
18203 qualified by Foo::Bar::Frob. The package name is solely used
18204 to encapsulate C/C++ wrappers output in <module>_wrap.c and the
18205 corresponding perl package in <module>.pm. Note that a package
18206 name may contain :: (Frob::Nitz) and will be relative to the
18207 package name provided by -hide (Foo::Bar::Frob::Nitz).
18209 In *_wrap.c, SWIG_init macro is used. Was previously defined
18210 but not used and simplifies code.
18212 Added typemap(perl5,perl5in) and typemap(perl5,perl5out) that
18213 do the equivalent of typemap(perl5,in) and typemap(perl5,out)
18214 but contain perl code and applies to wrappers generated by
18217 Lacking proper regression tests I used
18218 Examples/perl5/{c++,constraint,defarg,except,
18219 graph/graph[1234],multinherit,nested,shadow,simple,tree,
18220 typemaps/{argv,argv2,arraymember,database,file,ignore,integer,
18221 output,passref,reference,return}}/. I ran swig with and without
18222 the patches, diff the generatedsources, run the .pl files
18223 and checked that the results are identical. In all those examples
18226 11/21/99: Modified the Tcl module to provide full variable linking capabilities
18227 to all datatypes. In previous versions, a pair of accessor functions
18228 were created for datatypes incompatible with the Tcl_LinkVar() function.
18229 Now, we simply use variable traces to support everything. This may
18230 break scripts that rely upon the older behavior.
18231 *** POTENTIAL INCOMPATIBILITY ***
18233 11/21/99: Added slight tweak to wrapper generator to collect local variables
18234 of similar type. Produces somewhat more compact wrapper code.
18236 11/20/99: Modified the Tcl module to use SWIG_GetArgs() to parse
18237 arguments. This is a technique borrowed from Python in which
18238 arguments are converted using a format string convention similiar
18239 to fprintf(). This results in a *substantial* reduction in the
18240 size of the resulting wrapper code with only a modest runtime overhead
18241 in going through the extra conversion function.
18243 11/13/99: Completely rewrote the class/structure generation code for the
18244 Tcl module. Now, a small set of runtime functions are used
18245 to implement the functionality for all classes (instead of a
18246 massive amount of runtime code being generated for each class).
18247 Class specific information is simply encoded in a series of
18248 static tables. This results in a *HUGE* reduction in wrapper
18249 code size--especially for C++.
18251 11/13/99: Removed the -tcl (Tcl 7.x) module. Tcl 8.0 is now several
18252 years old and the defacto standard--no real reason to keep
18253 supporting the old version at this point.
18255 11/13/99: Cleaned up -c option for Python module. The pyexp.swg file
18258 11/13/99: Fixed external declarations to work better with static linking
18259 on Windows. Static linking should now be possible by defining
18260 the -DSTATIC_LINK option on the command line. Patch contributed
18261 by Alberto Fonseca.
18263 11/5/99 : Fixed an obscure code generation bug related to the generation
18264 of default constructors. Bug reported by Brad Clements.
18266 11/5/99 : Fixed a few memory problems found by purify.
18268 11/5/99 : Officially deprecated the -htcl, -htk, and -plugin options
18269 from the Tcl and Tcl8 modules.
18271 10/26/99: Removed unused variable from python/typemaps.i. Patch
18272 contributed by Keith Davidson.
18274 8/16/99 : Added _WIN32 symbol to libraries to better support Windows.
18276 8/16/99 : Deprecated the Perl4 module. It is no longer included in the
18277 distribution and no longer supported. In the entire 3 years SWIG
18278 has been around I never received a single comment about it so I'm
18279 assuming no one will miss it...
18281 8/16/99 : Modified the type-checking code to register type mappings using a
18282 table instead of repeated calls to SWIG_RegisterMapping(). This
18283 reduces the size of the module initialization function somewhat.
18285 8/15/99 : Cleaned up the pointer type-checking code in the Tcl module.
18287 8/15/99 : Many changes to the libraries to support runtime libraries.
18289 8/13/99 : Eliminated C++ compiler warning messages about extern "C" linkage.
18291 8/13/99 : Some cleanup of Python .swg files to better support runtime libraries
18294 8/13/99 : Modified the %pragma directive to attach pragmas declared inside
18295 a class definition to the class itself. For example:
18299 %pragma(python) addtomethod = "insert:print `hello world'"
18303 Most people don't need to worry about how this works. For people
18304 writing backend modules, class-based pragmas work like this:
18306 lang->cpp_open_class() // Open a class
18307 lang->cpp_pragma() // Supply pragmas
18308 ... // Emit members
18310 lang->cpp_close_class() // Close the class
18312 All of the pragmas are passed first since they might be used to
18313 affect the code generation of other members. Please see
18314 the Python module for an example. Patches contributed
18317 8/13/99 : Patch to Python shadow classes to eliminate ignored
18318 exception errors in destructors. Patch contributed
18321 8/11/99 : Minor patch to swig_lib/python/swigptr.swg (added SWIGSTATIC
18322 declaration). Patch contributed by Lyle Johnson.
18324 8/11/99 : Added FIRSTKEY/NEXTKEY methods to Perl5 shadow classes
18325 Patch contributed by Dennis Marsa.
18327 8/11/99 : Modified Python module so that NULL pointers are returned
18328 and passed as 'None.' Patch contributed by Tal Shalif.
18330 8/10/99 : Fixed missing 'int' specifiers in various places.
18332 8/10/99 : Added Windows makefile for Runtime libraries. Contributed
18335 8/10/99 : Fixed minor problem in Python runtime makefile introduced
18336 by keyword arguments.
18338 8/8/99 : Changed $target of perl5(out) typemap from ST(0) to
18339 ST(argvi). Patch contributed by Geoffrey Hort.
18341 8/8/99 : Fixed bug in typemap checking related to the ANY keyword
18342 in arrays and ignored arguments. Error reported by
18345 8/8/99 : %enabledoc and %disabledoc directives can now be used
18346 inside class/structure definitions. However, no check
18347 is made to see if they are balanced (i.e., a %disabledoc
18348 directive inside a class does not have to have a matching
18349 %enabledoc in the same class).
18351 8/8/99 : Keyword argument handling is now supported in the Python
18352 module. For example:
18354 int foo(char *bar, int spam, double x);
18356 Can be called from Python as
18358 foo(x = 3.4, bar="hello", spam=42)
18360 To enable this feature, run SWIG with the '-keyword' command
18361 line option. Mixing keyword and default arguments
18362 should work as well. Unnamed arguments are assigned names
18363 such as "arg1", "arg2", etc...
18365 *** POTENTIAL INCOMPATIBILITY ***
18366 Functions with duplicate argument names such as
18367 bar(int *OUTPUT, int *OUTPUT) will likely cause problematic
18368 wrapper code to be generated. To fix this, use different
18369 names or use %apply to map typemaps to alternate names.
18371 8/8/99 : Handling of the 'this' pointer has been changed in Python shadow
18372 classes. Previously, dereferencing of '.this' occured in the
18373 Python shadow class itself. Now, this step occurs in the C
18374 wrappers using the following function:
18376 SWIG_GetPtrObj(PyObject *, void **ptr, char *type)
18378 This function can accept either a string containing a pointer
18379 or a shadow class instance with a '.this' attribute of
18380 appropriate type. This change allows the following:
18382 1. The real shadow class instance for an object is
18383 passed to the C wrappers where it can be examined/modified
18386 2. Handling of default/keyword arguments is now greatly
18389 3. The Python wrapper code is much more simple.
18391 Plus, it eliminated more than 300 lines of C++ code in the
18394 *** CAVEAT : This requires the abstract object interface.
18395 It should work with Python 1.4, but probably nothing older
18399 8/8/99 : Fixed handling of "const" and pointers in classes. In particular,
18400 declarations such as
18408 are handled as assignable variables as opposed to constant
18409 values (this is the correct behavior in C/C++). Note:
18410 declarations such as "char *const msg" are still unsupported.
18411 Constants declared at the global level using const are also
18412 broken (because I have a number of interfaces that rely upon
18415 *** POTENTIAL INCOMPATIBILITY *** This may break interfaces that
18416 mistakenly treat 'const char *' types as constant values.
18418 8/8/99 : Modified the parser to support bit-fields. For example:
18421 unsigned int is_keyword : 1;
18422 unsigned int is_extern : 1;
18423 unsigned int is_static : 1;
18426 Bit-fields can only be applied to integer types and their
18427 are other restrictions. SWIG performs no such type-checking
18428 (although the C compiler will catch problems when it tries to
18429 compile the wrapper code).
18431 8/8/99 : Removed trailing space of $basetype substitution in typemaps.
18432 This is to allow things like this:
18434 %typemap(python, argout) spam** OUTPUT{
18436 char* a = "$basetype_p";
18440 (Patch suggested by Nathan Dunfield).
18442 6/22/99 : Made a very slight tweak to the Perl5 shadow class
18443 code that allows typemaps to alter the return type
18444 of objects (to support polymorphic types). Patch
18445 contributed by Drake Diedrich.
18447 4/8/99 : Fixed null pointer handling bug in Perl module.
18448 Patch contributed by Junio Hamano.
18450 3/17/99 : Fixed bug in perl5ptr.swg for ActiveState Perl.
18451 Patch contributed by Greg Anderson.
18453 2/27/99 : Eliminated segmentation fault when Swig runs on
18456 2/27/99 : Added patch to Guile module to eliminate unused
18457 variables. Contributed by Mike Simons.
18459 2/27/99 : Fixed problem with %addmethods returning references.
18461 2/27/99 : Fixed Runtime/Makefile. Patch contributed by
18464 2/27/99 : Incorporated patches to the type-checker.
18466 2/27/99 : Fixed problem with -exportall switch and shadow classes
18467 in Perl5 module. Patch contributed by Dennis Marsa.
18469 2/27/99 : Modified Perl5 module to recognize 'undef' as a NULL char *.
18470 Patch contributed by Junio Hamano.
18472 2/27/99 : Fixed the Perl5 module to support the newer versions of
18473 ActiveState Perl for Win32.
18475 2/27/99 : Fixed the include order of files specified with the
18478 2/5/98- : Dave finishes his dissertation, goes job hunting, moves to
18479 2/5/99 Chicago and generally thrashes about.
18481 Version 1.1 Patch 5 (February 5, 1998)
18482 ======================================
18484 2/4/98 : Fixed a bug in the configure script when different package
18485 locations are specified (--with-tclincl, etc...).
18487 2/2/98 : Fixed name-clash bug related to the switch to C macros for accessor
18488 functions. The new scheme did not work correctly for objects
18489 with members such as 'obj', 'val', etc... Fixed the bug by
18490 appending the word 'swig' to macro argument names. Patch
18491 contributed by Rudy Albachten.
18493 2/2/98 : Slight fix to the Perl5 module to eliminate warning messages
18494 about 'varname used only once : possible typo'. Fix
18495 contributed by Rudy Albachten.
18497 1/9/98 : Fixed a bug in the Perl 5 module related to the creation of
18498 constants and shadow classes.
18500 1/9/98 : Fixed linking bug with Python 1.5 embed.i library file.
18502 Version 1.1 Patch 4 (January 4, 1998)
18503 =====================================
18505 1/4/98 : Changed structured of the Examples directory to be more friendly
18508 1/4/98 : Added the function Makefile.win.bc for compiling the examples
18511 1/4/98 : Slight change to the perl5 module and C++ compilation. The
18512 <math.h> library is now included before any Perl headers
18513 because Perl the extern "C" linkage of math.h screws alot
18514 of things up (especially on Windows).
18516 1/2/98 : Change to the Python module that reduces the number of constants
18517 created by C++ classes, inheritance, and shadow classes. This
18518 modification may introduce a few slight incompatibilities if
18519 you attempt to use the non-shadow class interface with shadow
18520 classes enabled. Patch contributed by Mike Romberg.
18522 1/2/98 : Support for Tcl 8.0 namespaces has been added. This *replaces*
18523 the original SWIG mechanism that assumed [incr Tcl] namespaces.
18524 To use namespaces, simply run SWIG with the following options
18526 swig -tcl -namespace foo.i
18528 This places everything in a namespace that matches
18531 swig -tcl -namespace -prefix bar foo.i
18533 This places everything in the namespace 'bar'
18535 The use of namespaces is new in Tcl 8.0. However, the wrapper code
18536 generated by SWIG will still work with all versions of Tcl newer
18537 than and including Tcl 7.3/Tk3.6 even if the -namespace option is
18540 *** POTENTIAL INCOMPATIBILITY ***
18541 This change may break existing applications that relied on the
18542 -prefix and -namespace options.
18544 1/2/98 : Added the following constants to the Tcl wrapper code
18546 SWIG_name - Name of the SWIG module
18547 SWIG_prefix - Prefix/namespace appended to command names
18548 SWIG_namespace - Name of the namespace
18550 SWIG library writers can use these to their advantages.
18552 1/2/98 : Fixed a bug in the Tcl8 module related to the creation of
18553 pointer constants (the function SWIG_MakePtr was missing from
18556 1/2/98 : Added the consthash.i library file to the Tcl and Tcl8 modules.
18558 1/1/98 : Changed and cleaned up the Python typemaps.i file. The following
18559 significant changes were made :
18561 1. The OUTPUT typemap now returns Python tuples instead of
18562 lists. Lists can be returned as before by using the
18563 L_OUTPUT type. If compatibility with older versions
18564 is needed, run SWIG with the -DOUTPUT_LIST option.
18566 2. The BOTH typemap has been renamed to INOUT. For backwards
18567 compatibility, the "BOTH" method still exists however.
18569 3. Output typemaps now generate less code than before.
18571 Changes to typemaps.i may break existing Python scripts that assume
18572 output in the form of a list.
18573 *** POTENTIAL INCOMPATIBILITY ***
18575 12/31/97: Fixed long overdue problems with the testing scripts and certain
18576 makefiles that required the use of the bash shell. Everything should
18577 work properly with the standard Bourne shell (sh) now.
18579 12/31/97: Modified typemaps to allow $basetype as a valid local variable.
18580 This allows for all sorts of bizarre hackish typemaps that
18581 do cool things. Patch contributed by Dominique Dumont.
18583 12/31/97: Switched accessor functions generated for member data to
18584 C preprocessor macros (except in cases involving typemaps
18587 12/31/97: Fixed a bug related to C++ member data involving references.
18589 12/31/97: Changed accessor functions for C++ member functions to
18590 preprocessor macros. This cleans up the wrapper code
18591 and results in fewer function definitions.
18593 12/31/97: Changed the default C constructor to use calloc() instead
18596 12/30/97: Changed the creation of constants in the Perl5 module.
18597 For all practical purposes, they should work in exactly the
18598 same way as before except that they now require much less
18599 wrapper code. Modules containing large numbers of
18600 constants may see greater than a 50% reduction in wrapper
18603 12/30/97: Modified the Python module to be more intelligent about the
18604 creation of constants. SWIG no longer generates redundant
18605 global variables and the size of the module initialization
18606 function should be reduced. (Many thanks to Jim Fulton).
18608 12/29/97: Fixed a bug in C++ code generation related to member functions,
18609 default arguments, and references.
18611 12/29/97: Fixed configure script and a few makefiles to support Python 1.5
18613 12/29/97: Added 'embed15.i' library file. This file should be used to
18614 staticly link versions of Python 1.5. To make it the default,
18615 simply copy 'swig_lib/python/embed15.i' to 'swig_lib/python/embed.i'
18617 Version 1.1 Patch 3 (November 24, 1997)
18618 ========================================
18620 11/23/97: Fixed a bug in the Perl5 module with shadow classes and
18621 static class functions that return class instances.
18622 Note : The fix for this bug requires a slight restructuring of
18623 of the .pm files created by SWIG.
18625 11/23/97: Fixed a bug in the Tcl/Tcl8 modules related to variable linking
18626 of character arrays. If you declared a global variable 'char foo[10]',
18627 the generated wrapper code would either cause a segmentation fault
18628 immediately upon loading or weird memory corruption elsewhere.
18629 This should now be fixed although character arrays can only be
18632 11/23/97: Fixed a bug with the %import directive that caused it to
18633 fail if files were imported from directories other than
18634 the current working directory.
18636 11/23/97: Fixed incorrect diagnostic message in the ASCII documentation
18639 11/23/97: Changed the behavior of the -o option when used with shadow
18640 classes. If -o was used to specify both the pathname and filename
18641 of SWIG's output such as
18643 swig -o /home/swig/wrapper.c -shadow -perl5 foo.i
18645 The wrapper code would be placed the file specified with -o,
18646 but the .pm file and documentation would be placed in the
18647 directory where SWIG was run. Now, these files are placed
18648 in the same directory as the file specified with the -o option.
18649 This change is also needed for proper operation on the
18652 11/23/97: Added a 'this()' method to Perl5 shadow classes. This can
18653 be used to return the normal pointer value from a shadow
18654 class that is represented as a tied hash. To use just
18655 invoke as a method like this :
18657 $l = new List; # Create an object
18658 $ptr = $l->this(); # Get the normal pointer value
18660 *** NEW FEATURE ***
18662 11/23/97: Fixed the Tcl 8 pointer.i library file (which was completely
18665 11/23/97: Modified the Perl5 type-checker to fix a few problems
18666 with global variables of pointer types and to allow
18667 tied hashes to be used interchangably with normal
18670 11/23/97: Modified the typemap mechanism to allow output
18671 typemaps of type 'void'. These were ignored previously,
18672 but now if you specify,
18674 %typemap(lang,out) void {
18675 ... return a void ...
18678 You can change or assign a return value to the function.
18680 11/23/97: Fixed processing of 'bool' datatypes in the Python module.
18682 11/23/97: Fixed minor parsing error with C++ initializers. For example,
18684 class B : public A {
18690 11/23/97: Fixed the Tcl8 module so that C functions that call back into
18691 Tcl don't corrupt the return result object (SWIG was gathering
18692 the result object too early which leads to problems if subsequent
18693 Tcl calls are made).
18695 11/23/97: Fixed a code generation bug in the Python module when two or
18696 more output parameters were used as the first arguments of a
18697 function. For example :
18699 %include typemaps.i
18700 void foo(double *OUTPUT, double *OUTPUT, double a);
18702 Previously, doing this resulted in the creation of an
18703 extraneous comma in the output, resulting in a C syntax error.
18705 11/22/97: Fixed a bug when template handling that was stripping whitespace
18706 around nested templates. For example :
18710 was getting munged into Foo<Bar>> which is a syntax error in
18711 in the C++ compiler.
18713 11/22/97: Fixed bugs in the Borland C++ makefiles.
18715 11/22/97: Fixed memory corruption bug when processing integer
18716 arguments in Tcl8 module.
18718 11/21/97: Fixed a bug in the Runtime/Makefile related to Tcl 8.
18720 11/21/97: Fixed a bug with the %new directive and Perl5 shadow classes.
18721 No longer generates a perl syntax error.
18723 11/9/97 : Changed a strncpy() to strcpy() in the pointer type-checker.
18724 This results in a substantial performance improvement in
18727 10/29/97: Fixed a bug in the code generation of default arguments and
18728 user-defined types. For example :
18730 void foo(Vector a, Vector b = d);
18732 should now work properly.
18734 Version 1.1 Patch 2 (September 4, 1997)
18735 =======================================
18737 9/4/97 : Fixed problem with handling of virtual functions that
18738 was introduced by some changes in the C++ module.
18740 Version 1.1 Patch 1 (August 27, 1997)
18741 =====================================
18743 8/26/97 : Fixed compilation and run-time bugs with Tcl 8.0 final.
18745 8/21/97 : Fixed code generation bug with arrays appearing as arguments
18746 to C++ member functions. For example :
18750 void Bar(int a[20][20]);
18753 There is still a bug using arrays with added methods
18756 8/20/97 : Fixed a bug with generating the code for added methods
18757 involving pass-by-value.
18759 8/19/97 : Modified the typemapper to substitute the '$arg' value
18760 when declaring local variables. For example :
18762 %typemap(in) double * (double temp_$arg) {
18763 ... do something ...
18766 When applied to a real function such as the following :
18768 void foo(double *a, double *b, double *result);
18770 three local variables will be created as follows :
18774 double temp_result;
18776 This can be used when writing multiple typemaps that need
18777 to access the same local variables.
18780 7/27/97 : Fixed a variety of problems with the %apply directive and arrays.
18781 The following types of declarations should now work :
18783 %apply double [ANY] { Real [ANY] };
18784 %apply double [4] { double [10] };
18786 A generic version of apply like this :
18788 %apply double { Real };
18790 should now work--even if arrays involving doubles and Reals are
18793 7/27/97 : Changed warning message about "Array X has been converted to Y" to
18794 only appear if running SWIG in verbose mode.
18796 7/27/97 : Added the variables $parmname and $basemangle to the typemap
18797 generator. $parmname is the name of the parameter used
18798 when the typemap was matched. It may be "" if no parameter
18799 was used. $basemangle is a mangled version of the base
18800 datatype. Sometimes used for array handling.
18802 7/27/97 : Changed the behavior of output arguments with Python shadow classes.
18803 Originally, if a function returned an object 'Foo', the shadow class
18804 mechanism would create code like this :
18807 val = FooPtr(shadowc.return_foo())
18811 The problem with this is that typemaps allow a user to redefine
18812 the output behavior of a function--as a result, we can no longer
18813 make any assumptions about the return type being a pointer or
18814 even being a single value for that matter (it could be a list,
18815 tuple, etc...). If SWIG detects the use of output typemaps
18816 (either "out" or "argout") it returns the result unmodified like
18820 val = shadowc.return_foo()
18823 In this case, it is up to the user to figure out what to do
18824 with the return value (including the possibility of converting it
18825 into a Python class).
18827 7/26/97 : Fixed a parsing problem with types like 'unsigned long int',
18828 'unsigned short int', etc...
18830 7/24/97 : Minor bug fix to Tcl 8 module to parse enums properly. Also
18831 fixed a memory corruption problem in the type-checker.
18832 (patch contributed by Henry Rowley.
18834 7/24/97 : Added Python-tuple typemaps contributed by Robin Dunn.
18836 7/24/97 : Incorporated some changes to the Python module in support of
18837 Mark Hammond's COM support. I'm not entirely sure they
18838 work yet however. Needs documentation and testing.
18840 7/24/97 : Fixed code generation bugs when structures had array members
18841 and typemaps were used. For example :
18843 %typemap(memberin) double [20][20] {
18844 ... get a double [20][20] ...
18850 Originally, this would generate a compiler-type error when
18851 the wrapper code was compiled. Now, a helper function like
18852 this is generated :
18854 double *Foo_a_set(Foo *a, double val[20][20]) {
18855 ... memberin typemap here ...
18856 return (double *) val;
18859 When writing typemaps, one can assume that the source variable
18860 is an array of the *same* type as the structure member. This
18861 may break some codes that managed to work around the array bug.
18862 *** POTENTIAL INCOMPATIBILITY ***
18864 7/13/97 : Fixed bug in Perl5 module when using C global variables that
18865 are pointers. When used in function calls and other operations,
18866 the value of the pointer would be invalid---causing core
18867 dumps and other problems. SWIG implements global variables
18868 using Perl magic variables. As it turns out, the error
18869 was caused by the fact that the pointer-extraction code
18870 was somehow bypassing the procedure used to resolve magical
18871 variables (hence, leaving the value undefined). To fix
18872 the problem, SWIG now explicitly resolves magic before
18873 extracting pointer values.
18875 7/12/97 : Eliminated the last remnants of free() and malloc() from
18878 7/12/97 : Fixed parsing problems with typemaps involving arrays and
18879 temporary variables of arrays. Also made it possible for
18880 SWIG to handle typemaps like this :
18882 %typemap(in) double [ANY] (double temp[$dim0]) {
18883 ... store data in temp[$dim0] ...
18886 Not only does this typemap match any double [] array, it
18887 creates a local variable with precisely the right dimensions.
18888 (ie. $dim0 gets filled in with the real number of dimensions).
18889 Of course, off the record, this will be a way to add more
18890 functionality to the typemaps.i libraries.
18892 7/9/97 : Fixed some problems with Perl5, static linking, and shadow
18893 classes. When statically linking multiple modules together, write
18894 a top-level interface file like this when shadow classes are not
18897 %module swig, foo, bar, glob;
18898 %include perlmain.i
18900 When shadow classes are used, the module names have an extra 'c'
18901 appended so it should read as :
18903 %module swig, fooc, barc, globc;
18904 %include perlmain.i
18906 When linking multiple modules, consider using the SWIG runtime
18909 7/8/97 : Incorporated fixed versions of the Borland C++ Makefiles.
18911 7/8/97 : First cut at trying to eliminate excessive compiler warnings.
18912 As it turns out, alot of warnings go away if you just make
18913 declarations like this
18915 clientData = clientData;
18917 in the resulting wrapper code. Most compilers should just
18918 ignore this code (at least would can hope).
18920 7/8/97 : Fixed bizarre code generation bug with typemaps and C++ classes.
18921 In some cases, typemaps containing printf formatting strings such as
18923 %typemap(memberout) int * {
18927 Would generate completely bogus code with garbage replacing
18928 the '%d'. Caused by one faulty use of printf (wasn't able to find
18929 any other occurences).
18931 7/7/97 : Fixed bug in Python shadow class generation with non-member
18932 functions that are returning more than one value.
18934 7/7/97 : Incorporated modifications to make SWIG work with Guile 1.2.
18935 Still need to test it out, but it is rumored to work.
18937 7/2/97 : Fixed some bugs related to output arguments and Python shadow
18938 classes. If an output argument is detected, SWIG assumes
18939 that the result is a list and handles it appropriately.
18940 If the normal return type of an function is an object,
18941 it will be converted into a shadow class as before, but
18942 with the assumption that it is the first element of a
18943 list. *** NOTE : This behavior has been subsequently changed ***
18945 6/29/97 : Changed EXPORT to SWIGEXPORT in all of the language modules.
18946 Should provide better compatibility with Windows.
18948 6/29/97 : Modified Python shadow classes so that output arguments
18949 work correctly (when typemaps are used).
18951 Version 1.1 (June 24, 1997)
18952 ===========================
18954 6/24/97 : Fixed Objective-C constructor bug when working with Perl5
18957 6/23/97 : Fixed some parsing problems with Objective-C. Declarations
18958 such as the following should work now :
18960 - foo : (int) a with: (int) b;
18962 6/22/97 : Added SWIG Runtime library. This library contains
18963 the SWIG pointer type-checker and support functions
18964 that are normally included in every module. By using
18965 the library, it is easier to work with multiple SWIG
18968 6/22/97 : Fixed minor bug in Perl5 module related to static linking
18969 of multiple modules.
18971 6/22/97 : Fixed some bugs with the %import directive. When used with
18972 Perl5 shadow classes, this generates a 'require' statement
18973 to load in external modules.
18975 6/22/97 : Added -swiglib option. This prints out the location of the
18976 SWIG library and exits. This option is only really useful to
18977 configuration tools that are looking for SWIG and its library
18978 location (e.g. autoconf, configure, etc...).
18980 6/21/97 : Fixed export bug with Perl5.004 on Windows-NT.
18982 6/20/97 : Minor change to code generation of class/structure members in
18983 order to work better with typemaps. Should have no noticable
18984 impact on existing SWIG modules.
18986 6/19/97 : Added -t option. This allows SWIG to load a typemap file before
18987 processing any declarations. For example :
18989 swig -t typemaps.i -python example.i
18991 At most, only one typemap file can be specified in this manner.
18992 *** NEW FEATURE ***
18994 6/18/97 : Need a Makefile fast? Type
18996 swig [-tcl, -perl5, -python] -co Makefile
18998 and you will get a Makefile specific to that target language.
18999 You just need to modify it for your application and you're
19002 6/18/97 : Completed the -ci option. This option checks a file into the
19003 SWIG library. It should be used in conjunction with a
19004 language option. For example :
19006 swig -tcl -ci foobar.i
19008 Checks the file foobar.i into the Tcl part of the library.
19009 In order to check a file into the general library (accessible
19010 to all languages modules), do the following
19012 swig -ci -o ../foobar.i foobar.i
19014 (Admittedly this looks a little strange but is unavoidable).
19015 The check-in option is primarily designed for SWIG maintenance
19016 and library development. The command will fail if the user does
19017 not have write permission to the SWIG library. Third party library
19018 extensions can easily install themselves by simply providing
19019 a shell script that uses 'swig -ci' to install the appropriate
19020 library files. It is not necessary to know where the SWIG library
19021 is located if you use this mechanism.
19022 *** NEW FEATURE ***
19024 6/16/97 : Fixed a bug in shadow class generation when %name() was applied
19025 to a class definition. Unfortunately, fixing the bug required
19026 a change in the Language C API by adding an extra argument to
19027 the Language::cpp_class_decl() function. This may break
19028 SWIG C++ extensions.
19029 *** POTENTIAL INCOMPATIBILITY ***
19031 6/15/97 : Added a warning message if no module name is specified with the
19032 %module directive or -module option.
19034 6/15/97 : Fixed line number bug when reporting errors for undefined
19037 6/15/97 : Added new %rename directive. This allows the forward declaration
19038 of a renaming. For example :
19040 %rename OldName NewName;
19045 Unlike %name, %rename will rename any occurence of the old name.
19046 This applies to functions, variables, class members and so forth.
19047 There is no way to disable %rename once set, but you can change the
19048 name by redeclaring it to something else.
19049 *** NEW FEATURE ***
19051 6/15/97 : Improved the implementation of the %name directive so that it
19052 could be used with conditional compilation :
19059 6/15/97 : Added support for functions with no return datatype. In this case,
19060 SWIG assumes a return type of 'int'.
19062 6/11/97 : Improved error reporting in the parser. It should be a little
19063 less sensitive to errors that occur inside class definitions
19064 now. Also reports errors for function pointers.
19066 6/11/97 : Made '$' a legal symbol in identifiers. This is to support
19067 some Objective-C libraries. Some compilers (such as gcc) may also
19068 allow identifiers to contain a $ in C/C++ code as well (this is
19069 an obscure feature of C). When '$' appears in identifier, SWIG
19070 remaps it to the string '_S_' when creating the scripting language
19071 function. Thus a function 'foo$bar' would be called 'foo_S_bar'.
19073 6/11/97 : Fixed bug in Python shadow classes with __repr__ method. If
19074 supplied by the user, it was ignored, but now it should work.
19076 6/9/97 : Fixed the Tcl 8.0 module to work with Tcl 8.0b1. SWIG is no
19077 longer compatible with *any* alpha release of Tcl 8.0.
19078 *** POTENTIAL INCOMPATIBILITY ***
19080 6/7/97 : Put a maximal error count in (currently set to 20). SWIG will bail out
19081 if it generates more errors than this (useful for preventing SWIG
19082 from printing 4000 syntax errors when it gets confused).
19084 6/7/97 : Fixed segmentation fault when parsing variable length arguments.
19086 6/7/97 : Minor change to Perl5 module. C++ static functions are now
19087 put in the same package as their class when using shadow classes.
19089 6/7/97 : Centralized the naming of functions, members, wrappers etc... By
19090 centralizing the naming scheme, it should be possible to make
19091 some multi-file optimizations. Also, it should be possible to
19092 change SWIG's naming scheme (perhaps a new feature to be added
19095 6/2/97 : Added 'arginit' typemap. This can be used to assign initial values
19096 to function arguments. Doing so makes it somewhat easier to detect
19097 improper argument passing when working with other typemaps.
19099 6/2/97 : Fixed code generation bug when read-only variables were inherited
19100 into other classes. Under inheritance, the variables would
19101 become writable, but this has now been corrected.
19103 5/30/97 : An empty %name() directive is no longer allowed or supported.
19104 This directive was originally used to strip the prefix
19105 off of a class or structure. Unfortunately, this never really
19106 seemed to work right and it complicated the C++ code generator
19107 significantly. As far as I can tell no one uses it, so it
19108 is now history. *** POTENTIAL INCOMPATIBILITY ***
19110 5/28/97 : Fixed a parsing bug with #define and C++ comments. Declarations
19111 such as the following now work properly :
19113 #define CONST 4 // A Comment
19115 5/28/97 : Made some performance improvements to the SWIG String class.
19116 (only affects the SWIG compiler itself).
19118 5/28/97 : Modified the parser to skip template definitions and issue a
19121 5/28/97 : Preliminary support for parameterized types added (ie. templates).
19122 Types such as the following should pass through the SWIG compiler
19124 void foo(vector<complex> *a, vector<double> *b);
19126 When used, the entire name 'vector<complex>' becomes the name
19127 of the datatype. Due to space limitations in datatype
19128 representations, the name should not exceed 96 characters.
19130 Note : This is only part of what is needed for template support.
19131 Template class definitions are not yet supported by SWIG.
19133 The template notation above may also be used when specifying
19134 Objective-C protocol lists.
19135 *** NEW FEATURE ***
19137 5/24/97 : First cut at Objective-C support added. As it turns out, almost
19138 everything can be handled with only a few minor modifications to
19140 *** NEW FEATURE ***
19142 5/23/97 : Fixed repeated definition bug in multiple inheritance handling
19143 when multiple base classes share a common base class (ie.
19146 5/21/97 : Fixed rather embarrassing typo that worked its way into the
19147 Tests/Build directory.
19149 5/19/97 : Fixed code generation bug when using native methods and
19150 shadow classes with Python and Perl5 modules.
19152 5/19/97 : Modified the %apply directive slightly so that it would work
19153 with pointers a little better. For example :
19155 %apply unsigned long { DWORD };
19157 Applies *all* typemaps associated with "unsigned long" to
19158 "DWORD". This now includes pointers to the two datatypes.
19159 For example, a typemap applied to "unsigned long **" would
19160 also be applied to any occurrence of "DWORD **" as well.
19162 5/19/97 : Fixed an ownership assignment bug in the Perl5 module when
19163 class members were returning new objects belonging to
19166 5/17/97 : Added a few more typemap variables.
19168 $name - Name of function/variable/member
19169 $basetype - Base datatype (type without pointers)
19170 $argnum - Argument number
19172 5/16/97 : Fixed embarrassing underscore error in local variable
19175 5/16/97 : Fixed namespace clash bug in parameterized typemaps
19176 when creating arrays as new local variables.
19178 5/15/97 : Fixed some bugs with inheritance of added methods across
19179 multiple files. SWIG now uses names of base classes
19180 when generating such functions.
19182 5/14/97 : Finished support for default typemaps. Primarily used
19183 internally, they can be used to match the basic
19184 built-in datatypes used inside of SWIG. You can
19185 specify them in interface files as well like this :
19187 %typemap(tcl,in) int SWIG_DEFAULT_TYPE {
19188 $target = atoi($target);
19191 Unlike normal typemaps, this default map will get applied
19192 to *all* integer datatypes encountered, including those
19193 renamed with typedef, etc...
19195 5/13/97 : Fixed substring bug in type checker.
19197 5/12/97 : Fixed bug in parameterized typemaps when declaring local
19198 variables of structures.
19200 Version 1.1 Beta6 (May 9, 1997)
19201 ===============================
19203 5/9/97 : Fixed bizarre NULL pointer handling bug in Perl5 module.
19205 5/8/97 : Fixed mysterious segmentation fault when running SWIG on an
19208 5/7/97 : The code generator will now replace the special symbol "$cleanup"
19209 with the cleanup code specified with the "freearg" typemap.
19210 This change needed to properly manage memory and exceptions.
19212 5/5/97 : Added the 'typemaps.i' library file. This contains a
19213 variety of common typemaps for input values, pointers,
19216 5/5/97 : Changed behavior of "argout" typemap in Python module.
19217 Old versions automatically turned the result into a
19218 Python list. The new version does nothing, leaving the
19219 implementation up to the user. This provides more flexibility
19220 but may break older codes that rely on typemaps.
19221 *** POTENTIAL INCOMPATIBILITY ***
19223 5/5/97 : Fixed bug in Python module related to the interaction of
19224 "argout" and "ignore" typemaps.
19226 5/5/97 : Fixed bug in Python module that would generate incorrect code
19227 if all function arguments are "ignored".
19229 5/4/97 : Added %apply and %clear directives. These form a higher level
19230 interface to the typemap mechanism. In a nutshell, they
19231 can be used to change the processing of various datatypes without
19232 ever having to write a typemap. See the SWIG documentation
19233 for more details. ** NEW FEATURE **
19235 5/4/97 : Added a local variable extension to the typemap handler.
19238 %typemap(tcl,in) double *(double temp) {
19239 temp = atof($source);
19243 In this case, 'temp' is a local variable that exists
19244 in the entire wrapper function (not just the typemap
19245 code). This mechanism provides better support for
19246 certain types of argument handling and also makes it
19247 possible to write thread-safe typemaps. Any number
19248 local variables can be declared by supplying a comma
19249 separated list. Local variables are guaranteed to be
19250 unique, even if the same typemap is applied many times
19251 in a given function.
19252 ** Not currently supported in Perl4 or Guile modules.
19254 5/2/97 : Fixed processing of %ifdef, %endif, %if, etc... (These are
19255 SWIG equivalents of the C preprocessor directives that
19256 can pass through the C preprocessor without modification).
19258 5/2/97 : Fixed major (but subtle) bug in the run-time type checker
19259 related to searching and type-checking for C++ inheritance.
19260 To make a long story short, if you had two classes named
19261 "Foo" and "FooObject" the type checker would sometimes
19262 get confused and be unable to locate "Foo" in an internal
19265 5/2/97 : Fixed some bugs in the -co option.
19267 4/24/97 : Pointer library added to the SWIG library.
19269 4/19/97 : Added the %new directive. This is a "hint" that can be used
19270 to tell SWIG that a function is returning a new object. For
19273 %new Foo *create_foo();
19275 This tells SWIG that create_foo() is creating a new object
19276 and returning a pointer to it. Many language modules may
19277 choose to ignore the hint, but when working with shadow classes,
19278 the %new is used to handle proper ownership of objects.
19280 %new can also be used with dynamically allocated strings.
19283 %new char *create_string();
19285 When used, all of the language modules will automatically cleanup
19286 the returned string--eliminating memory leaks.
19289 4/19/97 : Added a new typemap "newfree". This is used in conjunction with
19290 the %new directive and can be used to change the method by which
19291 a new object returned by a function is deleted.
19293 4/19/97 : The symbol "__cplusplus" is now defined in the SWIG interpreter
19294 when running with the -c++ option.
19296 4/17/97 : Added support for static member functions when used inside the
19297 %addmethods directive.
19299 4/15/97 : Added a special typemap symbol PREVIOUS that can be used to
19300 restore a previous typemap. For example :
19302 %typemap(tcl,in) int * = PREVIOUS;
19304 This is primarily used in library files.
19306 4/13/97 : Added %pragma directive for Perl5 module. Two new pragmas are
19309 %pragma(perl5) code = "string"
19310 %pragma(perl5) include = "file.pl"
19312 Both insert code into the .pm file created by SWIG. This can
19313 be used to automatically customize the .pm file created by SWIG.
19315 4/13/97 : Scanner modified to only recognize C++ keywords when the -c++
19316 option has been specified. This provides support for C programs
19317 that make use of these keywords for identifiers.
19318 SWIG may need to be explicitly run with the -c++ option when
19319 compiling C++ code (this was allowed, but not recommended in
19320 previous versions). **POTENTIAL INCOMPATIBILITY**
19322 4/11/97 : Fixed a rather nasty bug in the Perl5 module related to using
19323 variable linking with complex datatypes and pointers. On Unix,
19324 code would work (somehow), but would cause an access violation
19325 under Windows-NT. The fix should correct the problem,
19326 but there may still be a problem using global variables of
19327 complex datatypes in conjunction with shadow classes. Fortunately,
19328 this sort of thing seems to be relatively rare (considering
19329 that the bug has been around for more than a year - yikes!).
19331 4/11/97 : Fixed bizarre constant evaluation bug in Perl5 code generation
19332 when running under Windows-NT.
19334 4/8/97 : Bug when using default arguments and C++ references fixed.
19336 4/8/97 : Fixed code generation bugs in Python and Perl5 modules related to
19337 using class renaming (applying the %name directive to a class
19338 definition) and shadow classes.
19340 4/7/97 : Fixed minor bugs in swigptr.swg, tcl8ptr.swg, and perl5ptr.swg to
19341 prevent infinite loops when weird datatypes are passed.
19343 3/29/97 : 'Makefile.win' added. This is used to build most of the examples
19344 in the Examples directory under Windows NT/95.
19346 3/27/97 : Fixes to SWIG's error return codes. SWIG now returns non-zero
19347 exit codes for certain kinds of errors (which makes it more
19348 friendly to makefiles). An overhaul of the error handling
19349 is on the to-do list and will probably show up in a later release.
19351 3/25/97 : Bug fix. "freearg" and "argout" typemaps have been fixed in
19352 the Perl5 module. In previous versions, function input parameters
19353 and function output parameters shared the same memory space--causing
19354 all sorts of nasty problems when trying to pass perl values by
19355 reference. SWIG now internally makes a "copy" (which is really
19356 just a pointer) of affected parameters and uses that. This
19357 is done transparently so there is no noticable impact on any
19358 SWIG generated modules. This change is probably only noticable
19361 3/25/97 : Added type-check to verbose and stat mode. SWIG will now generate a list
19362 of all datatypes that were used but undefined (useful for tracking
19363 down weird bugs). This is enabled with the -v option (which
19364 is now officially known as "overly verbose" mode) or the -stat option.
19366 3/25/97 : Slight change to the parser to make include guards work correctly.
19369 #ifndef INTERFACE_I
19370 #define INTERFACE_I
19372 ... declarations ...
19375 3/24/97 : %checkout directive added. This allows an interface file to
19376 extract files from the SWIG library and place them in the
19377 current directory. This can be used to extract scripts and
19378 other helper code that might be associated with library files.
19381 %checkout array.tcl
19383 Will look for a file "array.tcl" in the library and copy it
19384 to the current directory. If the file already exists in the
19385 directory, this directive does nothing (it will not overwrite an
19386 existing file). This only an experimental feature for now.
19388 3/24/97 : SWIG will now look in the SWIG Library for a file if it can't
19389 find it in the current directory. As a result, it is easy to
19390 make modules from SWIG library files. For example, if you
19391 want to make a Python module from the SWIG timers library, just
19392 type this in any directory :
19394 swig -python timers.i
19396 You will get the files timers_wrap.c and timers_wrap.doc in
19397 the current directory that you can now compile. The file
19398 remains in the SWIG library (although you can check it out
19399 using the -co option). *** New Feature ***
19401 3/24/97 : -co option added to SWIG to allow easy access to the SWIG library.
19402 When used, this instructs SWIG to check out a library file and
19403 place it in the current directory. For example :
19405 unix > swig -co array.i
19406 array.i checked out from the SWIG library
19409 Once in your directory you can customize the file to suit your
19410 particular purposes. The checkout option makes it easy to
19411 grab library files without knowing anything about the SWIG
19412 installation, but it also makes it possible to start
19413 including scripts, C code, and other miscellaneous files
19414 in the library. For example, you could put a cool script
19415 in the library and check it out whenever you wanted to use it.
19416 *** New Feature ***
19418 3/24/97 : #pragma export directives added to Tcl output for compiling
19419 shared libraries on the Mac.
19421 3/24/97 : Minor changes to wish.i and tclsh.i library files to provide
19422 support for the Macintosh.
19424 3/19/97 : SWIG's policy towards NULL pointers has been relaxed. The
19425 policy of requiring a special compiler directive -DALLOW_NULL
19426 to use NULL pointers is no longer supported. While this may
19427 seem "unsafe", it turns out that you can use a "check"
19428 typemap to achieve some safety. For example :
19430 %typemap(perl5,check) Node * {
19432 croak("NULL Pointers not allowed.");
19435 This prevents any NULL value of a "Node *" pointer to be
19436 passed to a function. (I think this is much cleaner
19437 than the old -DALLOW_NULL hack anyways).
19439 3/19/97 : Fixed pointer handling errors in Perl5 module. Modules no
19440 longer core dump when a Perl reference is inadvertently
19441 passed in as a C pointer.
19443 3/18/97 : Added a "check" typemap. This can be used to check the
19444 validity of function input values. For example :
19446 %typemap(perl5,check) int posint {
19448 croak("Argument is not a positive integer");
19451 3/18/97 : Added an $arg variable to Tcl typemaps. This makes it easier
19452 to return argument values by "reference".
19454 3/18/97 : Fixed a code generation bug when using C++ references and
19455 the %addmethods directive.
19457 3/18/97 : Fixed a few glitches in the typemap module with respect to
19458 chaining. For example :
19460 %typemap(tcl,in) int {
19461 $in // Inserts prexisting typemap
19462 printf("Received a %d\n", $target);
19465 This has been allowed for quite some time, but didn't work
19466 if no existing typemap was defined. Now, it still doesn't
19467 work if no existing typemap is defined, but it issues a
19468 warning message. There is some support using default typemaps,
19469 but none of the language modules take advantage of it. This
19470 should be considered experimental at this time.
19472 Version 1.1b5 Patch 1 (March 16, 1997)
19473 ======================================
19475 3/16/97 : Fixed references bug with C++ code generation.
19477 3/16/97 : Fixed initialization bug in the documentation system that
19478 was causing weird problems.
19480 3/16/97 : Fixed fatal bug with -c option in the Python module.
19482 3/13/97 : Fixed bug in the documentation system involving the %text directive
19483 and sorting. In the old system, %text entries would float to the
19484 top of a section because they were "nameless". Now they are
19485 attached to the previous declaration and will stay in the proper
19486 location relative to the previous entry.
19488 Version 1.1b5 (March 12, 1997)
19489 ==============================
19491 3/11/97 : Fixed compilation problems introduced by Tcl/Tk 8.0a2.
19492 *** INCOMPATIBILITY *** SWIG no longer works with Tcl/Tk 8.0a1.
19494 3/10/97 : Fixed bug with ignored arguments and C++ member functions in
19497 3/9/97 : Parsing bugs with nested class definitions and privately
19498 declared nested class definitions fixed.
19500 3/9/97 : Fixed a few minor code generation bugs with C++ classes and
19501 constructors. In some cases, the resulting wrapper code
19502 would not compile properly. SWIG now attempts to use
19503 the default copy constructor instead.
19505 3/8/97 : Added a -l option to SWIG that allows additional SWIG library files
19506 to be grabbed without having them specified in the interface file.
19507 This makes it easier to keep the interface file clean and move certain
19508 options into a Makefile. For example :
19510 swig -tcl example.i # Build a normal Tcl extension
19511 swig -tcl -lwish.i example.i # Build it as a wish extension
19512 # by including the 'wish.i' file.
19514 swig -python example.i # Build a dynamically loaded extension
19515 swig -python -lembed.i example.i # Build a static extension
19517 These kinds of options could previously be accomplished with
19518 conditional compilation such as :
19526 3/8/97 : Incorporated changes to Guile module to use the new gh interface
19527 in FSF Guile 1.0. The older gscm interface used in Cygnus
19528 Guile releases is no longer supported by SWIG.
19530 3/8/97 : Cleaned up the Tcl Netscape plugin example. It should work with
19531 version 1.1 of the plugin now.
19533 3/8/97 : Added better array support to the typemap module. The keyword
19534 ANY can now be used to match any array dimension. For example :
19536 %typemap(tcl,in) double [ANY] {
19537 ... get an array ...
19540 This will match any single-dimensional double array. The array
19541 dimension is passed in the variables $dim0, $dim1, ... $dim9. For
19544 %typemap(tcl,in) double [ANY][ANY][ANY] {
19545 printf("Received a double[%d][%d][%d]\n",$dim0,$dim1,$dim2);
19548 Any typemap involving a specific array dimension will override any
19549 specified with the ANY tag. Thus, a %typemap(tcl,in) double [5][4][ANY] {}
19550 would override a double [ANY][ANY][ANY]. However, overuse of the ANY
19551 tag in arrays of high-dimensions may not work as you expect due to
19552 the pattern matching rule used. For example, which of the following
19553 typemaps has precedence?
19555 %typemap(in) double [ANY][5] {} // Avoid this!
19556 %typemap(in) double [5][ANY] {}
19558 3/7/97 : Fixed a number of bugs related to multi-dimensional array handling.
19559 Typedefs involving multi-dimensional arrays now works correctly.
19562 typedef double MATRIX[4][4];
19565 extern double foo(MATRIX a);
19567 Typecasting of pointers into multi-dimensional arrays is now
19568 implemented properly when making C/C++ function calls.
19570 3/6/97 : Fixed potentially dangerous bug in the Tcl Object-oriented
19571 interface. Well, actually, didn't fix it but issued a
19572 Tcl error instead. The bug would manifest itself as follows:
19574 % set l [List] # Create an object
19576 % set m [List -this $l] # Make $m into an object assuming $l
19577 # contains a pointer.
19578 # Since $m == $l, $l gets destroyed
19579 # (since its the same command name)
19581 Segmentation fault # Note : the list no longer exists!
19583 Now, an error will be generated instead of redefining the command.
19588 % set m [List -this $l]
19589 Object name already exists!
19591 Use catch{} to ignore the error.
19593 3/3/97 : Better support for enums added. Datatypes of 'enum MyEnum'
19594 and typedefs such as 'typedef enum MyEnum Foo;' now work.
19596 3/3/97 : Parser modified to ignore constructor initializers such as :
19598 class Foo : public Bar {
19601 Foo(int i) : a(0), b(i), Bar(i,0) { };
19604 3/3/97 : Modified parser to ignore C++ exception specifications such as :
19606 int foo(double) throw(X,Y);
19608 3/3/97 : Added %import directive. This works exactly like %extern
19609 except it tells the language module that the declarations are
19610 coming from a separate module. This is usually only
19611 needed when working with shadow classes.
19613 3/2/97 : Changed pointer type-checker to be significantly more
19614 efficient when working with derived datatypes. This
19615 has been accomplished by storing type-mappings in sorted
19616 order, using binary search schemes, and caching recently
19617 used datatypes. For SWIG generated C++ modules that
19618 make a large number of C function calls with derived types,
19619 this could result in speedups of between 100 and 50000 percent.
19620 However, due to the required sorting operation, module
19621 loading time may increased slightly when there are lots of
19624 3/2/97 : Fixed some C++ compilation problems with Python
19625 embed.i library files.
19627 2/27/97 : Slight change to C++ code generation to use copy constructors
19628 when returning complex data type by value.
19630 2/26/97 : Fixed bug in Python module with -c option.
19632 2/26/97 : Slight tweak of parser to allow trailing comma in enumerations
19635 enum Value (ALE, STOUT, LAGER, };
19637 2/25/97 : Fixed code generation bug in Tcl module when using the
19638 %name() directive on a classname.
19640 2/25/97 : Finished code-size optimization of C++ code generation with
19641 inheritance of attributes. Inherited attributes now
19642 only generate one set of wrapper functions that are re-used
19643 in any derived classes. This could provide big code
19644 size improvements in some scripting language interfaces.
19646 2/25/97 : Perl5 module modified to support both the Unix and Windows
19647 versions. The windows version has been tested with the
19648 Activeware port of Perl 5.003 running under Windows 95.
19649 The C source generated by SWIG should compile without
19650 modification under both versions of Perl, but is now
19651 even more hideous than before.
19653 2/25/97 : Modified parser to allow scope resolution operation to
19654 appear in expressions and default arguments as in :
19656 void foo(int a = Bar::defvalue);
19658 2/25/97 : Fixed bug when resolving symbols inside C++ classes.
19663 enum Value {ALE, STOUT, LAGER};
19665 void defarg(Value v = STOUT);
19669 2/24/97 : Fixed bug with member functions returning void *.
19671 2/23/97 : Modified Python module to be better behaved under Windows
19673 - Module initialization function is now properly exported.
19674 It should not be neccessary to explicitly export this function
19677 - Bizarre compilation problems when compiling the SWIG wrapper
19678 code as ANSI C under Visual C++ 4.x fixed.
19680 - Tested with both the stock Python-1.4 distribution and Pythonwin
19681 running under Win95.
19683 2/19/97 : Fixed typedef handling bug in Perl5 shadow classes.
19685 2/19/97 : Added exception support. To use it, do the following :
19688 ... try part of the exception ...
19690 ... catch part of exception ...
19693 $function is a SWIG variable that will be replaced by the
19694 actual C/C++ function call in a wrapper function. Thus,
19695 a real exception specification might look like this :
19700 } catch (char *& sz) {
19701 ... process an exception ...
19703 croak("Unknown exception. Bailing out...");
19707 2/19/97 : Added support for managing generic code fragments (needed
19710 2/19/97 : Fixed some really obscure typemap scoping bugs in the C++
19713 2/18/97 : Cleaned up perlmain.i file by removing some problematic,
19714 but seemingly unnecessary declarations.
19716 2/18/97 : Optimized handling of member functions under inheritance.
19717 SWIG can now use wrapper functions generated for a
19718 base class instead of regenerating wrappers for
19719 the same functions in a derived class. This could
19720 make a drastic reduction in wrapper code size for C++
19721 applications with deep inheritance hierarchies and
19724 2/18/97 : Additional methods specified with %addmethods can now
19725 be inherited along with normal C++ member functions.
19727 2/18/97 : Minor internal fixes to make SWIG's string handling a little
19730 2/16/97 : Moved some code generation of Tcl shadow classes to
19733 2/16/97 : Fixed documentation error of '-configure' method in
19736 2/16/97 : Modified Perl5 module slightly to allow typemaps
19737 to use Perl references.
19739 2/12/97 : Fixed argument checking bug that was introduced by
19740 default arguments (function calls with too many
19741 arguments would still be executed). Functions now
19742 must have the same number of arguments as C version
19743 (with possibility of default/optional arguments
19746 2/12/97 : Fixed default argument bug in Perl5 module when
19747 generating wrapper functions involving default
19748 arguments of complex datatypes.
19750 2/12/97 : Fixed typemap scoping problems. For example :
19752 %typemap(tcl,in) double {
19758 double bar(double);
19761 %typemap(tcl,in) double {
19762 .. new get double ..
19765 Would apply the second typemap to all functions in Foo
19766 due to delayed generation of C++ wrapper code (clearly this
19767 is not the desired effect). Problem has been fixed by
19768 assigning unique numerical identifiers to every datatype in
19769 an interface file and recording the "range of effect" of each
19772 2/11/97 : Added support for "ignore" and "default" typemaps. Only use
19773 if you absolutely know what you're doing.
19775 2/9/97 : Added automatic creation of constructors and destructors for
19776 C structs and C++ classes that do not specify any sort of
19777 constructor or destructor. This feature can be enabled by
19778 running SWIG with the '-make_default' option or by inserting
19779 the following pragma into an interface file :
19781 %pragma make_default
19783 The following pragma disables automatic constructor generation
19787 2/9/97 : Added -make_default option for producing default constructors
19788 and destructors for classes without them.
19790 2/9/97 : Changed the syntax of the SWIG %pragma directive to
19791 %pragma option=value or %pragma(lang) option=value.
19792 This change makes the syntax a little more consistent
19793 between general pragmas and language-specific pragmas.
19794 The old syntax still works, but will probably be phased
19795 out (a warning message is currently printed).
19797 2/9/97 : Improved Tcl support of global variables that are of
19798 structures, classes, and unions.
19800 2/9/97 : Fixed C++ compilation problem in Python 'embed.i' library file.
19802 2/9/97 : Fixed missing return value in perlmain.i library file.
19804 2/9/97 : Fixed Python shadow classes to return an AttributeError when
19805 undefined attributes are accessed (older versions returned
19808 2/9/97 : Fixed bug when %addmethods is used after a class definition whose
19809 last section is protected or private.
19811 2/8/97 : Made slight changes in include file processing to support
19814 2/8/97 : Extended swigmain.cxx to provide a rudimentary Macintosh interface.
19815 It's a really bad interface, but works until something better
19818 1/29/97 : Fixed type-casting bug introduced by 1.1b4 when setting/getting the
19819 value of global variables involving complex data types.
19821 1/29/97 : Removed erroneous white space before an #endif in the code generated
19822 by the Python module (was causing errors on DEC Alpha compilers).
19824 1/26/97 : Fixed errors when using default/optional arguments in Python shadow
19827 1/23/97 : Fixed bug with nested %extern declarations.
19829 1/21/97 : Fixed problem with typedef involving const datatypes.
19831 1/21/97 : Somewhat obscure, but serious bug with having multiple levels
19832 of typedefs fixed. For example :
19834 typedef char *String;
19835 typedef String Name;
19837 Version 1.1 Beta4 (January 16, 1997)
19838 ====================================
19840 Note : SWIG 1.1b3 crashed and burned shortly after take off due
19841 to a few major run-time problems that surfaced after release.
19842 This release should fix most, if not all, of those problems.
19844 1/16/97 : Fixed major memory management bug on Linux
19846 1/14/97 : Fixed bug in functions returning constant C++ references.
19848 1/14/97 : Modified C++ module to handle datatypes better.
19850 1/14/97 : Modified parser to allow a *single* scope resolution
19851 operator in datatypes. Ie : Foo::bar. SWIG doesn't
19852 yet handle nested classes, so this should be
19853 sufficient for now.
19855 1/14/97 : Modified parser to allow typedef inside a C++ class.
19857 1/14/97 : Fixed some problems related to datatypes defined inside
19858 a C++ class. SWIG was not generating correct code,
19859 but a new scoping mechanism and method for handling
19860 datatypes inside a C++ class have been added.
19862 1/14/97 : Changed enumerations to use the value name instead
19863 of any values that might have appeared in the interface
19864 file. This makes the code a little more friendly to
19867 1/14/97 : Removed typedef bug that made all enumerations
19868 equivalent to each other in the type checker (since
19869 it generated alot of unnecessary code).
19871 Version 1.1 Beta3 (January 9, 1997)
19872 ===================================
19874 Note : A *huge* number of changes related to ongoing modifications.
19876 1. Support for C++ multiple inheritance added.
19880 3. Some support for nested structure definitions added.
19882 4. Default argument handling added.
19884 5. -c option added for building bare wrapper code modules.
19886 6. Rewrote Pointer type-checking to support multiple inheritance
19889 7. Tcl 8.0 module added.
19891 8. Perl4 and Guile modules resurrected from the dead (well, they
19892 at least work again).
19894 9. New Object Oriented Tcl interface added.
19896 10. Bug fixes to Perl5 shadow classes.
19898 11. Cleaned up many of the internal modules of the parser.
19900 12. Tons of examples and testing modules added.
19902 13. Fixed bugs related to use of "const" return values.
19904 14. Fixed bug with C++ member functions returning void *.
19906 15. Changed SWIG configuration script.
19908 Version 1.1 Beta2 (December 3, 1996)
19909 ====================================
19911 1. Completely rewrote the SWIG documentation system. The changes
19912 involved are too numerous to mention. Basically, take everything
19913 you knew about the old system, throw them out, and read the
19916 2. Limited support for #if defined() added.
19918 3. Type casts are now allowed in constant expressions. ie
19922 4. Added support for typedef lists. For example :
19926 } Vector, *VectorPtr;
19928 5. New SWIG directives (related to documentation system)
19935 6. Reorganized the C++ handling and made it a little easier to
19936 work with internally.
19938 7. Fixed problem with inheriting data members in Python
19941 8. Fixed symbol table problems with shadow classes in both
19944 9. Fixed annoying segmentation fault bug in wrapper code
19945 generated for Perl5.
19947 10. Fixed bug with %addmethods directive. Now it can be placed
19948 anywhere in a class.
19950 11. More test cases added to the SWIG self-test. Documentation
19951 tests are now performed along with other things.
19953 12. Reorganized the SWIG library a little bit and set it up to
19954 self-document itself using SWIG.
19956 13. Lots and lots of minor bug fixes (mostly obscure, but bugs
19960 Version 1.1 Beta1 (October 30, 1996)
19961 ====================================
19963 1. Added new %extern directive for handling multiple files
19965 2. Perl5 shadow classes added
19967 3. Rewrote conditional compilation to work better
19969 4. Added 'bool' datatype
19971 5. %{,%} block is now optional.
19973 6. Fixed some bugs in the Python shadow class module
19975 7. Rewrote all of the SWIG tests to be more informative
19978 8. Rewrote parameter list handling to be more memory
19979 efficient and flexible.
19981 9. Changed parser to ignore 'static' declarations.
19983 10. Initializers are now ignored. For example :
19985 struct FooBar a = {3,4,5};
19987 11. Somewhat better parsing of arrays (although it's
19988 usually just a better error message now).
19990 12. Lot's of minor bug fixes.
19993 Version 1.0 Final (August 31, 1996)
19994 ===================================
19996 1. Fixed minor bug in C++ module
19998 2. Fixed minor bug in pointer type-checker when using
20001 3. Fixed configure script to work with Python 1.4beta3
20003 4. Changed configure script to allow compilation without
20006 Version 1.0 Final (August 28, 1996)
20007 ===================================
20009 1. Changed parser to support more C/C++ datatypes (well,
20010 more variants). Types like "unsigned", "short int",
20011 "long int", etc... now work.
20013 2. "unions" added to parser.
20015 3. Use of "typedef" as in :
20021 Now works correctly. The name of the typedef is used as
20022 the structure name.
20024 4. Conditional compilation with #ifdef, #else, #endif, etc...
20027 5. New %disabledoc, %enabledoc directives allow documentation
20028 to selectively be disabled for certain parts of a wrapper
20031 6. New Python module supports better variable linking, constants,
20032 and shadow classes.
20034 7. Perl5 module improved with better compatibility with XS
20035 and xsubpp. SWIG pointers and now created so that they
20036 are compatible with xsubpp pointers.
20038 8. Support for [incr Tcl] namespaces added to Tcl module.
20040 9. %pragma directive added.
20042 10. %addmethods directive added.
20044 11. %native directive added to allow pre-existing wrapper functions
20047 12. Wrote configure script for SWIG installation.
20049 13. Function pointers now allowed with typedef statements.
20051 14. %typedef modified to insert a corresponding C typedef into
20054 15. Fixed some problems related to C++ references.
20056 16. New String and WrapperFunction classes add to make generating
20057 wrapper code easier.
20059 17. Fixed command line option processing to eliminate core dumps
20060 and to allow help messages.
20062 18. Lot's of minor bug fixes to almost all code modules
20065 Version 1.0 Beta 3 (Patch 1) July 17, 1996
20066 ==========================================
20068 1.0 Final is not quite ready yet, but this release fixes a
20069 number of immediate problems :
20071 1. Compiler errors when using -strict 1 type checking have been fixed.
20073 2. Pointer type checker now recognizes pointers of the form
20076 3. A few minor fixes were made in the Makefile
20078 Version 1.0 Beta 3 (June 14, 1996)
20079 ==================================
20082 There are lots of changes in this release :
20084 1. SWIG is now invoked using the "swig" command instead of "wrap".
20085 Hey, swig sounds cooler.
20087 2. The SWIG_LIB environment variable can be set to change the
20088 location where SWIG looks for library files.
20090 3. C++ support has been added. You should use the -c++ option
20093 4. The %init directive has been replaced by the %module directive.
20094 %module constructs a valid name for the initialization function
20095 for whatever target language you're using (actually this makes
20096 SWIG files a little cleaner). The old %init directive still works.
20098 5. The syntax of the %name directive has been changed. Use of the
20099 old one should generate a warning message, but may still work.
20101 6. To support Tcl/Tk on non-unix platforms, SWIG imports a file called
20102 swigtcl.cfg from the $(SWIG_LIB)/tcl directory. I don't have access
20103 to an NT machine, but this file is supposedly allows SWIG to
20104 produce wrapper code that compiles on both UNIX and non UNIX machines.
20105 If this doesn't work, you'll have to edit the file swigtcl.cfg. Please
20106 let me know if this doesn't work so I can update the file as
20109 7. The SWIG run-time typechecker has been improved. You can also
20110 now redefine how it works by supplying a file called "swigptr.cfg"
20111 in the same directory as your SWIG interface files. By default,
20112 SWIG reads this file from $(SWIG_LIB)/config.
20114 8. The documentation system has been changed to support the following :
20116 - Documentation order is printed in interface file order by
20117 default. This can be overridden by putting an %alpha
20118 directive in the beginning of the interface file.
20120 - You can supply additional documentation text using
20122 %text %{ put your text here %}
20124 - A few minor bugs were fixed.
20126 9. A few improvements have been made to the handling of command line
20127 options (but it's still not finished).
20129 10. Lots of minor bug fixes in most of the language modules have been
20132 11. Filenames have been changed to 8.3 for compatibility with a SWIG
20133 port to non-unix platforms (work in progress).
20135 12. C++ file suffix is now .cxx (for same reason).
20137 13. The documentation has been upgraded significantly and is now
20138 around 100 pages. I added new examples and a section on
20139 C++. The documentation now includes a Table of Contents.
20141 14. The SWIG Examples directory is still woefully sparse, but is
20144 Special notice about C++
20145 ------------------------
20146 This is the first version of SWIG to support C++ parsing. Currently
20147 the C++ is far from complete, but seems to work for simple cases.
20148 No work has been done to add special C++ processing to any of
20149 the target languages. See the user manual for details about how
20150 C++ is handled. If you find problems with the C++ implementation,
20151 please let me know. Expect major improvements in this area.
20153 Note : I have only successfully used SWIG and C++ with Tcl and
20156 Notice about Version 1.0Final
20157 -----------------------------
20159 Version 1.0B3 is the last Beta release before version 1.0 Final is
20160 released. I have frozen the list of features supported in version 1.0
20161 and will only fix bugs as they show up. Work on SWIG version 2.0 is
20162 already in progress, but is going to result in rather significant
20163 changes to SWIG's internal structure (hopefully for the better). No
20164 anticipated date for version 2.0 is set, but if you've got an idea,
20167 Version 1.0 Beta 2 (April 26, 1996)
20168 ===================================
20170 This release is identical to Beta1 except a few minor bugs are
20171 fixed and the SWIG library has been updated to work with Tcl 7.5/Tk 4.1.
20172 A tcl7.5 examples directory is now included.
20174 - Fixed a bug in the Makefile that didn't install the libraries
20177 - SWIG Library files are now updated to work with Tcl 7.5 and Tk 4.1.
20179 - Minor bug fixes in other modules.
20182 Version 1.0 Beta 1 (April 10, 1996).
20183 =====================================
20185 This is the first "semi-official" release of SWIG. It has a
20186 number of substantial improvements over the Alpha release. These
20187 notes are in no particular order--hope I remembered everything....
20191 SWIG is known to work with Tcl7.3, Tk3.6 and later versions.
20192 I've also tested SWIG with expect-5.19.
20194 Normally SWIG expects to use the header files "tcl.h" and "tk.h".
20195 Newer versions of Tcl/Tk use version numbers. You can specify these
20196 in SWIG as follows :
20198 % wrap -htcl tcl7.4.h -htk tk4.0.h example.i
20200 Of course, I prefer to simply set up symbolic links between "tcl.h" and
20201 the most recent stable version on the machine.
20205 This implementation has been based on Perl-4.035. SWIG's interface to
20206 Perl4 is based on the documentation provided in the "Programming Perl"
20207 book by Larry Wall, and files located in the "usub" directory of the
20208 Perl4 distribution.
20210 In order to compile with Perl4, you'll need to link with the uperl.o
20211 file found in the Perl4 source directory. You may want to move this
20212 file to a more convenient location.
20216 This is a somewhat experimental implementation, but is alot less
20217 buggy than the alpha release. SWIG operates independently of
20218 the XS language and xsubpp supplied with Perl5. Currently SWIG
20219 produces the necessary C code and .pm file needed to dynamically
20220 load a module into Perl5.
20222 To support Perl5's notion of modules and packages (as with xsubpp),
20223 you can use the following command line options :
20225 % wrap -perl5 -module MyModule -package MyPackage example.i
20227 Note : In order for dynamic loading to be effective, you need to be
20228 careful about naming. For a module named "MyModule", you'll need to
20229 create a shared object file called "MyModule.so" using something like
20231 % ld -shared my_obj.o -o MyModule.so
20233 The use of the %init directive must match the module name since Perl5
20234 calls a function "boot_ModuleName" in order to initialize things.
20235 See the Examples directory for some examples of how to get things
20240 This is the first release supporting Python. The Python port is
20241 experimental and may be rewritten. Variable linkage is done through
20242 functions which is sort of a kludge. I also think it would be nice
20243 to import SWIG pointers into Python as a new object (instead of strings).
20244 Of course, this needs a little more work.
20248 If you really want to live on the edge, pick up a copy of Guile-iii and
20249 play around with this. This is highly experimental---especially since
20250 I'm not sure what the official state of Guile is these days. This
20251 implementation may change at any time should I suddenly figure out better
20256 SWIG is written in C++ although I tend to think of the code as mostly
20257 being ANSI C with a little inheritance thrown in. Each target language
20258 is implemented as a C++ class that can be plugged into the system.
20259 If you want to add your own modifications, see Appendix C of the user
20260 manual. Then take a look at the "user" directory which contains some
20261 code for building your own extenions.
20263 7. The SWIG library
20265 The SWIG library is still incomplete. Some of the files mentioned in
20266 the user manual are unavailable. These files will be made available
20267 when they are ready. Subscribe to the SWIG mailing list for announcements
20270 8. SWIG Documentation
20272 I have sometimes experienced problems viewing the SWIG documentation in
20273 some postscript viewers. However, the documentation seems to print
20274 normally. I'm working on making much of the documentation online,
20275 but this takes time.
20277 Version 0.1 Alpha (February 9, 1996)
20278 ====================================
20280 1. Run-time type-checking of SWIG pointers. Pointers are now represented
20281 as strings with both numeric and encoded type information. This makes
20282 it a little harder to shoot yourself in the foot (and it eliminates
20283 some segmentation faults and other oddities).
20285 2. Python 1.3 now supported.
20287 3. #define and enum can be used to install constants.
20289 4. Completely rewrote the %include directive and made it alot more powerful.
20291 5. Restructured the SWIG library to make it work better.
20293 6. Various bug fixes to Tcl, Perl4, Perl5, and Guile implementations.
20295 7. Better implementation of %typedef directive.
20297 8. Made some changes to SWIG's class structure to make it easier to expand.
20298 SWIG is now built into a library file that you can use to make your
20301 9. Made extensive changes to the documentation.
20303 10. Minor changes to the SWIG parser to make it use less memory.
20304 Also took out some extraneous rules that were undocumented and
20305 didn't work in the first place.
20307 11. The SWIG library files "tclsh", "wish", "expect", etc... in the first
20308 release have been restructured and renamed to "tclsh.i", "wish.i",