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