man > swig(1)

TLDR: swig (tldr-pages)

Generate bindings between C/C++ code and various high level languages such as JavaScript, Python, C#, and more.

  • Generate a binding between C++ and Python
    swig -c++ -python -o {{path/to/output_wrapper.cpp}} {{path/to/swig_file.i}}
  • Generate a binding between C++ and Go
    swig -go -cgo -intgosize 64 -c++ {{path/to/swig_file.i}}
  • Generate a binding between C and Java
    swig -java {{path/to/swig_file.i}}
  • Generate a binding between C and Ruby and prefix the Ruby module with `foo::bar::`
    swig -ruby -prefix "{{foo::bar::}}" {{path/to/swig_file.i}}
SWIG(1)                                General Commands Manual                               SWIG(1)

NAME
       swig - Simplified Wrapper and Interface Generator

SYNOPSIS
       swig [options] file


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


OPTIONS
   Target Language Options:
       -chicken
              Generate CHICKEN wrappers

       -csharp
              Generate C# wrappers

       -guile Generate Guile wrappers

       -java  Generate Java wrappers

       -mzscheme
              Generate Mzscheme wrappers

       -ocaml Generate Ocaml wrappers

       -perl  Generate Perl wrappers.

       -php   Generate PHP wrappers

       -pike  Generate Pike wrappers

       -python
              Generate Python wrappers

       -ruby  Generate Ruby wrappers

       -sexp  Generate Lisp S-Expressions wrappers

       -tcl   Generate Tcl wrappers

       -xml   Generate XML wrappers.


   General Options
       -c++   Enable C++ processing

       -co    Check a file out of the SWIG library

       -dirprot
              Turn on wrapping of protected members for director classes

       -Dsymbol
              Define a symbol symbol (for conditional compilation)

       -E     Preprocess only, does not generate wrapper code

       -fcompact
              Compile in compact mode

       -fvirtual
              Compile in virtual elimination mode

       -Fstandard
              Display error/warning messages in commonly used format

       -Fmicrosoft
              Display error/warning messages in Microsoft format

       -help  Show a summary of supported options and especially of supported options  for  the  se‐
              lected language.

       -Idir  Look for SWIG files in dir

       -ignoremissing
              Ignore missing include files

       -importall
              Follow all #include statements as imports

       -includeall
              Follow all #include statements

       -lifile
              Include SWIG library file ifile

       -M     List all dependencies

       -MM    List dependencies, but omit files in SWIG library

       -makedefault
              Create default constructors/destructors (the default)

       -module name
              Set module name to name

       -nocontract
              Turn off contract checking

       -nodefault
              Do not generate constructors/destructors

       -nodirprot
              Do not wrap director protected members

       -noexcept
              Do not wrap exception specifiers

       -noextern
              Do not generate extern declarations

       -noruntime
              Do not include SWIG runtime code

       -o outfile
              Set name of the output file to outfile

       -outdir dir
              Set language specific files output directory

       -runtime
              Make the runtime support code globally visible.

       -small Compile in virtual elimination & compact mode

       -swiglib
              Report location of SWIG library and exit

       -v     Run in verbose mode

       -version
              Print SWIG version number

       -Wall  Enable all warning messages

       -Wallkw
              Enable warning messages for all the languages keywords

       -Werror
              Force to treat the warnings as errors

       -w n   Suppress warning number n

AUTHOR
       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> for the Debian project (but may be used by others).

                                             2004-05-22                                      SWIG(1)
swig(1)
NAME SYNOPSIS DESCRIPTION OPTIONS
Target Language Options: -chicken -csharp -guile Generate Guile wrappers -java Generate Java wrappers -mzscheme -ocaml Generate Ocaml wrappers -perl Generate Perl wrappers. -php Generate PHP wrappers -pike Generate Pike wrappers -python -ruby Generate Ruby wrappers -sexp Generate Lisp S-Expressions wrappers -tcl Generate Tcl wrappers -xml Generate XML wrappers. General Options -c++ Enable C++ processing -co Check a file out of the SWIG library -dirprot -Dsymbol -E Preprocess only, does not generate wrapper code -fcompact -fvirtual -Fstandard -Fmicrosoft -help Show a summary of supported options and especially of supported options for the se‐ -Idir Look for SWIG files in dir -ignoremissing -importall -includeall -lifile -M List all dependencies -MM List dependencies, but omit files in SWIG library -makedefault -module name -nocontract -nodefault -nodirprot -noexcept -noextern -noruntime -o outfile -outdir dir -runtime -small Compile in virtual elimination & compact mode -swiglib -v Run in verbose mode -version -Wall Enable all warning messages -Wallkw -Werror -w n Suppress warning number n
AUTHOR

Generated by phpman v4.10.0-7-g98e9fd5 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-09-03 09:44 @216.73.216.239
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!

^_top_^