aboutsummaryrefslogtreecommitdiff
path: root/README
blob: 20a3b0f860420cc133991d08e9d939016f05e8ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
SWIG (Simplified Wrapper and Interface Generator)

Version: 1.3.13 (June 17, 2002)

$Header$

Tagline: SWIG is a compiler that integrates C and C++ with
         languages including Perl, Python, Tcl, Guile, Mzscheme,
         Java, Ruby, and PHP.

SWIG reads annotated C/C++ header files and creates wrapper code (glue
code) in order to make the corresponding C/C++ libraries available to
the listed languages, or to extend C/C++ programs with a scripting
language.

This distribution represents the latest development release of SWIG,
aiming to replace versions 1.1p5 and 1.1-883. The guilty parties
working on this are:

 Dave Beazley (beazley@cs.uchicago.edu)                 (SWIG core, Python, Tcl, Perl)
 William Fulton (wsf@fultondesigns.co.uk)               (Java)
 Matthias Köppe (mkoeppe@mail.math.uni-magdeburg.de)    (Guile/MzScheme)
 Loic Dachary (loic@ceic.com)                           (Perl5)
 Jason Stewart (jason@openinformatics.com)              (Perl5)
 Thien-Thi Nguyen (ttn@glug.org)                        (Testing/Misc)
 Lyle Johnson (lyle@users.sourceforge.net)              (Ruby)
 Masaki Fukushima (fukusima@goto.info.waseda.ac.jp)     (Ruby)
 Richard Palmer (richard@magicality.org)                (PHP)
 Luigi Ballabio (ballabio@mac.com)                      (Macintosh port)
 Sam Liddicott (saml@liddicott.com)                     (PHP)

Past contributors include:

Clark McGrew, Dustin Mitchell, Ian Cooke, Catalin Dumitrescu, Baran
Kovuk, Gary Holt, David Fletcher, Oleg Tolmatcev, Harco de Hilster.
(See CHANGES for a more complete list).

Up-to-date SWIG related information can be found at

        http://www.swig.org

A SWIG FAQ and other hints can be found on the SWIG Wiki:

       http://swig.cs.uchicago.edu/cgi-bin/wiki.pl
 
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!                      IMPORTANT                         !!!!!!!
!!!!!!!                                                        !!!!!!!
!!!!!!! Previous SWIG users should read the documentation      !!!!!!!
!!!!!!! file Doc/Manual/SWIG.html before trying to use SWIG1.3 !!!!!!!
!!!!!!! on existing SWIG interfaces.  This is the most current !!!!!!!
!!!!!!! documentation that describes new 1.3 features and      !!!!!!!
!!!!!!! incompatibilities.                                     !!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

What's New?
===========
The most notable changes since SWIG1.1 include the following:

   - Support for C++ namespaces

   - Support for C++ overloaded operators.

   - Support for C++ templates including member templates,
     specialization, and partial specialization.

   - Improved support for overloaded functions/methods.

   - Parsing support for almost all C/C++ datatypes.

   - Pointers to members are now supported in the parser
     and by the Python module.

   - Improved support for pointers to functions and callbacks.

   - SWIG now has a full C preprocessor with macro expansion. 
     Includes C99 variadic macro support.

   - Code generation for the Tcl and Python modules has been
     substantially improved both in terms of size and runtime
     efficiency (Perl5 is coming along too).

   - The Guile module is stable. It represents C pointers as smobs and
     supports the Guile module system and exceptions.

   - Java, Ruby, MzScheme, PHP4 modules added.

   - Redesigned implementation of typemaps.  Typemaps can now be defined
     for groups of consecutive function arguments.  This has been a long
     requested feature that now works.

   - Better code generation.   SWIG is better able to make optimizations
     in order to generate less code.

   - Testing framework part of the distribution ("make -k check" support).

   - A lot of minor bug fixes and cleanup.

   - Better Windows support.

Here are a few missing features:

   - The SWIG1.1 documentation system is gone and hasn't been
     replaced yet.  This is on the long-term to-do list.

   - The Tcl7.x and Perl4 modules are deprecated and no longer
     included.

   - The Perl5 module is need in some repair and may not work
     with ActivePerl.  We are looking for volunteers to help us
     with this.

   - A wide variety of old SWIG command-line options and
     obscure features are gone.

   - A lot of old %pragma directives and obscure undocumented
     customization features have been eliminated.  The same
     functionality is now available through other means.

   - Objective C support doesn't work right now.  No ETA as to
     when it will return.

Although we are making some attempt to preserve backwards
compatibility with interfaces written for SWIG1.1, SWIG1.3
incorporates a number of very substantial modifications to things such
as type handling, typemaps, and wrapper code generation.  Therefore,
if you are making extensive use of advanced SWIG features, interfaces
written for SWIG1.1 may not work.  We apologize for the inconvenience,
but these changes are needed in order to fix a number of annoying
"features" in SWIG1.1.  Hopefully the list of new features will
provide enough incentive for you to upgrade (and that the
modifications to your interfaces will only be minor).

