45 changed files with
1 additions and
91 deletions
|
|
|
|
@ -11,8 +11,6 @@
|
|
|
|
|
|
|
|
|
|
<H2>Wrapping a simple C++ class</H2>
|
|
|
|
|
|
|
|
|
|
<tt>$Header$</tt><br>
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
This example illustrates the most primitive form of C++ class wrapping performed
|
|
|
|
|
by SWIG. In this case, C++ classes are simply transformed into a collection of
|
|
|
|
|
|
|
|
|
|
@ -10,8 +10,6 @@
|
|
|
|
|
|
|
|
|
|
<H2>Wrapping C Constants</H2>
|
|
|
|
|
|
|
|
|
|
<tt>$Header$</tt><br>
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
When SWIG encounters C preprocessor macros and C declarations that look like constants,
|
|
|
|
|
it creates Tcl variables with an identical value. Click <a href="example.i">here</a>
|
|
|
|
|
|
|
|
|
|
@ -11,8 +11,6 @@
|
|
|
|
|
|
|
|
|
|
<H2>Wrapping enumerations</H2>
|
|
|
|
|
|
|
|
|
|
<tt>$Header$</tt><br>
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
This example tests SWIG's ability to wrap enumerations. By default, SWIG
|
|
|
|
|
converts enumeration specifications into integer constants. Further use
|
|
|
|
|
|
|
|
|
|
@ -11,8 +11,6 @@
|
|
|
|
|
|
|
|
|
|
<H2>Pointers to Functions</H2>
|
|
|
|
|
|
|
|
|
|
<tt>$Header$</tt><br>
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
Okay, just what in the heck does SWIG do with a declaration like this?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -6,8 +6,6 @@
|
|
|
|
|
<body bgcolor="#ffffff">
|
|
|
|
|
<H1>SWIG Tcl Examples</H1>
|
|
|
|
|
|
|
|
|
|
<tt>$Header$</tt><br>
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
The following examples illustrate the use of SWIG with Tcl.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -10,8 +10,6 @@
|
|
|
|
|
|
|
|
|
|
<H2>Simple Pointer Handling</H2>
|
|
|
|
|
|
|
|
|
|
<tt>$Header$</tt><br>
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
This example illustrates a couple of techniques for handling
|
|
|
|
|
simple pointers in SWIG. The prototypical example is a C function
|
|
|
|
|
|
|
|
|
|
@ -11,8 +11,6 @@
|
|
|
|
|
|
|
|
|
|
<H2>C++ Reference Handling</H2>
|
|
|
|
|
|
|
|
|
|
<tt>$Header$</tt><br>
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
This example tests SWIG's handling of C++ references. Since C++
|
|
|
|
|
references are closely related to pointers (as both refer to a
|
|
|
|
|
|
|
|
|
|
@ -10,8 +10,6 @@
|
|
|
|
|
|
|
|
|
|
<H2>Simple Tcl Example</H2>
|
|
|
|
|
|
|
|
|
|
<tt>$Header$</tt><br>
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
This example illustrates how you can hook Tcl to a very simple C program containing
|
|
|
|
|
a function and a global variable.
|
|
|
|
|
|
|
|
|
|
@ -11,8 +11,6 @@
|
|
|
|
|
|
|
|
|
|
<H2>Passing and Returning Structures by Value</H2>
|
|
|
|
|
|
|
|
|
|
<tt>$Header$</tt><br>
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
Occasionally, a C program will manipulate structures by value such as shown in the
|
|
|
|
|
following code:
|
|
|
|
|
|
|
|
|
|
@ -10,8 +10,6 @@
|
|
|
|
|
|
|
|
|
|
<H2>Wrapping C Global Variables</H2>
|
|
|
|
|
|
|
|
|
|
<tt>$Header$</tt><br>
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
When a C global variable appears in an interface file, SWIG tries to wrap it using a technique
|
|
|
|
|
known as "variable linking." The idea is pretty simple---we try to create a Tcl
|
|
|
|
|
|