SWIG (Simplified Wrapper and Interface Generator) Version: 2.0.0 (2 June 2010) Tagline: SWIG is a compiler that integrates C and C++ with languages including Perl, Python, Tcl, Ruby, PHP, Java, Ocaml, Lua, Scheme (Guile, MzScheme, CHICKEN), Pike, C#, Modula-3, Common Lisp (CLISP, Allegro CL, CFFI, UFFI), Octave and R. SWIG reads annotated C/C++ header files and creates wrapper code (glue code) in order to make the corresponding C/C++ libraries available to the listed languages, or to extend C/C++ programs with a scripting language. Up-to-date SWIG related information can be found at http://www.swig.org A SWIG FAQ and other hints can be found on the SWIG Wiki: http://www.dabeaz.com/cgi-bin/wiki.pl License ======= Please see the LICENSE file for details of the SWIG license. Release Notes ============= Please see the CHANGES.current file for a detailed list of bug fixes and new features for the current release. The CHANGES file contains bug fixes and new features for older versions. A summary of changes in each release can be found in the RELEASENOTES file. Backwards Compatibility ======================= The developers strive their best to preserve backwards compatibility between releases, but this is not always possible as the overriding aim is to provide the best wrapping experience. Where backwards compatibility is known to be broken, it is clearly marked as an incompatibility in the CHANGES and CHANGES.current files. See the documentation for details of the SWIG_VERSION preprocessor symbol if you have backward compatibility issues and need to use more than one version of SWIG. Windows Installation ==================== Please see the Doc/Manual/Windows.html file for instructions on installing SWIG on Windows and running the examples. The Windows distribution is called swigwin and includes a prebuilt SWIG executable, swig.exe, included in the same directory as this README file. Otherwise it is exactly the same as the main SWIG distribution. There is no need to download anything else. Unix Installation ================= You must use GNU `make' to build SWIG. http://www.gnu.org/software/make/ To build and install SWIG, simply type the following: % ./configure % make % make install By default SWIG installs itself in /usr/local. If you need to install SWIG in a different location or in your home directory, use the --prefix option to ./configure. For example: % ./configure --prefix=/home/yourname/projects % make % make install Note: the directory given to --prefix must be an absolute pathname. Do *NOT* use the ~ shell-escape to refer to your home directory. SWIG won't work properly if you do this. The file INSTALL details more about using configure. Also try % ./configure --help. The configure script will attempt to locate various packages on your machine including Tcl, Perl5, Python and all the other target languages that SWIG uses. Don't panic if you get 'not found' messages--SWIG does not need these packages to compile or run. The configure script is actually looking for these packages so that you can try out the SWIG examples contained in the 'Examples' directory without having to hack Makefiles. Please see the Documentation section below on installing documentation as none is installed by default. SWIG used to include a set of runtime libraries for some languages for working with multiple modules. These are no longer built during the installation stage. However, users can build them just like any wrapper module as described in the documentation, Doc/Manual/Modules.html. The CHANGES file also lists some examples which build the runtime library. Notes: (1) If you checked the code out via SVN, you will have to run ./autogen.sh before typing 'configure'. In addition, a full build of SWIG requires the a number of packages to be installed. Full instructions at http://www.swig.org/svn.html Macintosh OS X Installation ============================ SWIG is known to work on various flavors of OS X. Follow the Unix installation instructions above. However, as of this writing, there is still great deal of inconsistency with how shared libaries are handled by various scripting languages on OS X. We've tried to resolve these differences to the extent of our knowledge. Users of OS X should be aware that Darwin handles shared libraries and linking in a radically different way than most Unix systems. In order to test SWIG and run the examples, SWIG configures itself to use flat namespaces and to allow undefined symbols (-flat_namespace -undefined suppress). This mostly closely follows the Unix model and makes it more likely that the SWIG examples will work with whatever installation of software you might have. However, this is generally not the recommended technique for building larger extension modules. Instead, you should utilize Darwin's two-level namespaces. Some details about this can be found here http://developer.apple.com/documentation/ReleaseNotes/DeveloperTools/TwoLevelNamespaces.html Needless to say, you might have to experiment a bit to get things working at first. Testing ======= If you want to test SWIG before installation, type the following: % make -k check 'make -k check' requires at least one of the target languages to be installed. If it fails, it may mean that you have an uninstalled language module or that the file 'Examples/Makefile' has been incorrectly configured. It may also fail due to compiler issues such as broken C++ compiler. Even if 'make -k check' fails, there is a pretty good chance SWIG still works correctly---you will just have to mess around with one of the examples and some makefiles to get it to work. The testing suite executed by 'make -k check' is designed to stress-test many parts of the implementation including obscure corner cases. If some of these tests fail or generate warning messages, there is no reason for alarm---the test may be related to some new SWIG feature or a difficult bug that we're trying to resolve. Chances are that SWIG will work just fine for you. Note that if you have more than one CPU/core, then you can use parallel make can be used to speed up the check as it does take quite some time to run, for example: % make -j2 -k check Also, SWIG's support for C++ is sufficiently advanced that certain tests may fail on older C++ compilers (for instance if your compiler does not support member templates). These errors are harmless if you don't intend to use these features in your own programs. Note: The test-suite currently contains over 500 tests. If you have many different target languages installed and a slow machine, it might take more than an hour to run the test-suite. Examples ======== The Examples directory contains a variety of examples of using SWIG and it has some browsable documentation. Simply point your browser to the file "Example/index.html". The Examples directory also includes Visual C++ project (.dsp) files for building some of the examples on Windows. Known Issues ============ There are minor known bugs, details of which are in the bug tracker, see http://www.swig.org/bugs.html. Troubleshooting =============== In order to operate correctly, SWIG relies upon a set of library files. If after building SWIG, you get error messages like this, % swig foo.i :1. Unable to find 'swig.swg' :3. Unable to find 'tcl8.swg' it means that SWIG has either been incorrectly configured or installed. To fix this: 1. Make sure you remembered to do a 'make install' and that the installation actually worked. Make sure you have write permission on the install directory. 2. If that doesn't work, type 'swig -swiglib' to find out where SWIG thinks its library is located. 3. If the location is not where you expect, perhaps you supplied a bad option to configure. Use ./configure --prefix=pathname to set the SWIG install location. Also, make sure you don't include a shell escape character such as ~ when you specify the path. 4. The SWIG library can be changed by setting the SWIG_LIB environment variable. However, you really shouldn't have to do this. If you are having other troubles, you might look at the SWIG Wiki at http://www.dabeaz.com/cgi-bin/wiki.pl. Documentation ============= The Doc/Manual directory contains the most recent set of updated documentation for this release. The documentation is available in three different formats, each of which contains identical content. These format are, pdf (Doc/Manual/SWIGDocumentation.pdf), single page html (Doc/Manual/SWIGDocumentation.html) or multiple page html (other files in Doc/Manual). Please select your chosen format and copy/install to wherever takes your fancy. There is some technical developer documentation available in the Doc/Devel subdirectory. This is not necessarily up-to-date, but it has some information on SWIG internals. Participate! ============ Please report any errors and submit patches (if possible)! We only have access to a limited variety of hardware (Linux, Solaris, OS-X, and Windows). All contributions help. If you would like to join the SWIG development team or contribute a language module to the distribution, please contact the swig-devel mailing list, details at http://www.swig.org/mail.html. -- The SWIG Maintainers Version 2.0.0 (2 June 2010) =========================== See CHANGES file for changes in older releases. See RELEASENOTES file for a summary of changes in each release. 2010-06-02: wsfulton [C#] Fix SWIG_STD_VECTOR_ENHANCED macro used in std::vector to work with types containing commas, for example: SWIG_STD_VECTOR_ENHANCED(std::pair< double, std::string >) 2010-06-01: wsfulton Add in std_shared_ptr.i for wrapping std::shared_ptr. Requires the %shared_ptr macro like in the boost_shared_ptr.i library. std::tr1::shared_ptr can also be wrapped if the following macro is defined: #define SWIG_SHARED_PTR_SUBNAMESPACE tr1 %include shared_ptr is also documented in Library.html now. 2010-05-27: wsfulton Add the ability for $typemap special variable macros to call other $typemap special variable macros, for example: %typemap(cstype) CC "CC" %typemap(cstype) BB "$typemap(cstype, CC)" %typemap(cstype) AA "$typemap(cstype, BB)" void hah(AA aa); This also fixes C# std::vector containers of shared_ptr and %shared_ptr. Also added diagnostics for $typemap with -debug-tmsearch, for example, the above displays additional diagnostic lines starting "Containing: ": example.i:34: Searching for a suitable 'cstype' typemap for: AA aa Looking for: AA aa Looking for: AA Using: %typemap(cstype) AA Containing: $typemap(cstype, BB) example.i:31: Searching for a suitable 'cstype' typemap for: BB Looking for: BB Using: %typemap(cstype) BB Containing: $typemap(cstype, CC) example.i:29: Searching for a suitable 'cstype' typemap for: CC Looking for: CC Using: %typemap(cstype) CC 2010-05-26: olly Fix %attribute2ref not to produce a syntax error if the last argument (AccessorMethod) is omitted. Patch from David Piepgras in SF#2235756. 2010-05-26: olly [PHP] When using %throws or %catches, SWIG-generated PHP5 wrappers now throw PHP Exception objects instead of giving a PHP error of type E_ERROR. This change shouldn't cause incompatibility issues, since you can't set an error handler for E_ERROR, so previously PHP would just exit which also happens for unhandled exceptions. The benefit is you can now catch them if you want to. Fixes SF#2545578 and SF#2955522. 2010-05-25: olly [PHP] Add missing directorin typemap for const std::string &. Fixes SF#3006404 reported by t-Legiaw. 2010-05-23: wsfulton [C#] Fix #2957375 - SWIGStringHelper and SWIGExceptionHelper not always being initialized before use in .NET 4 as the classes were not marked beforefieldinit. A static constructor has been added to the intermediary class like this: %pragma(csharp) imclasscode=%{ static $imclassname() { } %} If you had added your own custom static constructor to the intermediary class in the same way as above, you will have to modify your approach to use static variable initialization or define SWIG_CSHARP_NO_IMCLASS_STATIC_CONSTRUCTOR - See csharphead.swg. *** POTENTIAL INCOMPATIBILITY *** 2010-05-23: wsfulton Fix #2408232. Improve shared_ptr and intrusive_ptr wrappers for classes in an inheritance hierarchy. No special treatment is needed for derived classes. The proxy class also no longer needs to be specified, it is automatically deduced. The following macros are deprecated: SWIG_SHARED_PTR(PROXYCLASS, TYPE) SWIG_SHARED_PTR_DERIVED(PROXYCLASS, BASECLASSTYPE, TYPE) and have been replaced by %shared_ptr(TYPE) Similarly for intrusive_ptr wrappers, the following macro is deprecated: SWIG_INTRUSIVE_PTR(PROXYCLASS, TYPE) SWIG_INTRUSIVE_PTR_DERIVED(PROXYCLASS, BASECLASSTYPE, TYPE) and have been replaced by %intrusive_ptr(TYPE) 2010-05-21: olly [PHP] Stop generating a bogus line of code in certain constructors. This was mostly harmless, but caused a PHP notice to be issued, if enabled (SF#2985684). 2010-05-18: wsfulton [Java] Fix member pointers on 64 bit platforms. 2010-05-14: wsfulton Fix wrapping of C++ enum boolean values reported by Torsten Landschoff: typedef enum { PLAY = true, STOP = false } play_state; 2010-05-14: olly [PHP] Fix wrapping of global variables which was producing uncompilable code in some cases. 2010-05-12: drjoe [R] Add two more changes from Wil Nolan. Get garbage collection to work. Implement newfree 2010-05-09: drjoe Fix bug reported by Wil Nolan change creation of string so that R 2.7.0+ can use char hashes 2010-05-07: wsfulton Apply patch #2955146 from Sergey Satskiy to fix expressions containing divide by operator in constructor initialization lists. 2010-05-05: wsfulton [R] Memory leak fix handling const std::string & inputs, reported by Will Nolan. 2010-05-01: wsfulton Typemap matching enhancement for non-default typemaps. Previously all qualifiers were stripped in one step, now they are stripped one at a time starting with the left most qualifier. For example, int const*const is first stripped to int *const then int *. *** POTENTIAL INCOMPATIBILITY *** 2010-04-25: bhy [Python] Fix #2985655 - broken constructor renaming. 2010-04-14: wsfulton Typemap fragments are now official and documented in Typemaps.html. 2010-04-09: wsfulton [Ruby] Fix #2048064 and #2408020. Apply Ubuntu patch to fix Ruby and std::vector wrappers with -minherit. https://bugs.launchpad.net/ubuntu/+source/swig1.3/+bug/522874 2010-04-09: wsfulton [Mzscheme] Apply Ubuntu patch to fix std::map wrappers: https://bugs.launchpad.net/ubuntu/+source/swig1.3/+bug/203876 2010-04-09: wsfulton [Python] Apply patch #2952374 - fix directors and the -nortti option. 2010-04-09: wsfulton [Lua] Fix #2887254 and #2946032 - SWIG_Lua_typename using wrong stack index. 2010-04-03: wsfulton [Python] Fix exceptions being thrown with the -threads option based on patch from Arto Vuori. Fixes bug #2818499. 2010-04-03: wsfulton Fix Makefile targets: distclean and maintainer-clean 2010-04-02: wsfulton [Lua] Fix char pointers, wchar_t pointers and char arrays so that nil can be passed as a valid value. Bug reported by Gedalia Pasternak. 2010-04-01: wsfulton Numerous subtle typemap matching rule fixes when using the default type. The typemap matching rules are to take a type and find the best default typemap (SWIGTYPE, SWIGTYPE* etc), then look for the next best match by reducing the chosen default type. The type deduction now follows C++ class template partial specialization matching rules. Below are the set of changes made showing the default type deduction along with the old reduced type and the new version of the reduced type: SWIGTYPE const &[ANY] new: SWIGTYPE const &[] old: SWIGTYPE (&)[ANY] SWIGTYPE *const [ANY] new: SWIGTYPE const [ANY] old: SWIGTYPE *[ANY] SWIGTYPE const *const [ANY] new: SWIGTYPE *const [ANY] old: SWIGTYPE const *[ANY] SWIGTYPE const *const & new: SWIGTYPE *const & old: SWIGTYPE const *& SWIGTYPE *const * new: SWIGTYPE const * old: SWIGTYPE ** SWIGTYPE *const & new: SWIGTYPE const & old: SWIGTYPE *& Additionally, a const SWIGTYPE lookup is used now for any constant type. Some examples, where T is some reduced type, eg int, struct Foo: T const new: SWIGTYPE const old: SWIGTYPE T *const new: SWIGTYPE *const old: SWIGTYPE * T const[] new: SWIGTYPE const[] old: SWIGTYPE[] enum T const new: enum SWIGTYPE const old: enum SWIGTYPE T (*const )[] new: SWIGTYPE (*const )[] old: SWIGTYPE (*)[] Reminder: the typemap matching rules can now be seen for any types being wrapped by using either the -debug-tmsearch or -debug-tmused options. In practice this leads to some subtle matching rule changes and the majority of users won't notice any changes, except in the prime area of motivation for this change: Improve STL containers of const pointers and passing const pointers by reference. This is fixed because many of the STL containers use a type 'T const&' as parameters and when T is a const pointer, for example, 'K const*', then the full type is 'K const*const&'. This means that the 'SWIGTYPE *const&' typemaps now match when T is either a non-const or const pointer. Furthermore, some target languages incorrectly had 'SWIGTYPE *&' typemaps when these should have been 'SWIGTYPE *const&'. These have been corrected (Java, C#, Lua, PHP). *** POTENTIAL INCOMPATIBILITY *** 2010-03-13: wsfulton [Java] Some very old deprecated pragma warnings are now errors. 2010-03-13: wsfulton Improve handling of file names and directories containing double/multiple path separators. 2010-03-10: mutandiz (Mikel Bancroft) [allegrocl] Use fully qualified symbol name of cl::identity in emit_defun(). 2010-03-06: wsfulton [Java] The intermediary JNI class modifiers are now public by default meaning these intermediary low level functions are now accessible by default from outside any package used. The proxy class pointer constructor and getCPtr() methods are also now public. These are needed in order for the nspace option to work without any other mods. The previous default of protected access can be restored using: SWIG_JAVABODY_METHODS(protected, protected, SWIGTYPE) %pragma(java) jniclassclassmodifiers = "class" 2010-03-06: wsfulton [C#] Added the nspace feature for C#. Documentation for the nspace feature is now available. 2010-03-04: wsfulton Added the nspace feature. This adds some improved namespace support. Currently only Java is supported for target languages, where C++ namespaces are automatically translated into Java packages. The feature only applies to classes,struct,unions and enums declared within a namespace. Methods and variables declared in namespaces still effectively have their namespaces flattened. Example usage: %feature(nspace) Outer::Inner1::Color; %feature(nspace) Outer::Inner2::Color; namespace Outer { namespace Inner1 { struct Color { ... }; } namespace Inner2 { struct Color { ... }; } } For Java, the -package option is also required when using the nspace feature. Say we use -package com.myco, the two classes can then be accessed as follows from Java: com.myco.Outer.Inner1.Color and com.myco.Outer.Inner2.Color. 2010-02-27: wsfulton [Python] Remove -dirvtable from the optimizations included by -O as it this option currently leads to memory leaks as reported by Johan Blake. 2010-02-27: wsfulton License code changes: SWIG Source is GPL-v3 and library code license is now clearer and is provided under a very permissive license. See http://www.swig.org/legal.html. 2010-02-13: wsfulton [Ruby] A few fixes for compiling under ruby-1.9.x including patch from 'Nibble'. 2010-02-13: wsfulton [Ruby] Apply patch from Patrick Bennett to fix RARRAY_LEN and RARRAY_PTR usage for Ruby 1.9.x used in various STL wrappers. 2010-02-13: wsfulton [C#, Java] Fix incorrect multiply defined symbol name error when an enum item and class name have the same name, as reported by Nathan Krieger. Example: class Vector {}; namespace Text { enum Preference { Vector }; } This also fixes other incorrect corner case target language symbol name clashes. 2010-02-11: wsfulton Add the -debug-lsymbols option for displaying the target language layer symbols. 2010-02-09: wsfulton Fix -MM and -MMD options on Windows. They were not omitting files in the SWIG library as they should be. 2010-02-08: wsfulton Fix #1807329 - When Makefile dependencies are being generated using the -M family of options on Windows, the file paths have been corrected to use single backslashes rather than double backslashes as path separators. 2010-02-06: wsfulton Fix #2918902 - language specific files not being generated in correct directory on Windows when using forward slashes for -o, for example: swig -python -c++ -o subdirectory/theinterface_wrap.cpp subdirectory/theinterface.i 2010-02-05: wsfulton Fix #2894405 - assertion when using -xmlout. 2010-01-28: wsfulton Fix typemap matching bug when a templated type has a typemap both specialized and not specialized. For example: template struct XX { ... }; %typemap(in) const XX & "..." %typemap(in) const XX< int > & "..." resulted in the 2nd typemap being applied for all T in XX< T >. 2010-01-22: wsfulton Fix #2933129 - typemaps not being found when the unary scope operator (::) is used to denote global scope, the typemap is now used in situations like this: struct X {}; %typemap(in) const X & "..." void m(const ::X &); and this: struct X {}; %typemap(in) const ::X & "..." void m(const X &); 2010-01-20: wsfulton Fix some unary scope operator (::) denoting global scope problems in the types generated into the C++ layer. Previously the unary scope operator was dropped in the generated code if the type had any sort of qualifier, for example when using pointers, references, like ::foo*, ::foo&, bar< ::foo* >. 2010-01-13: olly [PHP] Add datetime to the list of PHP predefined classes (patch from David Fletcher in SF#2931042). 2010-01-11: wsfulton Slight change to warning, error and diagnostic reporting. The warning number is no longer shown within brackets. This is to help default parsing of warning messages by other tools, vim on Unix in particular. Example original display using -Fstandard: example.i:20: Warning(401): Nothing known about base class 'B'. Ignored. New display: example.i:20: Warning 401: Nothing known about base class 'B'. Ignored. Also subtle fix to -Fmicrosoft format adding in missing space. Example original display: example.i(20): Warning(401): Nothing known about base class 'Base'. Ignored. New display: example.i(20) : Warning 401: Nothing known about base class 'Base'. Ignored. 2010-01-10: wsfulton Fix a few inconsistencies in reporting of file/line numberings including modifying the overload warnings 509, 512, 516, 474, 475 to now be two line warnings. 2010-01-10: wsfulton Modify -debug-tags output to use standard file name/line reporting so that editors can easily navigate to the appropriate lines. Was typically: . top . include . include (/usr/share/swig/temp/trunk/Lib/swig.swg:312) . top . include . include . include (/usr/share/swig/temp/trunk/Lib/swigwarnings.swg:39) now: /usr/share/swig/temp/trunk/Lib/swig.swg:312: . top . include . include /usr/share/swig/temp/trunk/Lib/swigwarnings.swg:39: . top . include . include . include 2010-01-03: wsfulton Fix missing file/line numbers for typemap warnings and in output from the -debug-tmsearch/-debug-tmused options. 2010-01-03: wsfulton Add typemaps used debugging option (-debug-tmused). When used each line displays the typemap used for each type for which code is being generated including the file and line number related to the type. This is effectively a condensed form of the -debug-tmsearch option. Documented in Typemaps.html. 2009-12-23: wsfulton Fix for %javaexception and directors so that all the appropriate throws clauses are generated. Problem reported by Peter Greenwood. 2009-12-20: wsfulton Add -debug-tmsearch option for debugging the typemap pattern matching rules. Documented in Typemaps.html. 2009-12-12: wsfulton [Octave] Remove the -api option and use the new OCTAVE_API_VERSION_NUMBER macro provided in the octave headers for determining the api version instead. 2009-12-04: olly [Ruby] Improve support for Ruby 1.9 under GCC. Addresses part of SF#2859614. 2009-12-04: olly Fix handling of modulo operator (%) in constant expressions (SF#2818562). 2009-12-04: olly [PHP] "empty" is a reserved word in PHP, so rename empty() method on STL classes to "is_empty()" (previously this was automatically renamed to "c_empty()"). *** POTENTIAL INCOMPATIBILITY *** 2009-12-03: olly [PHP] Add typemaps for long long and unsigned long long, and for pointer to method. 2009-12-02: olly [PHP] Fix warning and rename of reserved class name to be case insensitive. 2009-12-01: wsfulton Revert support for %extend and memberin typemaps added in swig-1.3.39. The memberin typemaps are ignored again for member variables within a %extend block. Documentation inconsistency reported by Torsten Landschoff. 2009-11-29: wsfulton [Java, C#] Fix generated quoting when using %javaconst(1)/%csconst(1) for static const char member variables. %javaconst(1) A; %csconst(1) A; struct X { static const char A = 'A'; }; 2009-11-26: wsfulton [Java, C#] Fix %javaconst(1)/%csconst(1) for static const member variables to use the actual constant value if it is specified, rather than the C++ code to access the member. %javaconst(1) EN; %csconst(1) EN; struct X { static const int EN = 2; }; 2009-11-23: wsfulton C++ nested typedef classes can now be handled too, for example: struct Outer { typedef Foo { } FooTypedef1, FooTypedef2; }; 2009-11-18: wsfulton The wrappers for C nested structs are now generated in the same order as declared in the parsed code. 2009-11-18: wsfulton Fix #491476 - multiple declarations of nested structs, for example: struct Outer { struct { int val; } inner1, inner2, *inner3, inner4[1]; } outer; 2009-11-17: wsfulton Fix parsing of enum declaration and initialization, for example: enum ABC { a, b, c } A = a, *pC = &C, array[3] = {a, b, c}; 2009-11-17: wsfulton Fix parsing of struct declaration and initialization, for example: struct S { int x; } instance = { 10 }; 2009-11-15: wsfulton Fix #1960977 - Syntax error parsing derived nested class declaration and member variable instance. 2009-11-14: wsfulton Fix #2310483 - function pointer typedef within extern "C" block. 2009-11-13: wsfulton Fix usage of nested template classes within templated classes so that compileable code is generated. 2009-11-13: olly [php] Fix place where class prefix (as specified with -prefix) wasn't being used. Patch from gverbruggen in SF#2892647. 2009-11-12: wsfulton Fix usage of nested template classes so that compileable code is generated - the nested template class is now treated like a normal nested classes, that is, as an opaque type unless the nestedworkaround feature is used. 2009-11-12: wsfulton Replace SWIGWARN_PARSE_NESTED_CLASS with SWIGWARN_PARSE_NAMED_NESTED_CLASS and SWIGWARN_PARSE_UNNAMED_NESTED_CLASS for named and unnamed nested classes respectively. Named nested class ignored warnings can now be suppressed by name using %warnfilter, eg: %warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::Inner; but clearly unnamed nested classes cannot and the global suppression is still required, eg: #pragma SWIG nowarn=SWIGWARN_PARSE_UNNAMED_NESTED_CLASS 2009-11-11: wsfulton Added the nestedworkaround feature as a way to use the full functionality of a nested class (C++ mode only). It removes the nested class from SWIG's type information so it is as if SWIG had never parsed the nested class. The documented nested class workarounds using a global fake class stopped working when SWIG treated the nested class as an opaque pointer, and this feature reverts this behaviour. The documentation has been updated with details of how to use and implement it, see the "Nested classes" section in SWIGPlus.html. 2009-11-11: wsfulton There were a number of C++ cases where nested classes/structs/unions were being handled as if C code was being parsed which would oftentimes lead to uncompileable code as an attempt was made to wrap the nested structs like it is documented for C code. Now all nested structs/classes/unions are ignored in C++ mode, as was always documented. However, there is an improvement as usage of nested structs/classes/unions is now always treated as an opaque type by default, resulting in generated code that should always compile. *** POTENTIAL INCOMPATIBILITY *** 2009-11-09: drjoe Fix R for -fcompact and add std_map.i 2009-11-08: wsfulton Fix inconsistency for nested structs/unions/classes. Uncompileable code was being generated when inner struct and union declarations were used as types within the inner struct. The inner struct/union is now treated as a forward declaration making the behaviour the same as an inner class. (C++ code), eg: struct Outer { struct InnerStruct { int x; }; InnerStruct* getInnerStruct(); }; 2009-11-08: wsfulton Ignored nested class/struct warnings now display the name of the ignored class/struct. 2009-11-07: wsfulton Bug #1514681 - Fix nested template classes within a namespace generated uncompileable code and introduced strange side effects to other wrapper code especially code after the nested template class. Note that nested template classes are still ignored. 2009-11-07: wsfulton Add new debug options: -debug-symtabs - Display symbol tables information -debug-symbols - Display target language symbols in the symbol tables -debug-csymbols - Display C symbols in the symbol tables 2009-11-03: wsfulton Fix some usage of unary scope operator (::) denoting global scope, for example: namespace AA { /* ... */ } using namespace ::AA; and bug #1816802 - SwigValueWrapper should be used: struct CC { CC(int); // no default constructor }; ::CC x(); and in template parameter specializations: struct S {}; template struct X { void a() {}; }; template <> struct X { void b() {}; }; %template(MyTConcrete) X< ::S >; plus probably some other corner case usage of ::. 2009-11-02: olly [Python] Fix potential memory leak in initialisation code for the generated module. 2009-10-23: wsfulton Fix seg fault when using a named nested template instantiation using %template(name) within a class. A warning that these are not supported is now issued plus processing continues as if no name was given. 2009-10-20: wsfulton [Python] Fix std::vector. This would previously compile, but not run correctly. 2009-10-20: wsfulton Fixed previously fairly poor template partial specialization and explicit specialization support. Numerous bugs in this area have been fixed including: - Template argument deduction implemented for template type arguments, eg this now works: template class X {}; template class X {}; %template(X1) X; // Chooses T * specialization and more complex cases with multiple parameters and a mix of template argument deduction and explicitly specialised parameters, eg: template struct TwoParm { void a() {} }; template struct TwoParm { void e() {} }; %template(E) TwoParm; Note that the primary template must now be in scope, like in C++, when an explicit or partial specialization is instantiated with %template. *** POTENTIAL INCOMPATIBILITY *** 2009-09-14: wsfulton [C#] Add %csattributes for adding C# attributes to enum values, see docs for example. 2009-09-11: wsfulton Fix memmove regression in cdata.i as reported by Adriaan Renting. 2009-09-07: wsfulton Fix constant expressions containing <= or >=. 2009-09-02: wsfulton The following operators in constant expressions now result in type bool for C++ wrappers and remain as type int for C wrappers, as per each standard: && || == != < > <= >= (Actually the last 4 are still broken). For example: #define A 10 #define B 10 #define A_EQ_B A == B // now wrapped as type bool for C++ #define A_AND_B A && B // now wrapped as type bool for C++ 2009-09-02: wsfulton Fix #2845746. true and false are now recognised keywords (only when wrapping C++). Constants such as the following are now wrapped (as type bool): #define FOO true #define BAR FOO && false Release Notes ============= A detailed description of changes are available in the CHANGES.current and CHANGES files. The summaries below contain just a brief overview of the changes made in each release. SWIG-2.0.0 summary: - License changes, see LICENSE file and http://www.swig.org/legal.html. - Much better nested class/struct support. - Much improved template partial specialization and explicit specialization handling. - Namespace support improved with the 'nspace' feature where namespaces can be automatically translated into Java packages or C# namespaces. - Improved typemap and symbol table debugging. - Numerous subtle typemap matching rule changes when using the default (SWIGTYPE) type. These now work much like C++ class template partial specialization matching. - Other small enhancements for typemaps. Typemap fragments are also now official and documented. - Warning and error display refinements. - Wrapping of shared_ptr is improved and documented now. - Numerous C++ unary scope operator (::) fixes. - Better support for boolean expressions. - Various bug fixes and improvements in the Allegrocl, C#, Java, Lua, Octave, PHP, Python, R, Ruby and XML modules. SWIG-1.3.40 summary: - SWIG now supports directors for PHP. - PHP support improved in general. - Octave 3.2 support added. - Various bug fixes/enhancements for Allegrocl, C#, Java, Octave, Perl, Python, Ruby and Tcl. - Other generic fixes and minor new features. SWIG-1.3.39 summary: - Some new small feature enhancements. - Improved C# std::vector wrappers. - Bug fixes: mainly Python, but also Perl, MzScheme, CFFI, Allegrocl and Ruby SWIG-1.3.38 summary: - Output directory regression fix and other minor bug fixes SWIG-1.3.37 summary: - Python 3 support added - SWIG now ships with a version of ccache that can be used with SWIG. This enables the files generated by SWIG to be cached so that repeated use of SWIG on unchanged input files speeds up builds quite considerably. - PHP 4 support removed and PHP support improved in general - Improved C# array support - Numerous Allegro CL improvements - Bug fixes/enhancements for Python, PHP, Java, C#, Chicken, Allegro CL, CFFI, Ruby, Tcl, Perl, R, Lua. - Other minor generic bug fixes and enhancements SWIG-1.3.36 summary: - Enhancement to directors to wrap all protected members - Optimisation feature for objects returned by value - A few bugs fixes in the PHP, Java, Ruby, R, C#, Python, Lua and Perl modules - Other minor generic bug fixes SWIG-1.3.35 summary: - Octave language module added - Bug fixes in Python, Lua, Java, C#, Perl modules - A few other generic bugs and runtime assertions fixed SWIG-1.3.34 summary: - shared_ptr support for Python - Support for latest R - version 2.6 - Various minor improvements/bug fixes for R, Lua, Python, Java, C# - A few other generic bug fixes, mainly for templates and using statements SWIG-1.3.33 summary: - Fix regression for Perl where C++ wrappers would not compile - Fix regression parsing macros SWIG-1.3.32 summary: - shared_ptr support for Java and C# - Enhanced STL support for Ruby - Windows support for R - Fixed long-standing memory leak in PHP Module - Numerous fixes and minor enhancements for Allegrocl, C#, cffi, Chicken, Guile, Java, Lua, Ocaml, Perl, PHP, Python, Ruby, Tcl. - Improved warning support SWIG-1.3.31 summary: - Python modern classes regression fix SWIG-1.3.30 summary: - Python-2.5 support - New language module: R - Director support added for C# - Numerous director fixes and improvements - Improved mingw/msys support - Better constants support in Guile and chicken modules - Support for generating PHP5 class wrappers - Important Java premature garbage collection fix - Minor improvements/fixes in cffi, php, allegrocl, perl, chicken, lua, ruby, ocaml, python, java, c# and guile language modules - Many many other bug fixes SWIG-1.3.29 summary: - Numerous important bug fixes - Few minor new features - Some performance improvements in generated code for Python SWIG-1.3.28 summary: - More powerful renaming (%rename) capability. - More user friendly warning handling. - Add finer control for default constructors and destructors. We discourage the use of the 'nodefault' option, which disables both constructors and destructors, leading to possible memory leaks. Use instead 'nodefaultctor' and/or 'nodefaultdtor'. - Automatic copy constructor wrapper generation via the 'copyctor' option/feature. - Better handling of Windows extensions and types. - Better runtime error reporting. - Add the %catches directive to catch and dispatch exceptions. - Add the %naturalvar directive for more 'natural' variable wrapping. - Better default handling of std::string variables using the %naturalvar directive. - Add the %allowexcept and %exceptionvar directives to handle exceptions when accessing a variable. - Add the %delobject directive to mark methods that act like destructors. - Add the -fastdispatch option to enable smaller and faster overload dispatch mechanism. - Template support for %rename, %feature and %typemap improved. - Add/doc more debug options, such as -dump_module, -debug_typemaps, etc. - Unified typemap library (UTL) potentially providing core typemaps for all scripting languages based on the recently evolving Python typemaps. - New language module: Common Lisp with CFFI. - Python, Ruby, Perl and Tcl use the new UTL, many old reported and hidden errors with typemaps are now fixed. - Initial Java support for languages using the UTL via GCJ, you can now use Java libraries in your favorite script language using gcj + swig. - Tcl support for std::wstring. - PHP4 module update, many error fixes and actively maintained again. - Allegrocl support for C++, also enhanced C support. - Ruby support for bang methods. - Ruby support for user classes as native exceptions. - Perl improved dispatching in overloaded functions via the new cast and rank mechanism. - Perl improved backward compatibility, 5.004 and later tested and working. - Python improved backward compatibility, 1.5.2 and later tested and working. - Python can use the same cast/rank mechanism via the -castmode option. - Python implicit conversion mechanism similar to C++, via the %implicitconv directive (replaces and improves the implicit.i library). - Python threading support added. - Python STL support improved, iterators are supported and STL containers can use now the native PyObject type. - Python many performance options and improvements, try the -O option to test all of them. Python runtime benchmarks show up to 20 times better performance compared to 1.3.27 and older versions. - Python support for 'multi-inheritance' on the python side. - Python simplified proxy classes, now swig doesn't need to generate the additional 'ClassPtr' classes. - Python extended support for smart pointers. - Python better support for static member variables. - Python backward compatibility improved, many projects that used to work only with swig-1.3.21 to swig-1.3.24 are working again with swig-1.3.28 - Python test-suite is now 'valgrinded' before release, and swig also reports memory leaks due to missing destructors. - Minor bug fixes and improvements to the Lua, Ruby, Java, C#, Python, Guile, Chicken, Tcl and Perl modules. SWIG-1.3.27 summary: - Fix bug in anonymous typedef structures which was leading to strange behaviour SWIG-1.3.26 summary: - New language modules: Lua, CLISP and Common Lisp with UFFI. - Big overhaul to the PHP module. - Change to the way 'extern' is handled. - Minor bug fixes specific to C#, Java, Modula3, Ocaml, Allegro CL, XML, Lisp s-expressions, Tcl, Ruby and Python modules. - Other minor improvements and bug fixes. SWIG-1.3.25 summary: - Improved runtime type system. Speed of module loading improved in modules with lots of types. SWIG_RUNTIME_VERSION has been increased from 1 to 2, but the API is exactly the same; only internal changes were made. - The languages that use the runtime type system now support external access to the runtime type system. - Various improvements with typemaps and template handling. - Fewer warnings in generated code. - Improved colour documentation. - Many C# module improvements (exception handling, prevention of early garbage collection, C# attributes support added, more flexible type marshalling/asymmetric types.) - Minor improvements and bug fixes specific to the C#, Java, TCL, Guile, Chicken, MzScheme, Perl, Php, Python, Ruby and Ocaml modules). - Various other bug fixes and memory leak fixes. SWIG-1.3.24 summary: - Improved enum handling - More runtime library options - More bugs fixes for templates and template default arguments, directors and other areas. - Better smart pointer support, including data members, static members and %extend. SWIG-1.3.23 summary: - Improved support for callbacks - Python docstring support and better error handling - C++ default argument support for Java and C# added. - Improved c++ default argument support for the scripting languages plus option to use original (compact) default arguments. - %feature and %ignore/%rename bug fixes and mods - they might need default arguments specified to maintain compatible behaviour when using the new default arguments wrapping. - Runtime library changes: Runtime code can now exist in more than one module and so need not be compiled into just one module - Further improved support for templates and namespaces - Overloaded templated function support added - More powerful default typemaps (mixed default typemaps) - Some important %extend and director code bug fixes - Guile now defaults to using SCM API. The old interface can be obtained by the -gh option. - Various minor improvements and bug fixes for C#, Chicken, Guile, Java, MzScheme, Perl, Python and Ruby - Improved dependencies generation for constructing Makefiles. SWIG-1.3.22 summary: - Improved exception handling and translation of C errors or C++ exceptions into target language exceptions. - Improved enum support, mapping to built-in Java 1.5 enums and C# enums or the typesafe enum pattern for these two languages. - Python - much better STL suppport and support for std::wstring, wchar_t and FILE *. - Initial support for Modula3 and Allegro CL. - 64 bit TCL support. - Java and C#'s proxy classes are now nearly 100% generated from typemaps and/or features for finer control on the generated code. - SWIG runtime library support deprecation. - Improved documentation. SWIG now additionally provides documentation in the form of a single HTML page as well as a pdf document. - Enhanced C++ friend declaration support. - Better support for reference counted classes. - Various %fragment improvements. - RPM fixes. - Various minor improvements and bug fixes for C#, Chicken, Guile, Java, MzScheme, Perl, Php, Python, Ruby and XML.