In addition, SWIG1.3 makes no attempt to be compatible with SWIG1.1 at
the C++ API level so language modules written for SWIG1.1 will most
definitely not work with this release.

The files NEW and CHANGES describe in some detail all of the important
changes that have been made to the system.  Experienced users would be
well advised to read this.

Windows Installation
====================
Please see the Doc/Manual/Windows.html file for instructions on installing 
SWIG on Windows and running the examples. The Windows distribution is 
called swigwin and includes a prebuilt SWIG executable, swig.exe, included in
the same directory as this README file. Otherwise it is exactly the same as 
the main SWIG distribution. There is no need to download anything else.

Unix Installation
=================
To build and install SWIG, simply type the following:

     % ./configure
     % make
     % make -k check	# This step is optional (see note 3 below)
     % make install

By default SWIG installs itself in /usr/local.  If you need to install SWIG in
a different location or in your home directory, use the --prefix option
to ./configure.  For example:

     % ./configure --prefix=/home/yourname/projects
     % make
     % make -k check
     % make install

Note: the directory given to --prefix must be an absolute pathname.  Do *NOT* use
the ~ shell-escape to refer to your home directory.  SWIG won't work properly
if you do this.

The file INSTALL details more about using configure. Also try

     % ./configure --help. 

The configure script will attempt to locate various packages on your 
machine, including Tcl, Perl5, Python and other target languages that SWIG 
uses.  Don't panic if you get 'not found' messages--SWIG does not need these 
packages to compile or run.   The configure script is actually looking for 
these packages so that you can try out the SWIG examples contained
in the 'Examples' directory without having to hack Makefiles.

Notes:

(1) If you checked the code out via CVS, you will have to run ./autogen.sh
    before typing 'configure'.    In addition, a full build of SWIG requires
    the use of bison.

(2) 'make -k check' is a new feature that requires at least one of the target
    languages to be installed and which performs compile/link level testing
    of the examples.  If it fails, it may mean that you have an uninstalled
    language module or that the file 'Examples/Makefile' has been
    incorrectly configured.  It may also fail due to compiler issues 
    such as broken C++ compiler.  Even if 'make -k check' fails, there is a 
    pretty good chance SWIG still works correctly---you will just have
    to mess around with one of the examples and some makefiles first.

(3) The testing suite executed by 'make -k check' is designed to stress-test
    many parts of the implementation including obscure corner cases. If some
    of these tests fail or generate warning messages, there is no reason for
    alarm---the test may be related to some new SWIG feature or a difficult bug
    that we're trying to resolve.  Chances are that SWIG will work just fine
    for you.  

    Note: SWIG's support for C++ is sufficiently advanced that certain
    tests may fail on older C++ compilers (for instance if your compiler
    does not support member templates).   These errors are harmless if you 
    don't intend to use these features in your own programs.

Examples
========
The Examples directory contains a variety of examples of using SWIG
and it has some browsable documentation.  Simply point your browser to
the file "Example/index.html".

The Examples directory now includes Visual C++ project (.dsp) files for
building some of the examples on Windows (new in SWIG1.3.7).

Troubleshooting
===============
In order to operate correctly, SWIG relies upon a set of library
files.  If after building SWIG, you get error messages like this,

    % swig foo.i
    :1. Unable to find 'swig.swg'
    :3. Unable to find 'tcl8.swg'

it means that SWIG has either been incorrectly configured or
installed.  To fix this:

    1.  Make sure you remembed to do a 'make install' and that
        the installation actually worked.  Make sure you have
        write permission on the install directory.

    2.  If that doesn't work, type 'swig -swiglib' to find out
        where SWIG thinks its library is located.

    3.  If the location is not where you expect, perhaps
        you supplied a bad option to configure.  Use
        ./configure --prefix=pathname to set the SWIG install
        location.   Also, make sure you don't include a shell
        escape character such as ~ when you specify the path.

    4.  The SWIG library can be changed by setting the SWIG_LIB
        environment variable.  However, you really shouldn't
        have to do this.

If you are having other troubles, you might look at the SWIG Wiki at
http://swig.cs.uchicago.edu/cgi-bin/wiki.pl.

Documentation
=============
The Doc/Manual directory contains the most recent set of updated
documentation for this release.  As this is a development release, the
documentation is not entirely up to date and is being worked on.  We
are working on it, but there is a lot of old documentation and it is going
to take time to complete. Please be patient or volunteer to help.

!! The most up-to-date information concerning new features in SWIG1.3 is the
!! file Doc/Manual/SWIG.html.

There is some technical developer documentation available in the
Doc/Devel subdirectory.  This is not necessarily up-to-date, but it
has some information on SWIG internals.

Participate!
============

Please report any errors and submit patches (if possible)!  We only
have access to a limited variety of hardware (Linux, Solaris, OS-X,
and Windows). All contributions help.

If you would like to join the SWIG development team or contribute a
language module to the distribution, please contact swig-dev@cs.uchicago.edu.

 -- The SWIG Maintainers