1SWIG(1) User Commands SWIG(1)
2
3
4
6 swig - Simplified Wrapper and Interface Generator
7
9 swig [ options ] " file"
10
12 The swig command is used to create wrapper code to connect C and C++
13 code to scripting languages like Perl, Python, Tcl etc. from the defi‐
14 nition of the interface. For detailed information on writing those in‐
15 terface definitions please refer to /usr/share/doc/swig-doc/Doc/Man‐
16 ual/index.html from the swig-doc package.
17
18 This manpage concentrates on explaining the invocation of the swig com‐
19 mand.
20
22 Supported Target Language Options
23
24 -csharp
25 Generate C# wrappers
26
27 -d Generate D wrappers
28
29 -go Generate Go wrappers
30
31 -guile Generate Guile wrappers
32
33 -java Generate Java wrappers
34
35 -javascript
36 Generate Javascript wrappers
37
38 -lua Generate Lua wrappers
39
40 -octave
41 Generate Octave wrappers
42
43 -perl5 Generate Perl 5 wrappers
44
45 -php7 Generate PHP 7 or later wrappers
46
47 -python
48 Generate Python wrappers
49
50 -r Generate R (aka GNU S) wrappers
51
52 -ruby Generate Ruby wrappers
53
54 -scilab
55 Generate Scilab wrappers
56
57 -tcl8 Generate Tcl 8 wrappers
58
59 -xml Generate XML wrappers
60
61 Experimental Target Language Options
62
63 -mzscheme
64 Generate MzScheme/Racket wrappers
65
66 -ocaml Generate OCaml wrappers
67
68 General Options
69
70 -addextern
71 Add extra extern declarations
72
73 -c++ Enable C++ processing
74
75 -co <file>
76 Check <file> out of the SWIG library
77
78 -copyctor
79 Automatically generate copy constructors wherever possible
80
81 -cpperraswarn
82 Treat the preprocessor #error statement as #warning (default)
83
84 -cppext <ext>
85 Change file extension of generated C++ files to <ext> (default
86 is cxx)
87
88 -copyright
89 Display copyright notices
90
91 -debug-classes
92 Display information about the classes found in the interface
93
94 -debug-module <n> Display module parse tree at stages 1-4, <n> is a csv
95 list of stages
96
97 -debug-symtabs
98 Display symbol tables information
99
100 -debug-symbols
101 Display target language symbols in the symbol tables
102
103 -debug-csymbols
104 Display C symbols in the symbol tables
105
106 -debug-lsymbols
107 Display target language layer symbols
108
109 -debug-quiet
110 Display less parse tree node debug info when using other -debug
111 options
112
113 -debug-tags
114 Display information about the tags found in the interface
115
116 -debug-template
117 Display information for debugging templates
118
119 -debug-top <n>
120 Display entire parse tree at stages 1-4, <n> is a csv list of
121 stages
122
123 -debug-typedef
124 Display information about the types and typedefs in the inter‐
125 face
126
127 -debug-typemap
128 Display typemap debugging information
129
130 -debug-tmsearch
131 Display typemap search debugging information
132
133 -debug-tmused
134 Display typemaps used debugging information
135
136 -directors
137 Turn on director mode for all the classes, mainly for testing
138
139 -dirprot
140 Turn on wrapping of protected members for director classes (de‐
141 fault)
142
143 -D<symbol>
144 Define a symbol <symbol> (for conditional compilation)
145
146 -E Preprocess only, does not generate wrapper code
147
148 -external-runtime [file]
149 Export the SWIG runtime stack
150
151 -fakeversion <v> Make SWIG fake the program version number to <v>
152
153 -fcompact
154 Compile in compact mode
155
156 -features <list> Set global features, where <list> is a comma separated
157 list of
158 features, eg -features directors,autodoc=1 If no explicit value
159 is given to the feature, a default of 1 is used
160
161 -fastdispatch
162 Enable fast dispatch mode to produce faster overload dispatcher
163 code
164
165 -Fmicrosoft
166 Display error/warning messages in Microsoft format
167
168 -Fstandard
169 Display error/warning messages in commonly used format
170
171 -fvirtual
172 Compile in virtual elimination mode
173
174 -help Display help
175
176 -I - Don't search the current directory
177
178 -I<dir>
179 Look for SWIG files in directory <dir>
180
181 -ignoremissing
182 Ignore missing include files
183
184 -importall
185 Follow all #include statements as imports
186
187 -includeall
188 Follow all #include statements
189
190 -l<ifile>
191 Include SWIG library file <ifile>
192
193 -macroerrors
194 Report errors inside macros
195
196 -makedefault
197 Create default constructors/destructors (the default)
198
199 -M List all dependencies
200
201 -MD Is equivalent to `-M -MF <file>', except `-E' is not implied
202
203 -MF <file>
204 Generate dependencies into <file> and continue generating wrap‐
205 pers
206
207 -MM List dependencies, but omit files in SWIG library
208
209 -MMD Like `-MD', but omit files in SWIG library
210
211 -module <name>
212 Set module name to <name>
213
214 -MP Generate phony targets for all dependencies
215
216 -MT <target>
217 Set the target of the rule emitted by dependency generation
218
219 -nocontract
220 Turn off contract checking
221
222 -nocpperraswarn
223 Do not treat the preprocessor #error statement as #warning
224
225 -nodefault
226 Do not generate default constructors nor default destructors
227
228 -nodefaultctor
229 Do not generate implicit default constructors
230
231 -nodefaultdtor
232 Do not generate implicit default destructors
233
234 -nodirprot
235 Do not wrap director protected members
236
237 -noexcept
238 Do not wrap exception specifiers
239
240 -nofastdispatch
241 Disable fast dispatch mode (default)
242
243 -nopreprocess
244 Skip the preprocessor step
245
246 -notemplatereduce
247 Disable reduction of the typedefs in templates
248
249 -O Enable the optimization options: -fastdispatch -fvirtual
250
251 -o <outfile>
252 Set name of C/C++ output file to <outfile>
253
254 -oh <headfile>
255 Set name of C++ output header file for directors to <headfile>
256
257 -outcurrentdir
258 Set default output dir to current dir instead of input file's
259 path
260
261 -outdir <dir>
262 Set language specific files output directory to <dir>
263
264 -pcreversion
265 Display PCRE2 version information
266
267 -small Compile in virtual elimination and compact mode
268
269 -swiglib
270 Report location of SWIG library and exit
271
272 -templatereduce
273 Reduce all the typedefs in templates
274
275 -v Run in verbose mode
276
277 -version
278 Display SWIG version number
279
280 -Wall Remove all warning suppression, also implies -Wextra
281
282 -Wallkw
283 Enable keyword warnings for all the supported languages
284
285 -Werror
286 Treat warnings as errors
287
288 -Wextra
289 Adds the following additional warnings: 309,403,405,512,321,322
290
291 -w<list>
292 Suppress/add warning messages, eg -w401,+321 - see Warnings.html
293
294 -xmlout <file>
295 Write XML version of the parse tree to <file> after normal pro‐
296 cessing
297
298 Options can also be defined using the SWIG_FEATURES environment vari‐
299 able, for example:
300
301 $ SWIG_FEATURES="-Wall"
302 $ export SWIG_FEATURES
303 $ swig -python interface.i
304
305 is equivalent to:
306
307 $ swig -Wall -python interface.i
308
309 Arguments may also be passed in a file, separated by whitespace. For
310 example:
311
312 $ echo "-Wall -python interface.i" > args.txt
313 $ swig @args.txt
314
315 Note: 'swig -<lang> -help' displays options for a specific target lan‐
316 guage.
317
319 SWIG was originally created by David Beazley. For up-to-date informa‐
320 tion about authors and contributors please check
321 http://www.swig.org/guilty.html. This manual page was written by
322 Torsten Landschoff <torsten@debian.org> and updated by Jitka Plesnikova
323 <jplesnik@redhat.com> (but may be used by others).
324
325
326
327h2m_helper_swig July 2023 SWIG(1)