45 changed files with
1 additions and
91 deletions
|
|
|
|
@ -11,8 +11,6 @@
|
|
|
|
|
|
|
|
|
|
<H2>Implementing C++ callbacks in Java</H2>
|
|
|
|
|
|
|
|
|
|
<tt>$Header$</tt><br>
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
This example illustrates how to use directors to implement C++ callbacks in Java.
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
@ -11,8 +11,6 @@
|
|
|
|
|
|
|
|
|
|
<H2>Wrapping a simple C++ class</H2>
|
|
|
|
|
|
|
|
|
|
<tt>$Header$</tt><br>
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
This example illustrates the high level form of C++ class wrapping performed
|
|
|
|
|
by SWIG. In this case, a C++ class has a proxy Java class, which
|
|
|
|
|
|
|
|
|
|
@ -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 Java constant 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.
|
|
|
|
|
SWIG wraps enums in numerous different ways. The default approach is to wrap
|
|
|
|
|
|
|
|
|
|
@ -11,8 +11,6 @@
|
|
|
|
|
|
|
|
|
|
<H2>Extending a simple C++ class in Java</H2>
|
|
|
|
|
|
|
|
|
|
<tt>$Header</tt><br>
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
This example illustrates the extending of a C++ class with cross language polymorphism.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -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 Java Examples</H1>
|
|
|
|
|
|
|
|
|
|
<tt>$Header$</tt><br>
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
The following examples illustrate the use of SWIG with Java.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -11,8 +11,6 @@
|
|
|
|
|
|
|
|
|
|
<H2>SWIG wrapped and manually wrapped functions in Java</H2>
|
|
|
|
|
|
|
|
|
|
<tt>$Header$</tt><br>
|
|
|
|
|
<p>
|
|
|
|
|
Click <a href="../../../Doc/Manual/Java.html#using_own_jni_functions">here</a> for the relevant section in the SWIG and Java documentation.
|
|
|
|
|
<p>
|
|
|
|
|
This example compares wrapping a c global function using the manual way and the SWIG way.
|
|
|
|
|
|
|
|
|
|
@ -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
|
|
|
|
|
|
|
|
|
|
@ -11,8 +11,6 @@
|
|
|
|
|
|
|
|
|
|
<H2>Simple Java Example</H2>
|
|
|
|
|
|
|
|
|
|
<tt>$Header$</tt><br>
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
This example illustrates how you can hook Java to a very simple C program containing
|
|
|
|
|
a function and a global variable.
|
|
|
|
|
|
|
|
|
|
@ -11,8 +11,6 @@
|
|
|
|
|
|
|
|
|
|
<H2>C++ template support</H2>
|
|
|
|
|
|
|
|
|
|
<tt>$Header$</tt><br>
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
This example illustrates how C++ templates can be used from Java using SWIG.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -11,8 +11,6 @@
|
|
|
|
|
|
|
|
|
|
<H2>Typemaps in Java</H2>
|
|
|
|
|
|
|
|
|
|
<tt>$Header$</tt><br>
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
This example shows how typemaps can be used to modify the default behaviour of the Java SWIG module.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -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
|
|
|
|
|
|