SWIG(1)

πŸ’– NAME πŸ’–

swig β€” Simplified Wrapper and Interface Generator ✨ iykyk, the name is literally the whole vibe.


🌸 SYNOPSIS 🌸

swig [options] file

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so bestie, here's the tea β˜• β€” the swig command makes wrapper code that hooks your C and C++ code up to scripting languages like Perl, Python, etc., all starting from the definition of the interface. That's the whole main character move.

If you want the detailed lore on how to actually write those interface definitions, go read /usr/share/doc/swig-doc/Manual/index.html from the swig-doc package. This manpage is not about that β€” it's concentrated on explaining the invocation of the swig command. Just the how-to-run-it part. periodt. πŸ’…


✨ OPTIONS ✨

πŸ‘‘ Supported Target Language Options

Pick your language, get your wrappers. Slay.

  • -csharp β€” Generate C# wrappers
  • -d β€” Generate D wrappers
  • -go β€” Generate Go wrappers
  • -guile β€” Generate Guile wrappers
  • -java β€” Generate Java wrappers
  • -javascript β€” Generate Javascript wrappers
  • -lua β€” Generate Lua wrappers
  • -octave β€” Generate Octave wrappers
  • -perl5 β€” Generate Perl 5 wrappers
  • -php7 β€” Generate PHP 8 or later wrappers
  • -python β€” Generate Python wrappers
  • -r β€” Generate R (aka GNU S) wrappers
  • -ruby β€” Generate Ruby wrappers
  • -scilab β€” Generate Scilab wrappers
  • -tcl8 β€” Generate Tcl 8 wrappers
  • -xml β€” Generate XML wrappers

πŸ§ͺ Experimental Target Language Options

these are the experimental girlies, tread accordingly 🫢

  • -c β€” Generate C wrappers
  • -ocaml β€” Generate OCaml wrappers

