swig (1) - Linux Manuals

swig: Simplified Wrapper and Interface Generator


swig - Simplified Wrapper and Interface Generator


swig [options] file


The swig command is used to create wrapper code to connect C and C++ code to scripting languages like Perl, Python, Tcl etc. from the definition of the interface. For detailed information on writing those interface definitions please refer to /usr/share/doc/swig-doc-2.0.9/Doc/Manual/index.html from the swig-doc package. This manpage concentrates on explaining the invocation of the swig command.


Target Language Options:

Generate ALLEGROCL wrappers
Generate CHICKEN wrappers
Generate CLISP wrappers
Generate CFFI wrappers
Generate C# wrappers
Generate D wrappers
Generate Go wrappers
Generate Guile wrappers
Generate Java wrappers
Generate Lua wrappers
Generate Modula 3 wrappers
Generate Mzscheme wrappers
Generate Ocaml wrappers
Generate Octave wrappers
Generate Perl wrappers
Generate PHP wrappers
Generate Pike wrappers
Generate Python wrappers
Generate R (aka GNU S) wrappers
Generate Ruby wrappers
Generate Lisp S-Expressions wrappers
Generate Tcl wrappers
Generate Common Lisp / UFFI wrappers
Generate XML wrappers i

General Options:

Add extra extern declarations
Enable C++ processing
-co file
Check file out of the SWIG library
Automatically generate copy constructors wherever possible
Treat the preprocessor #error statement as #warning (default)
Display copyright notices
Display information about the classes found in the interface
-debug-module n
Display module parse tree at stages 1-4, n is a csv list of stages
Display symbol tables information
Display target language symbols in the symbol tables
Display C symbols in the symbol tables
Display target language layer symbols
Display information about the tags found in the interface
Display information for debugging templates
-debug-top n
Display entire parse tree at stages 1-4, n is a csv list of stages
Display information about the types and typedefs in the interface
Display typemap debugging information
Display typemap search debugging information
Display typemaps used debugging information
Turn on director mode for all the classes, mainly for testing
Turn on wrapping of protected members for director classes (default)
Define a symbol symbol (for conditional compilation)
Preprocess only, does not generate wrapper code
-external-runtime [file]
Export the SWIG runtime stack
-fakeversion v
Make SWIG fake the program version number to v
Compile in compact mode
-features list
Set global features, where list is a comma separated list of features, eg -features directors,autodoc=1 If no explicit value is given to the feature, a default of 1 is used
Enable fast dispatch mode to produce faster overload dispatcher code
Display error/warning messages in Microsoft format
Display error/warning messages in commonly used format
Compile in virtual elimination mode
This output
Don't search the current directory
Look for SWIG files in directory dir
Ignore missing include files
Follow all #include statements as imports
Follow all #include statements
Include SWIG library file ifile
Report errors inside macros
Create default constructors/destructors (the default)
List all dependencies
Is equivalent to '-M -MF file', except '-E' is not implied
-MF file
Generate dependencies into file and continue generating wrappers
List dependencies, but omit files in SWIG library
Like '-MD', but omit files in SWIG library
-module name
Set module name to name
Generate phony targets for all dependencies
-MT target
Set the target of the rule emitted by dependency generation
Turn off contract checking
Do not treat the preprocessor #error statement as #warning
Do not generate default constructors nor default destructors
Do not generate implicit default constructors
Do not generate implicit default destructors
Do not wrap director protected members
Do not wrap exception specifiers
Disable fast dispatch mode (default)
Skip the preprocessor step
Disable reduction of the typedefs in templates
Enable the optimization options: -fastdispatch -fvirtual
-o outfile
Set name of the output file to outfile
-oh headfile
Set name of the output header file to headfile
Set default output dir to current dir instead of input file's path
-outdir dir
Set language specific files output directory to dir
Display PCRE version information
Compile in virtual elimination & compact mode
Report location of SWIG library and exit
Reduce all the typedefs in templates
Run in verbose mode
Display SWIG version number
Remove all warning suppression, also implies -Wextra
Enable keyword warnings for all the supported languages
Treat warnings as errors
Adds the following additional warnings: 202,309,403,512,321,322
Suppress/add warning messages, eg -w401,+321 see Warnings.html
-xmlout file
Write XML version of the parse tree to file after normal processing

Tcl 8 Options (available with -tcl)

Enable ITcl support
Leave out SafeInit module function.
-prefix name
Set a prefix name to be prepended to all names
Build module into a Tcl 8 namespace
Set package version

Note: 'swig -lang -help' displays options for a specific target language.


SWIG was originally created by David Beazley. For up-to-date information about authors and contributors please check http://www.swig.org/guilty.html. This manual page was written by Torsten Landschoff <torsten [at] debian.org> and updated by Jitka Plesnikova <jplesnik [at] redhat.com> (but may be used by others).