1 SWIG (Simplified Wrapper and Interface Generator)
3 Version: 1.3.40 (18 August 2009)
5 Tagline: SWIG is a compiler that integrates C and C++ with languages
6 including Perl, Python, Tcl, Ruby, PHP, Java, Ocaml, Lua,
7 Scheme (Guile, MzScheme, CHICKEN), Pike, C#, Modula-3,
8 Common Lisp (CLISP, Allegro CL, CFFI, UFFI), Octave and R.
10 SWIG reads annotated C/C++ header files and creates wrapper code (glue
11 code) in order to make the corresponding C/C++ libraries available to
12 the listed languages, or to extend C/C++ programs with a scripting
15 This distribution represents the latest development release of SWIG.
16 The guilty parties working on this are:
19 William Fulton (wsf@fultondesigns.co.uk) (SWIG core, Java, C#, Windows, Cygwin)
20 Olly Betts (olly@survex.com) (PHP)
21 John Lenz (Guile, MzScheme updates, Chicken module, runtime system)
22 Mark Gossage (mark@gossage.cjb.net) (Lua)
23 Joseph Wang (joequant@gmail.com) (R)
24 Gonzalo Garramuno (ggarra@advancedsl.com.ar) (Ruby, Ruby's UTL)
25 Xavier Delacour (xavier.delacour@gmail.com) (Octave)
27 Major contributors include:
28 Dave Beazley (dave-swig@dabeaz.com) (SWIG core, Python, Tcl, Perl)
29 Henning Thielemann (swig@henning-thielemann.de) (Modula3)
30 Matthias Köppe (mkoeppe@mail.math.uni-magdeburg.de) (Guile, MzScheme)
31 Luigi Ballabio (luigi.ballabio@fastwebnet.it) (STL wrapping)
32 Mikel Bancroft (mikel@franz.com) (Allegro CL)
33 Surendra Singhi (efuzzyone@netscape.net) (CLISP, CFFI)
34 Marcelo Matus (mmatus@acms.arizona.edu) (SWIG core, Python, UTL[python,perl,tcl,ruby])
35 Art Yerkes (ayerkes@speakeasy.net) (Ocaml)
36 Lyle Johnson (lyle@users.sourceforge.net) (Ruby)
37 Charlie Savage (cfis@interserv.com) (Ruby)
38 Thien-Thi Nguyen (ttn@glug.org) (build/test/misc)
39 Richard Palmer (richard@magicality.org) (PHP)
40 Sam Liddicott - Anonova Ltd (saml@liddicott.com) (PHP)
41 Tim Hockin - Sun Microsystems (thockin@sun.com) (PHP)
43 Shibukawa Yoshiki (Japanese Translation)
44 Jason Stewart (jason@openinformatics.com) (Perl5)
46 David Fletcher (Perl5)
48 Masaki Fukushima (Ruby)
49 Scott Michel (scottm@cs.ucla.edu) (Java directors)
50 Tiger Feng (songyanf@cs.uchicago.edu) (SWIG core)
51 Mark Rose (mrose@stm.lbl.gov) (Directors)
52 Jonah Beckford (beckford@usermail.com) (CHICKEN)
53 Ahmon Dancy (dancy@franz.com) (Allegro CL)
54 Dirk Gerrits (Allegro CL)
56 Harco de Hilster (Java)
57 Alexey Dyachenko (dyachenko@fromru.com) (Tcl)
59 Martin Froehlich <MartinFroehlich@ACM.org> (Guile)
60 Marcio Luis Teixeira <marciot@holly.colostate.edu> (Guile)
61 Duncan Temple Lang (R)
62 Miklos Vajna <vmiklos@frugalware.org> (PHP directors)
64 Past contributors include:
65 James Michael DuPont, Clark McGrew, Dustin Mitchell, Ian Cooke, Catalin Dumitrescu, Baran
66 Kovuk, Oleg Tolmatcev, Tal Shalif, Lluis Padro, Chris Seatory, Igor Bely, Robin Dunn
67 (See CHANGES for a more complete list).
69 Portions also copyrighted by companies/corporations;
70 Network Applied Communication Laboratory, Inc
71 Information-technology Promotion Agency, Japan
73 Up-to-date SWIG related information can be found at
77 A SWIG FAQ and other hints can be found on the SWIG Wiki:
79 http://www.dabeaz.com/cgi-bin/wiki.pl
82 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
83 !!!!!!! IMPORTANT !!!!!!!
85 !!!!!!! Previous SWIG-1.1 users should read the documentation !!!!!!!
86 !!!!!!! file Doc/Manual/SWIG.html before trying to use SWIG-1.3!!!!!!!
87 !!!!!!! on existing SWIG interfaces. This is the most current !!!!!!!
88 !!!!!!! documentation that describes new 1.3 features and !!!!!!!
89 !!!!!!! incompatibilities. !!!!!!!
90 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
96 - SWIG now supports directors for PHP.
97 - PHP support improved in general.
98 - Octave 3.2 support added.
99 - Various bug fixes/enhancements for Allegrocl, C#, Java, Octave, Perl,
100 Python, Ruby and Tcl.
101 - Other generic fixes and minor new features.
104 - Some new small feature enhancements.
105 - Improved C# std::vector wrappers.
106 - Bug fixes: mainly Python, but also Perl, MzScheme, CFFI, Allegrocl
110 - Output directory regression fix and other minor bug fixes
113 - Python 3 support added
114 - SWIG now ships with a version of ccache that can be used with SWIG.
115 This enables the files generated by SWIG to be cached so that repeated
116 use of SWIG on unchanged input files speeds up builds quite considerably.
117 - PHP 4 support removed and PHP support improved in general
118 - Improved C# array support
119 - Numerous Allegro CL improvements
120 - Bug fixes/enhancements for Python, PHP, Java, C#, Chicken, Allegro CL,
121 CFFI, Ruby, Tcl, Perl, R, Lua.
122 - Other minor generic bug fixes and enhancements
125 - Enhancement to directors to wrap all protected members
126 - Optimisation feature for objects returned by value
127 - A few bugs fixes in the PHP, Java, Ruby, R, C#, Python, Lua and
129 - Other minor generic bug fixes
132 - Octave language module added
133 - Bug fixes in Python, Lua, Java, C#, Perl modules
134 - A few other generic bugs and runtime assertions fixed
137 - shared_ptr support for Python
138 - Support for latest R - version 2.6
139 - Various minor improvements/bug fixes for R, Lua, Python, Java, C#
140 - A few other generic bug fixes, mainly for templates and using statements
143 - Fix regression for Perl where C++ wrappers would not compile
144 - Fix regression parsing macros
147 - shared_ptr support for Java and C#
148 - Enhanced STL support for Ruby
149 - Windows support for R
150 - Fixed long-standing memory leak in PHP Module
151 - Numerous fixes and minor enhancements for Allegrocl, C#, cffi, Chicken, Guile,
152 Java, Lua, Ocaml, Perl, PHP, Python, Ruby, Tcl.
153 - Improved warning support
156 - Python modern classes regression fix
160 - New language module: R
161 - Director support added for C#
162 - Numerous director fixes and improvements
163 - Improved mingw/msys support
164 - Better constants support in Guile and chicken modules
165 - Support for generating PHP5 class wrappers
166 - Important Java premature garbage collection fix
167 - Minor improvements/fixes in cffi, php, allegrocl, perl, chicken, lua, ruby,
168 ocaml, python, java, c# and guile language modules
169 - Many many other bug fixes
172 - Numerous important bug fixes
173 - Few minor new features
174 - Some performance improvements in generated code for Python
177 - More powerful renaming (%rename) capability.
178 - More user friendly warning handling.
179 - Add finer control for default constructors and destructors. We discourage
180 the use of the 'nodefault' option, which disables both constructors and
181 destructors, leading to possible memory leaks. Use instead 'nodefaultctor'
182 and/or 'nodefaultdtor'.
183 - Automatic copy constructor wrapper generation via the 'copyctor' option/feature.
184 - Better handling of Windows extensions and types.
185 - Better runtime error reporting.
186 - Add the %catches directive to catch and dispatch exceptions.
187 - Add the %naturalvar directive for more 'natural' variable wrapping.
188 - Better default handling of std::string variables using the %naturalvar directive.
189 - Add the %allowexcept and %exceptionvar directives to handle exceptions when
190 accessing a variable.
191 - Add the %delobject directive to mark methods that act like destructors.
192 - Add the -fastdispatch option to enable smaller and faster overload dispatch
194 - Template support for %rename, %feature and %typemap improved.
195 - Add/doc more debug options, such as -dump_module, -debug_typemaps, etc.
196 - Unified typemap library (UTL) potentially providing core typemaps for all
197 scripting languages based on the recently evolving Python typemaps.
198 - New language module: Common Lisp with CFFI.
199 - Python, Ruby, Perl and Tcl use the new UTL, many old reported and hidden
200 errors with typemaps are now fixed.
201 - Initial Java support for languages using the UTL via GCJ, you can now use
202 Java libraries in your favorite script language using gcj + swig.
203 - Tcl support for std::wstring.
204 - PHP4 module update, many error fixes and actively maintained again.
205 - Allegrocl support for C++, also enhanced C support.
206 - Ruby support for bang methods.
207 - Ruby support for user classes as native exceptions.
208 - Perl improved dispatching in overloaded functions via the new cast and rank
210 - Perl improved backward compatibility, 5.004 and later tested and working.
211 - Python improved backward compatibility, 1.5.2 and later tested and working.
212 - Python can use the same cast/rank mechanism via the -castmode option.
213 - Python implicit conversion mechanism similar to C++, via the %implicitconv
214 directive (replaces and improves the implicit.i library).
215 - Python threading support added.
216 - Python STL support improved, iterators are supported and STL containers can
217 use now the native PyObject type.
218 - Python many performance options and improvements, try the -O option to test
219 all of them. Python runtime benchmarks show up to 20 times better performance
220 compared to 1.3.27 and older versions.
221 - Python support for 'multi-inheritance' on the python side.
222 - Python simplified proxy classes, now swig doesn't need to generate the
223 additional 'ClassPtr' classes.
224 - Python extended support for smart pointers.
225 - Python better support for static member variables.
226 - Python backward compatibility improved, many projects that used to work
227 only with swig-1.3.21 to swig-1.3.24 are working again with swig-1.3.28
228 - Python test-suite is now 'valgrinded' before release, and swig also
229 reports memory leaks due to missing destructors.
230 - Minor bug fixes and improvements to the Lua, Ruby, Java, C#, Python, Guile,
231 Chicken, Tcl and Perl modules.
234 - Fix bug in anonymous typedef structures which was leading to strange behaviour
237 - New language modules: Lua, CLISP and Common Lisp with UFFI.
238 - Big overhaul to the PHP module.
239 - Change to the way 'extern' is handled.
240 - Minor bug fixes specific to C#, Java, Modula3, Ocaml, Allegro CL,
241 XML, Lisp s-expressions, Tcl, Ruby and Python modules.
242 - Other minor improvements and bug fixes.
245 - Improved runtime type system. Speed of module loading improved in
246 modules with lots of types. SWIG_RUNTIME_VERSION has been increased
247 from 1 to 2, but the API is exactly the same; only internal changes
249 - The languages that use the runtime type system now support external
250 access to the runtime type system.
251 - Various improvements with typemaps and template handling.
252 - Fewer warnings in generated code.
253 - Improved colour documentation.
254 - Many C# module improvements (exception handling, prevention of early
255 garbage collection, C# attributes support added, more flexible type
256 marshalling/asymmetric types.)
257 - Minor improvements and bug fixes specific to the C#, Java, TCL, Guile,
258 Chicken, MzScheme, Perl, Php, Python, Ruby and Ocaml modules).
259 - Various other bug fixes and memory leak fixes.
262 - Improved enum handling
263 - More runtime library options
264 - More bugs fixes for templates and template default arguments, directors
266 - Better smart pointer support, including data members, static members
270 - Improved support for callbacks
271 - Python docstring support and better error handling
272 - C++ default argument support for Java and C# added.
273 - Improved c++ default argument support for the scripting languages plus
274 option to use original (compact) default arguments.
275 - %feature and %ignore/%rename bug fixes and mods - they might need default
276 arguments specified to maintain compatible behaviour when using the new
277 default arguments wrapping.
278 - Runtime library changes: Runtime code can now exist in more than one module
279 and so need not be compiled into just one module
280 - Further improved support for templates and namespaces
281 - Overloaded templated function support added
282 - More powerful default typemaps (mixed default typemaps)
283 - Some important %extend and director code bug fixes
284 - Guile now defaults to using SCM API. The old interface can be obtained by
286 - Various minor improvements and bug fixes for C#, Chicken, Guile, Java,
287 MzScheme, Perl, Python and Ruby
288 - Improved dependencies generation for constructing Makefiles.
291 - Improved exception handling and translation of C errors or C++
292 exceptions into target language exceptions.
293 - Improved enum support, mapping to built-in Java 1.5 enums and C#
294 enums or the typesafe enum pattern for these two languages.
295 - Python - much better STL suppport and support for std::wstring,
297 - Initial support for Modula3 and Allegro CL.
298 - 64 bit TCL support.
299 - Java and C#'s proxy classes are now nearly 100% generated from
300 typemaps and/or features for finer control on the generated code.
301 - SWIG runtime library support deprecation.
302 - Improved documentation. SWIG now additionally provides documentation
303 in the form of a single HTML page as well as a pdf document.
304 - Enhanced C++ friend declaration support.
305 - Better support for reference counted classes.
306 - Various %fragment improvements.
308 - Various minor improvements and bug fixes for C#, Chicken, Guile, Java,
309 MzScheme, Perl, Php, Python, Ruby and XML.
312 The SWIG-1.3.x development releases offer a huge number of improvements
313 over older SWIG-1.1 releases. These improvements include:
315 - Support for C++ overloaded functions and methods.
316 - Support for C++ smart pointers.
317 - Support for C++ namespaces
318 - Support for C++ overloaded operators.
319 - Support for C++ templates including member templates.
320 - Support for C++ template specialization and partial specialization.
321 - Support for C++ friend declarations.
322 - Parsing support for almost all C/C++ datatypes.
323 - Automatic translation of C++ exception specifiers.
325 - A full C preprocessor with macro expansion. Includes C99 variadic macros.
326 - Java, Ruby, MzScheme, PHP4, OCAML, Pike, CHICKEN, XML and C# modules
327 added. Guile module improved.
328 - Director support - upcalls for C++ virtual functions into the target
329 language proxy class.
330 - Better code generation. SWIG is better able to make optimizations
331 in order to generate less code.
332 - Testing framework part of the distribution ("make -k check" support).
333 - A lot of minor bug fixes and cleanup.
334 - Better Windows support.
336 If you used SWIG-1.1, a number of old features are missing from SWIG-1.3.
338 - The SWIG-1.1 documentation system is gone and hasn't been
339 replaced yet. This is on the long-term to-do list.
341 - The Tcl7.x and Perl4 modules are deprecated and no longer
344 - A wide variety of old SWIG command-line options and
345 obscure features are gone.
347 - A lot of old %pragma directives and obscure undocumented
348 customization features have been eliminated. The same
349 functionality is now available through other means.
351 - Objective C support doesn't work right now. No ETA as to
354 Although we are making some attempt to preserve backwards
355 compatibility with interfaces written for SWIG-1.1, SWIG-1.3
356 incorporates a number of very substantial modifications to type
357 handling, typemaps, and wrapper code generation. Therefore, if you
358 are making extensive use of advanced SWIG features, interfaces written
359 for SWIG-1.1 may not work. We apologize for the inconvenience, but
360 these changes are needed in order to fix a number of annoying
361 "features" in SWIG-1.1. Hopefully the list of new features will
362 provide enough incentive for you to upgrade (and that the
363 modifications to your interfaces will only be minor).
365 In addition, SWIG-1.3 makes no attempt to be compatible with SWIG-1.1 at
366 the C++ API level so language modules written for SWIG-1.1 will most
367 definitely not work with this release.
369 See the documentation for details of the SWIG_VERSION preprocessor
370 symbol if you have backward compatibility issues and need to use more
371 than one version of SWIG.
373 The files NEW and CHANGES describe in some detail all of the important
374 changes that have been made to the system. Experienced users would be
375 well advised to read this.
379 Please see the CHANGES files for a detailed list of bug fixes and
380 new features. A summary of the changes is included in this README file.
384 Please see the Doc/Manual/Windows.html file for instructions on installing
385 SWIG on Windows and running the examples. The Windows distribution is
386 called swigwin and includes a prebuilt SWIG executable, swig.exe, included in
387 the same directory as this README file. Otherwise it is exactly the same as
388 the main SWIG distribution. There is no need to download anything else.
392 You must use GNU `make' to build SWIG.
394 http://www.gnu.org/software/make/
396 To build and install SWIG, simply type the following:
402 By default SWIG installs itself in /usr/local. If you need to install SWIG in
403 a different location or in your home directory, use the --prefix option
404 to ./configure. For example:
406 % ./configure --prefix=/home/yourname/projects
410 Note: the directory given to --prefix must be an absolute pathname. Do *NOT* use
411 the ~ shell-escape to refer to your home directory. SWIG won't work properly
414 The file INSTALL details more about using configure. Also try
416 % ./configure --help.
418 The configure script will attempt to locate various packages on your machine
419 including Tcl, Perl5, Python and all the other target languages that SWIG
420 uses. Don't panic if you get 'not found' messages--SWIG does not need these
421 packages to compile or run. The configure script is actually looking for
422 these packages so that you can try out the SWIG examples contained
423 in the 'Examples' directory without having to hack Makefiles.
425 Please see the Documentation section below on installing documentation as
426 none is installed by default.
428 SWIG used to include a set of runtime libraries for some languages for working
429 with multiple modules. These are no longer built during the installation stage.
430 However, users can build them just like any wrapper module as described in
431 the documentation, Doc/Manual/Modules.html. The CHANGES file also lists some
432 examples which build the runtime library.
436 (1) If you checked the code out via SVN, you will have to run ./autogen.sh
437 before typing 'configure'. In addition, a full build of SWIG requires
440 Macintosh OS X Installation
441 ============================
442 SWIG is known to work on various flavors of OS X. Follow the Unix installation
443 instructions above. However, as of this writing, there is still great deal of
444 inconsistency with how shared libaries are handled by various scripting languages
445 on OS X. We've tried to resolve these differences to the extent of our knowledge.
446 This release was most recently checked with the Panther release of OS X on a
447 Macintosh G5 system. Your mileage may vary.
449 Users of OS X should be aware that Darwin handles shared libraries and linking in
450 a radically different way than most Unix systems. In order to test SWIG and run
451 the examples, SWIG configures itself to use flat namespaces and to allow undefined
452 symbols (-flat_namespace -undefined suppress). This mostly closely follows the Unix
453 model and makes it more likely that the SWIG examples will work with whatever
454 installation of software you might have. However, this is generally not the recommended
455 technique for building larger extension modules. Instead, you should utilize
456 Darwin's two-level namespaces. Some details about this can be found here
458 http://developer.apple.com/documentation/ReleaseNotes/DeveloperTools/TwoLevelNamespaces.html
460 Needless to say, you might have to experiment a bit to get things working at first.
464 If you want to test SWIG before installation, type the following:
468 'make -k check' requires at least one of the target languages to be
469 installed. If it fails, it may mean that you have an uninstalled
470 language module or that the file 'Examples/Makefile' has been
471 incorrectly configured. It may also fail due to compiler issues such
472 as broken C++ compiler. Even if 'make -k check' fails, there is a
473 pretty good chance SWIG still works correctly---you will just have to
474 mess around with one of the examples and some makefiles to get it to work.
476 The testing suite executed by 'make -k check' is designed to stress-test
477 many parts of the implementation including obscure corner cases. If some
478 of these tests fail or generate warning messages, there is no reason for
479 alarm---the test may be related to some new SWIG feature or a difficult bug
480 that we're trying to resolve. Chances are that SWIG will work just fine
481 for you. Note that if you have more than one CPU/core, then you can use
482 parallel make can be used to speed up the check as it does take quite some
483 time to run, for example:
487 Also, SWIG's support for C++ is sufficiently advanced that certain
488 tests may fail on older C++ compilers (for instance if your compiler
489 does not support member templates). These errors are harmless if you
490 don't intend to use these features in your own programs.
492 Note: The test-suite currently contains around 250 tests. If you
493 have many different target languages installed and a slow machine, it
494 might take more than an hour to run the test-suite.
498 The Examples directory contains a variety of examples of using SWIG
499 and it has some browsable documentation. Simply point your browser to
500 the file "Example/index.html".
502 The Examples directory also includes Visual C++ project (.dsp) files for
503 building some of the examples on Windows.
507 There are minor known bugs, details of which are in the bug tracker, see
508 http://www.swig.org/bugs.html.
512 In order to operate correctly, SWIG relies upon a set of library
513 files. If after building SWIG, you get error messages like this,
516 :1. Unable to find 'swig.swg'
517 :3. Unable to find 'tcl8.swg'
519 it means that SWIG has either been incorrectly configured or
520 installed. To fix this:
522 1. Make sure you remembered to do a 'make install' and that
523 the installation actually worked. Make sure you have
524 write permission on the install directory.
526 2. If that doesn't work, type 'swig -swiglib' to find out
527 where SWIG thinks its library is located.
529 3. If the location is not where you expect, perhaps
530 you supplied a bad option to configure. Use
531 ./configure --prefix=pathname to set the SWIG install
532 location. Also, make sure you don't include a shell
533 escape character such as ~ when you specify the path.
535 4. The SWIG library can be changed by setting the SWIG_LIB
536 environment variable. However, you really shouldn't
539 If you are having other troubles, you might look at the SWIG Wiki at
540 http://www.dabeaz.com/cgi-bin/wiki.pl.
544 The Doc/Manual directory contains the most recent set of updated
545 documentation for this release. The documentation is available in
546 three different formats, each of which contains identical content.
547 These format are, pdf (SWIGDocumentation.pdf), single
548 page html (Doc/Manual/SWIGDocumentation.html) or multiple page html
549 (other files in Doc/Manual). Please select your chosen format and
550 copy/install to wherever takes your fancy.
552 This is a development release and the documentation is largely, but
553 not entirely up to date. We are working on it, but there
554 was a lot of old documentation and it is taking some time to
555 update and complete. Please be patient or volunteer to help.
557 There is some technical developer documentation available in the
558 Doc/Devel subdirectory. This is not necessarily up-to-date, but it
559 has some information on SWIG internals.
563 Please report any errors and submit patches (if possible)! We only
564 have access to a limited variety of hardware (Linux, Solaris, OS-X,
565 and Windows). All contributions help.
567 If you would like to join the SWIG development team or contribute a
568 language module to the distribution, please contact the swig-dev
569 mailing list, details at http://www.swig.org/mail.html.
572 -- The SWIG Maintainers