import source from 1.3.40
[external/swig.git] / Examples / README
1 SWIG Examples
2
3 The "perl5", "python", "tcl", "guile", "java", "mzscheme", "ruby", and
4 "chicken" directories contain a number of simple examples that are
5 primarily used for testing. The "GIFPlot" directory contains a more
6 complicated example that illustrates some of SWIG's more advanced
7 capabilities.
8
9 The file 'index.html' is the top of a hyperlinked document that
10 contains information about all of the examples along with various
11 notes related to each example.
12
13 The Examples directory is currently quite incomplete because it
14 is being reorganized.  A more complete set of examples can be found
15 in the SWIG1.1p5 distribution (most of which should still work with
16 SWIG1.3).
17
18 Note: All of the examples rely upon the Makefile in this directory.
19 You may need to edit it to reflect the configuration of your machine
20 in case the configure script guesses incorrect settings.
21
22
23 *** Special note concering C++ ***
24
25 The configure script is currently unable to handle all of the possible
26 options for producing dynamically loadable C++ extensions.  Here are
27 the rules of thumb for making C++ work:
28
29  -  Try using the C++ as the linker for the shared library.  For example:
30
31          g++ -shared $(OBJS) -o module.so
32
33  -  If that doesn't work, you may need to explicitly link against some
34     kind of C++ runtime library.  For example:
35
36          ld -G $(OBJS) -L/opt/SUNWspro/lib -lCrun -o module.so
37
38     This can be set by modifying the setting of CPP_DLLIBS in the
39     Makefile.
40
41
42 *** Special note for SWIG Maintainers ***
43
44 When you add an example, consider arranging for the example to be also
45 useful as part of the SWIG testing framework.  To do this, include in
46 the example makefile a target "check" ("check: all" is sufficient for a
47 first pass), and add an invocation to ../Makefile.in under target
48 "check-examples" (or whatever is appropriate).  Later, we can add or
49 expand the actions under target "check" to do more in-depth testing.