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
15 interface 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 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-tags
110 Display information about the tags found in the interface
111
112 -debug-template
113 Display information for debugging templates
114
115 -debug-top <n>
116 Display entire parse tree at stages 1-4, <n> is a csv list of
117 stages
118
119 -debug-typedef
120 Display information about the types and typedefs in the inter‐
121 face
122
123 -debug-typemap
124 Display typemap debugging information
125
126 -debug-tmsearch
127 Display typemap search debugging information
128
129 -debug-tmused
130 Display typemaps used debugging information
131
132 -directors
133 Turn on director mode for all the classes, mainly for testing
134
135 -dirprot
136 Turn on wrapping of protected members for director classes
137 (default)
138
139 -D<symbol>
140 Define a symbol <symbol> (for conditional compilation)
141
142 -E Preprocess only, does not generate wrapper code
143
144 -external-runtime [file]
145 Export the SWIG runtime stack
146
147 -fakeversion <v> Make SWIG fake the program version number to <v>
148
149 -fcompact
150 Compile in compact mode
151
152 -features <list> Set global features, where <list> is a comma separated
153 list of
154 features, eg -features directors,autodoc=1 If no explicit value
155 is given to the feature, a default of 1 is used
156
157 -fastdispatch
158 Enable fast dispatch mode to produce faster overload dispatcher
159 code
160
161 -Fmicrosoft
162 Display error/warning messages in Microsoft format
163
164 -Fstandard
165 Display error/warning messages in commonly used format
166
167 -fvirtual
168 Compile in virtual elimination mode
169
170 -help Display help
171
172 -I - Don't search the current directory
173
174 -I<dir>
175 Look for SWIG files in directory <dir>
176
177 -ignoremissing
178 Ignore missing include files
179
180 -importall
181 Follow all #include statements as imports
182
183 -includeall
184 Follow all #include statements
185
186 -l<ifile>
187 Include SWIG library file <ifile>
188
189 -macroerrors
190 Report errors inside macros
191
192 -makedefault
193 Create default constructors/destructors (the default)
194
195 -M List all dependencies
196
197 -MD Is equivalent to `-M -MF <file>', except `-E' is not implied
198
199 -MF <file>
200 Generate dependencies into <file> and continue generating wrap‐
201 pers
202
203 -MM List dependencies, but omit files in SWIG library
204
205 -MMD Like `-MD', but omit files in SWIG library
206
207 -module <name>
208 Set module name to <name>
209
210 -MP Generate phony targets for all dependencies
211
212 -MT <target>
213 Set the target of the rule emitted by dependency generation
214
215 -nocontract
216 Turn off contract checking
217
218 -nocpperraswarn
219 Do not treat the preprocessor #error statement as #warning
220
221 -nodefault
222 Do not generate default constructors nor default destructors
223
224 -nodefaultctor
225 Do not generate implicit default constructors
226
227 -nodefaultdtor
228 Do not generate implicit default destructors
229
230 -nodirprot
231 Do not wrap director protected members
232
233 -noexcept
234 Do not wrap exception specifiers
235
236 -nofastdispatch
237 Disable fast dispatch mode (default)
238
239 -nopreprocess
240 Skip the preprocessor step
241
242 -notemplatereduce
243 Disable reduction of the typedefs in templates
244
245 -O Enable the optimization options: -fastdispatch -fvirtual
246
247 -o <outfile>
248 Set name of C/C++ output file to <outfile>
249
250 -oh <headfile>
251 Set name of C++ output header file for directors to <headfile>
252
253 -outcurrentdir
254 Set default output dir to current dir instead of input file's
255 path
256
257 -outdir <dir>
258 Set language specific files output directory to <dir>
259
260 -pcreversion
261 Display PCRE version information
262
263 -small Compile in virtual elimination and compact mode
264
265 -swiglib
266 Report location of SWIG library and exit
267
268 -templatereduce
269 Reduce all the typedefs in templates
270
271 -v Run in verbose mode
272
273 -version
274 Display SWIG version number
275
276 -Wall Remove all warning suppression, also implies -Wextra
277
278 -Wallkw
279 Enable keyword warnings for all the supported languages
280
281 -Werror
282 Treat warnings as errors
283
284 -Wextra
285 Adds the following additional warnings:
286 202,309,403,405,512,321,322
287
288 -w<list>
289 Suppress/add warning messages, eg -w401,+321 - see Warnings.html
290
291 -xmlout <file>
292 Write XML version of the parse tree to <file> after normal pro‐
293 cessing
294
295 Options can also be defined using the SWIG_FEATURES environment vari‐
296 able, for example:
297
298 $ SWIG_FEATURES="-Wall"
299 $ export SWIG_FEATURES
300 $ swig -python interface.i
301
302 is equivalent to:
303
304 $ swig -Wall -python interface.i
305
306 Arguments may also be passed in a file, separated by whitespace. For
307 example:
308
309 $ echo "-Wall -python interface.i" > args.txt
310 $ swig @args.txt
311
312 Note: 'swig -<lang> -help' displays options for a specific target lan‐
313 guage.
314
316 SWIG was originally created by David Beazley. For up-to-date informa‐
317 tion about authors and contributors please check
318 http://www.swig.org/guilty.html. This manual page was written by
319 Torsten Landschoff <torsten@debian.org> and updated by Jitka Plesnikova
320 <jplesnik@redhat.com> (but may be used by others).
321
322
323
324swig November 2019 SWIG(1)