- SWIG
Infobox_Software
name = SWIG
developer = SWIG developers
latest_release_version = 1.3.36
latest_release_date =June 24 ,2008
operating_system =Cross-platform
license =BSD licenses
website = [http://www.swig.org/ www.swig.org/]SWIG (Simplified Wrapper and Interface Generator) is an
open source software tool used to connect programs or libraries written in C/C++ withscripting language s such asTcl ,Perl , Python, Ruby,PHP , Lua, R and other languages like Java, C#, Scheme andOcaml . Output can also be in the form ofXML or Lisp S-expressionsHow does it work?
The aim is to achieve the connection between the programs and the scripting languages with minimal effort: a small number of directives are added to the program's
header file s, and then the SWIG tool createssource code which provides the glue between C/C++ and the target language. Depending on the language, this glue comes in three forms:
* anexecutable that behaves like the original program but embeds an interpreter for the scripting language,
* a shared library that an existing interpreter can link to as some form of extension module, or
* a shared library that can be linked to other programs compiled in the target language (for example, using JNI in Java).Purpose
There are two main purposes of embedding a scripting engine into an existing C/C++ program:
*The program can then be customized much more quickly, using the scripting language rather than C/C++. The scripting engine may even be exposed to the end user, so that they can automate common tasks by writing scripts.
*Even if the final product is not to contain the scripting engine, it may nevertheless be quite useful to write testing scripts.There are several reasons to create dynamic libraries that can be loaded into existing interpreters, including:
*Provide access to a C/C++ library which has no equivalent in the scripting language.
*Write the whole program in the scripting language first, and after profiling, rewrite performance critical code in C or C++.History
SWIG is written in C and C++ and has been publicly available since February
1996 . The initial author and main developer wasDave Beazley who developed SWIG while working as a graduate student atLos Alamos National Laboratory and theUniversity of Utah and while on the faculty at theUniversity of Chicago . Development is currently supported by an active group of volunteers led by William Fulton. SWIG has been released under a BSD type license, meaning it can be used, copied, modified and redistributed freely, for commercial and non-commercial purposes.See also
*
Foreign function interface External links
* [http://www.swig.org/ Project home page]
* [http://swig.sourceforge.net/index.html Project home page] at SourceForge
* [http://www.dabeaz.com/cgi-bin/wiki.pl SwigWiki] -Wiki containing information about using SWIG.
*Article " [http://codeguru.com/csharp/.net/net_asp/scripting/article.php/c11103/ Expose Your C/C++ Program's Internal API with a Quick SWIG] " by Victor Volkman
*Article " [http://www.geocities.com/foetsch/python/extending_python.htm Python Extensions In C++ Using SWIG] " by Michael Fötsch
* [http://citeseer.csail.mit.edu/cs?q=SWIG Citations from CiteSeer]
* [http://www.skwash.com/ sKWash: the open source SWIG GUI]* [http://language-binding.net/pyplusplus/pyplusplus.html Py++] - an object-oriented framework for creating a code generator for [http://www.boost.org/libs/python/doc/index.html Boost.Python] library
Wikimedia Foundation. 2010.