SWIG

From Wikipedia, the free encyclopedia

SWIG (Simplified Wrapper and Interface Generator) is an open source software tool used to connect programs or libraries written in C/C++ with scripting languages such as Tcl, Perl, Python, Ruby, PHP and other languages like Java, C#, Scheme and Ocaml.

The aim is to achieve this connection with minimal effort: a small number of directives are added to the program's header files, and then the SWIG tool creates source code which provides the glue between C/C++ and the target language. Depending on the language, this glue comes in three forms:

  • an executable 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).

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++.

SWIG is written in C and C++ and has been publicly available since February 1996. The initial author and main developer was Dave Beazley, now at the University of Chicago, who developed SWIG while working as a graduate student at Los Alamos National Laboratory and the University of Utah. Development is currently supported by an active group of volunteers. 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.

Advanced Search
Included Web Search Engines


Safe Search

close

Top Matching Results

Occasionally Search.com will highlight specialized results that are based on the context of your query. Examples of specialized results include specific links to news, images, or video.

Top Matching Results may highlight information from other Search.com pages, content from the CNET Network of sites, or third party content. The listings are based purely on relevance. Search.com does not receive payment for listings in this section but our partners that provide this data may get paid for listing these products.

Sponsored Links

This section contains paid listings which have been purchased by companies that want to have their sites appear for specific search terms and related content. These listings are administered, sorted and maintained by a third party and are not endorsed by Search.com.

Search Results

Search.com sends your search query to several search engines at one time and integrates the results into one list which has been sorted by relevance using Search.com's proprietary algorithm. You can customize the list of search engines included in your metasearch from the preferences.

The search engines that are used in your metasearch may allow companies to pay to have their Web sites included within the results. To view the Paid Inclusion policy for a specific search engine, please visit their Web site. Search.com does not accept payment or share revenue with any search engine partner for listings in this section.