Simplified Wrapper and Interface Generator 2.0.0

A software development tool that connects programs written in C and C++.
SWIG is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages.

The list of supported languages also includes non-scripting languages such as C#, Common Lisp (CLISP, Allegro CL, UFFI), Java, Modula-3 and OCAML. Also several interpreted and compiled Scheme implementations (Guile, MzScheme, Chicken) are supported.

SWIG is most commonly used to create high-level interpreted or compiled programming environments, user interfaces, and as a tool for testing and prototyping C/C++ software. SWIG can also export its parse tree in the form of XML and Lisp s-expressions. SWIG may be freely used, distributed, and modified for commercial and non-commercial use.

Main features:

  • Code Generation:
  • SWIG current generates wrapper code for thirteen different target languages:
  • Allegro CL
  • C#
  • Chicken
  • Guile
  • Java
  • Modula-3
  • Mzscheme
  • Perl
  • PHP
  • Python
  • Ruby
  • Tcl
  • In addition to this, an XML output module is also available and work is in progress on a Pike module.
  • ANSI C:
  • SWIG is capable of wrapping all of ANSI C. Features include:
  • Handling of all ANSI C datatypes.
  • Global functions, global variables, and constants.
  • Structures and unions.
  • Pointers.
  • Arrays and multidimensional arrays.
  • Pointers to functions.
  • Variable length arguments.
  • Typedef.
  • Enums.
  • ANSI C++:
  • SWIG provides wrapping support for almost all of ANSI C++.
  • All C++ datatypes.
  • References.
  • Pointers to members.
  • Classes.
  • Inheritance and multiple inheritance.
  • Overloaded functions and methods (using dynamic dispatch).
  • Overloaded operators.
  • Static members.
  • Namespaces (including using declarations, aliases, nesting, etc.)
  • Templates
  • Member templates
  • Template specialization and partial specialization.
  • Smart pointers
  • Library support for strings, STL vectors, and more.
  • The only major C++ feature not currently supported by SWIG is the wrapping of nested classes--a problem we're working on. SWIG also does not allow C++ virtual methods to be implemented in certain target languages (a subtle feature that might be useful in projects that rely heavily on the use of callback functions).
  • C++ users who rely on advanced template programming techniques (e.g., template meta-programming) should also be aware that SWIG currently requires manual instantiation of all template classes. Therefore, if your application somehow involves the instantiation of 50000 template classes, your mileage might vary.
  • Preprocessing:
  • SWIG provides a full C preprocessor with the following features:
  • Macro expansion.
  • Automatic wrapping of #define statements as constants (when applicable).
  • Support for C99 (variadic macro expansion).
  • Customization features:
  • SWIG provides control over most aspects of wrapper generation. Most of these customization options are fully integrated into the C++ type system--making it easy to apply customizations across inheritance hierarchies, template instantiations, and more. Features include:
  • Customizated type conversion/marshaling.
  • Exception handling.
  • Class/structure extension.
  • Memory management.
  • Ambiguity resolution.
  • Template instantiation.
  • File import and cross-module linking.
  • Code inclusion, helper function support.
  • Extensive diagnostics (error/warning messages).
  • Extended SWIG macro handling.

last updated on:
June 6th, 2010, 16:35 GMT
license type:
BSD License 
developed by:
Dave Beazley
ROOT \ Programming \ Compilers
Simplified Wrapper and Interface Generator
Download Button

In a hurry? Add it to your Download Basket!

user rating 14



Rate it!
What's New in version 1.3.39
  • Some new small feature enhancements.
  • Improved C# std::vector wrappers.
  • Bug fixes: mainly Python, but also Perl, MzScheme, CFFI, Allegrocl and Ruby.
read full changelog

Add your review!