πŸŽ€ General Options

  • -addextern β€” Add extra extern declarations
  • -c++ β€” Enable C++ processing
  • -co <file> β€” Check <file> out of the SWIG library
  • -copyctor β€” Automatically generate copy constructors wherever possible
  • -cpperraswarn β€” Treat the preprocessor #error statement as #warning (this is the default, no cap)
  • -cppext <ext> β€” Change file extension of generated C++ files to <ext> (default is cxx)
  • -copyright β€” Display copyright notices
  • -debug-classes β€” 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
  • -debug-symtabs β€” Display symbol tables information
  • -debug-symbols β€” Display target language symbols in the symbol tables
  • -debug-csymbols β€” Display C symbols in the symbol tables
  • -debug-lsymbols β€” Display target language layer symbols
  • -debug-quiet β€” Display less parse tree node debug info when using other -debug options
  • -debug-tags β€” Display information about the tags found in the interface
  • -debug-template β€” Display information for debugging templates
  • -debug-top <n> β€” Display entire parse tree at stages 1-4, <n> is a csv list of stages
  • -debug-typedef β€” Display information about the types and typedefs in the interface
  • -debug-typemap β€” Display typemap debugging information
  • -debug-tmsearch β€” Display typemap search debugging information
  • -debug-tmused β€” Display typemaps used debugging information
  • -directors β€” Turn on director mode for all the classes, mainly for testing
  • -dirprot β€” Turn on wrapping of protected members for director classes (default)
  • -D<symbol>[=<value>] β€” Define symbol <symbol> (for conditional compilation)
  • -E β€” 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>
  • -fcompact β€” 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
  • -fastdispatch β€” Enable fast dispatch mode to produce faster overload dispatcher code
  • -Fmicrosoft β€” Display error/warning messages in Microsoft format
  • -Fstandard β€” Display error/warning messages in commonly used format
  • -fvirtual β€” Compile in virtual elimination mode
  • -help β€” Display help
  • -I- β€” Don't search the current directory
  • -I<dir> β€” Look for SWIG files in directory <dir>
  • -ignoremissing β€” Ignore missing include files
  • -importall β€” Follow all #include statements as imports
  • -includeall β€” Follow all #include statements
  • -l<ifile> β€” Include SWIG library file <ifile>
  • -macroerrors β€” Report errors inside macros
  • -M β€” List all dependencies
  • -MD β€” Is equivalent to -M -MF <file>, except -E is not implied
  • -MF <file> β€” Generate dependencies into <file> and continue generating wrappers
  • -MM β€” List dependencies, but omit files in SWIG library
  • -MMD β€” Like -MD, but omit files in SWIG library
  • -module <name> β€” Set module name to <name>
  • -MP β€” Generate phony targets for all dependencies
  • -MT <target> β€” Set the target of the rule emitted by dependency generation
  • -nocontract β€” Turn off contract checking
  • -nocpperraswarn β€” Do not treat the preprocessor #error statement as #warning
  • -nodefaultctor β€” Do not generate implicit default constructors
  • -nodefaultdtor β€” Do not generate implicit default destructors
  • -nodirprot β€” Do not wrap director protected members
  • -noexcept β€” Do not wrap exception specifiers
  • -nofastdispatch β€” Disable fast dispatch mode (default)
  • -nopreprocess β€” Skip the preprocessor step
  • -notemplatereduce β€” Disable reduction of the typedefs in templates
  • -O β€” Enable the optimization options: -fastdispatch -fvirtual
  • -o <outfile> β€” Set name of C/C++ output file to <outfile>
  • -oh <headfile> β€” Set name of C++ output header file for directors to <headfile>
  • -outcurrentdir β€” Set default output dir to current dir instead of input file's path
  • -outdir <dir> β€” Set language specific files output directory to <dir>
  • -pcreversion β€” Display PCRE2 version information
  • -small β€” Compile in virtual elimination and compact mode
  • -std=<standard> β€” Set the C or C++ language <standard> for inputs
  • -swiglib β€” Report location of SWIG library and exit
  • -templatereduce β€” Reduce all the typedefs in templates
  • -U<symbol> β€” Undefine symbol <symbol>
  • -v β€” Run in verbose mode
  • -version β€” Display SWIG version number
  • -Wall β€” Remove all warning suppression, also implies -Wextra
  • -Wallkw β€” Enable keyword warnings for all the supported languages
  • -Werror β€” Treat warnings as errors 😭
  • -Wextra β€” Adds the following additional warnings: 309,403,405,512,321,322
  • -w<list> β€” Suppress/add warning messages, eg -w401,+321 β€” see Warnings.html
  • -xmlout <file> β€” Write XML version of the parse tree to <file> after normal processing

Options can also be defined using the SWIG_FEATURES environment variable, for example:

$ SWIG_FEATURES="-Wall"
$ export SWIG_FEATURES
$ swig -python interface.i

is equivalent to:

$ swig -Wall -python interface.i

Arguments may also be passed in a file, separated by whitespace. For example:

$ echo "-Wall -python interface.i" > args.txt
$ swig @args.txt
Note: swig -<lang> -help displays options for a specific target language. 🫢

And for the record, the build you're reading about says:

SWIG Version 4.5.0

Compiled with x86_64-linux-gnu-g++ [x86_64-pc-linux-gnu]

Configured options: +pcre

Please see https://www.swig.org for reporting bugs and further information πŸ’–


🌈 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@debian.org> and Rafael Laboissi??re <rafael@debain.org> for the Debian project (but may be used by others). iconic honestly πŸ‘‘


πŸ’œ SEE ALSO πŸ’œ

For more information, see file /usr/share/doc/swig/Manual/SWIG.html from the swig-doc package. go read it bestie, it's giving comprehensive πŸ“šβœ¨


and that's the whole page, no notes πŸ’… this one is from the swig section of the manual, dated August 2026, and it's SWIG version page SWIG(1) β€” okay bye, go wrap something πŸ¦‹πŸ’–πŸŽ€

πŸ“¦ where this page comes from