Update after running html tools in makefile
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6139 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
8dfc876eea
commit
229d40e0ee
11 changed files with 339 additions and 331 deletions
|
|
@ -6,7 +6,7 @@
|
|||
</head>
|
||||
<body bgcolor="#ffffff">
|
||||
<a name="n1"></a>
|
||||
<H1><a name="Ocaml"></a>21 SWIG and Ocaml</H1>
|
||||
<H1><a name="Ocaml"></a>22 SWIG and Ocaml</H1>
|
||||
<!-- INDEX -->
|
||||
<ul>
|
||||
<li><a href="#Ocaml_nn2">Preliminaries</a>
|
||||
|
|
@ -73,7 +73,7 @@ If you're not familiar with the Objective Caml language, you can visit
|
|||
<a href="http://www.ocaml.org/">The Ocaml Website</a>.
|
||||
</p>
|
||||
|
||||
<H2><a name="Ocaml_nn2"></a>21.1 Preliminaries</H2>
|
||||
<H2><a name="Ocaml_nn2"></a>22.1 Preliminaries</H2>
|
||||
|
||||
|
||||
SWIG 1.3 works with Ocaml 3.04 and above. Given the choice,
|
||||
|
|
@ -90,7 +90,7 @@ usual -lxxx against libxxx.so, as well as with Gerd Stolpmann's
|
|||
file Examples/Makefile illustrate how to compile and link SWIG modules that
|
||||
will be loaded dynamically. This has only been tested on Linux so far.
|
||||
|
||||
<H3><a name="Ocaml_nn3"></a>21.1.1 Running SWIG</H3>
|
||||
<H3><a name="Ocaml_nn3"></a>22.1.1 Running SWIG</H3>
|
||||
|
||||
|
||||
The basics of getting a SWIG Ocaml module up and running
|
||||
|
|
@ -111,7 +111,7 @@ you will compile the file <tt>example_wrap.c</tt> with <tt>ocamlc</tt> or
|
|||
the resulting .ml and .mli files as well, and do the final link with -custom
|
||||
(not needed for native link). </p>
|
||||
|
||||
<H3><a name="Ocaml_nn4"></a>21.1.2 Compiling the code</H3>
|
||||
<H3><a name="Ocaml_nn4"></a>22.1.2 Compiling the code</H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -147,7 +147,7 @@ the user more freedom with respect to custom typing.
|
|||
</pre>
|
||||
</blockquote>
|
||||
|
||||
<H3><a name="Ocaml_nn5"></a>21.1.3 The camlp4 module</H3>
|
||||
<H3><a name="Ocaml_nn5"></a>22.1.3 The camlp4 module</H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -223,7 +223,7 @@ let b = C_string (getenv "PATH")
|
|||
</td></tr>
|
||||
</table>
|
||||
|
||||
<H3><a name="Ocaml_nn6"></a>21.1.4 Using your module</H3>
|
||||
<H3><a name="Ocaml_nn6"></a>22.1.4 Using your module</H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -237,7 +237,7 @@ When linking any ocaml bytecode with your module, use the -custom
|
|||
option is not needed when you build native code.
|
||||
</p>
|
||||
|
||||
<H3><a name="Ocaml_nn7"></a>21.1.5 Compilation problems and compiling with C++</H3>
|
||||
<H3><a name="Ocaml_nn7"></a>22.1.5 Compilation problems and compiling with C++</H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -248,7 +248,7 @@ liberal with pointer types may not compile under the C++ compiler.
|
|||
Most code meant to be compiled as C++ will not have problems.
|
||||
</p>
|
||||
|
||||
<H2><a name="Ocaml_nn8"></a>21.2 The low-level Ocaml/C interface</H2>
|
||||
<H2><a name="Ocaml_nn8"></a>22.2 The low-level Ocaml/C interface</H2>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -346,7 +346,7 @@ is that you must append them to the return list with swig_result = caml_list_a
|
|||
signature for a function that uses value in this way.
|
||||
</p>
|
||||
|
||||
<H3><a name="Ocaml_nn9"></a>21.2.1 The generated module</H3>
|
||||
<H3><a name="Ocaml_nn9"></a>22.2.1 The generated module</H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -380,7 +380,7 @@ it describes the output SWIG will generate for class definitions.
|
|||
</td></tr>
|
||||
</table>
|
||||
|
||||
<H3><a name="Ocaml_nn10"></a>21.2.2 Enums</H3>
|
||||
<H3><a name="Ocaml_nn10"></a>22.2.2 Enums</H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -439,10 +439,10 @@ val x : Enum_test.c_obj = C_enum `a
|
|||
</pre>
|
||||
</blockquote>
|
||||
|
||||
<H3><a name="Ocaml_nn11"></a>21.2.3 Arrays</H3>
|
||||
<H3><a name="Ocaml_nn11"></a>22.2.3 Arrays</H3>
|
||||
|
||||
|
||||
<H4><a name="Ocaml_nn12"></a>21.2.3.1 Simple types of bounded arrays</H4>
|
||||
<H4><a name="Ocaml_nn12"></a>22.2.3.1 Simple types of bounded arrays</H4>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -463,7 +463,7 @@ arrays of simple types with known bounds in your code, but this only works
|
|||
for arrays whose bounds are completely specified.
|
||||
</p>
|
||||
|
||||
<H4><a name="Ocaml_nn13"></a>21.2.3.2 Complex and unbounded arrays</H4>
|
||||
<H4><a name="Ocaml_nn13"></a>22.2.3.2 Complex and unbounded arrays</H4>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -476,7 +476,7 @@ SWIG can't predict which of these methods will be used in the array,
|
|||
so you have to specify it for yourself in the form of a typemap.
|
||||
</p>
|
||||
|
||||
<H4><a name="Ocaml_nn14"></a>21.2.3.3 Using an object</H4>
|
||||
<H4><a name="Ocaml_nn14"></a>22.2.3.3 Using an object</H4>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -490,7 +490,7 @@ Consider writing an object when the ending condition of your array is complex,
|
|||
such as using a required centinel, etc.
|
||||
</p>
|
||||
|
||||
<H4><a name="Ocaml_nn15"></a>21.2.3.4 Example typemap for a function taking float * and int</H4>
|
||||
<H4><a name="Ocaml_nn15"></a>22.2.3.4 Example typemap for a function taking float * and int</H4>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -541,7 +541,7 @@ void printfloats( float *tab, int len );
|
|||
</pre></td></tr></table>
|
||||
|
||||
|
||||
<H3><a name="Ocaml_nn16"></a>21.2.4 C++ Classes</H3>
|
||||
<H3><a name="Ocaml_nn16"></a>22.2.4 C++ Classes</H3>
|
||||
|
||||
|
||||
C++ classes, along with structs and unions are represented by C_obj
|
||||
|
|
@ -579,7 +579,7 @@ Note that this string belongs to the wrapper object, and not
|
|||
the underlying pointer, so using create_[x]_from_ptr alters the
|
||||
returned value for the same object.
|
||||
|
||||
<H4><a name="Ocaml_nn17"></a>21.2.4.1 STL vector and string Example</H4>
|
||||
<H4><a name="Ocaml_nn17"></a>22.2.4.1 STL vector and string Example</H4>
|
||||
|
||||
|
||||
Standard typemaps are now provided for STL vector and string. More are in
|
||||
|
|
@ -657,7 +657,7 @@ baz
|
|||
#
|
||||
</pre></blockquote>
|
||||
|
||||
<H4><a name="Ocaml_nn18"></a>21.2.4.2 C++ Class Example</H4>
|
||||
<H4><a name="Ocaml_nn18"></a>22.2.4.2 C++ Class Example</H4>
|
||||
|
||||
|
||||
Here's a simple example using Trolltech's Qt Library:
|
||||
|
|
@ -685,7 +685,7 @@ public:
|
|||
};
|
||||
</pre></td></tr></table>
|
||||
|
||||
<H4><a name="Ocaml_nn19"></a>21.2.4.3 Compiling the example</H4>
|
||||
<H4><a name="Ocaml_nn19"></a>22.2.4.3 Compiling the example</H4>
|
||||
|
||||
|
||||
<blockquote><pre>
|
||||
|
|
@ -703,7 +703,7 @@ bash-2.05a$ ocamlmktop -custom swig.cmo -I `camlp4 -where` \
|
|||
-L$QTPATH/lib -cclib -lqt
|
||||
</pre></blockquote>
|
||||
|
||||
<H4><a name="Ocaml_nn20"></a>21.2.4.4 Sample Session</H4>
|
||||
<H4><a name="Ocaml_nn20"></a>22.2.4.4 Sample Session</H4>
|
||||
|
||||
|
||||
<blockquote><pre>
|
||||
|
|
@ -730,10 +730,10 @@ Assuming you have a working installation of QT, you will see a window
|
|||
containing the string "hi" in a button.
|
||||
</p>
|
||||
|
||||
<H3><a name="Ocaml_nn21"></a>21.2.5 Director Classes</H3>
|
||||
<H3><a name="Ocaml_nn21"></a>22.2.5 Director Classes</H3>
|
||||
|
||||
|
||||
<H4><a name="Ocaml_nn22"></a>21.2.5.1 Director Introduction</H4>
|
||||
<H4><a name="Ocaml_nn22"></a>22.2.5.1 Director Introduction</H4>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -760,7 +760,7 @@ class foo {
|
|||
};
|
||||
</pre></blockquote>
|
||||
|
||||
<H4><a name="Ocaml_nn23"></a>21.2.5.2 Overriding Methods in Ocaml</H4>
|
||||
<H4><a name="Ocaml_nn23"></a>22.2.5.2 Overriding Methods in Ocaml</H4>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -788,7 +788,7 @@ In this example, I'll examine the objective caml code involved in providing
|
|||
an overloaded class. This example is contained in Examples/ocaml/shapes.
|
||||
</p>
|
||||
|
||||
<H4><a name="Ocaml_nn24"></a>21.2.5.3 Director Usage Example</H4>
|
||||
<H4><a name="Ocaml_nn24"></a>22.2.5.3 Director Usage Example</H4>
|
||||
|
||||
|
||||
<table border="1" bgcolor="#dddddd" summary="Director usage example">
|
||||
|
|
@ -847,7 +847,7 @@ in a more effortless style in ocaml, while leaving the "engine" part of the
|
|||
program in C++.
|
||||
</p>
|
||||
|
||||
<H4><a name="Ocaml_nn25"></a>21.2.5.4 Creating director objects</H4>
|
||||
<H4><a name="Ocaml_nn25"></a>22.2.5.4 Creating director objects</H4>
|
||||
|
||||
|
||||
The definition of the actual object triangle can be described this way:
|
||||
|
|
@ -885,7 +885,7 @@ object from causing a core dump, as long as the object is destroyed
|
|||
properly.
|
||||
</p>
|
||||
|
||||
<H4><a name="Ocaml_nn26"></a>21.2.5.5 Typemaps for directors, <tt>directorin, directorout, directorargout</tt></H4>
|
||||
<H4><a name="Ocaml_nn26"></a>22.2.5.5 Typemaps for directors, <tt>directorin, directorout, directorargout</tt></H4>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -896,7 +896,7 @@ well as a function return value in the same way you provide function arguments,
|
|||
and to receive arguments the same way you normally receive function returns.
|
||||
</p>
|
||||
|
||||
<H4><a name="Ocaml_nn27"></a>21.2.5.6 <tt>directorin</tt> typemap</H4>
|
||||
<H4><a name="Ocaml_nn27"></a>22.2.5.6 <tt>directorin</tt> typemap</H4>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -907,7 +907,7 @@ code receives when you are called. In general, a simple <tt>directorin</tt> typ
|
|||
can use the same body as a simple <tt>out</tt> typemap.
|
||||
</p>
|
||||
|
||||
<H4><a name="Ocaml_nn28"></a>21.2.5.7 <tt>directorout</tt> typemap</H4>
|
||||
<H4><a name="Ocaml_nn28"></a>22.2.5.7 <tt>directorout</tt> typemap</H4>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -918,7 +918,7 @@ for the same type, except when there are special requirements for object
|
|||
ownership, etc.
|
||||
</p>
|
||||
|
||||
<H4><a name="Ocaml_nn29"></a>21.2.5.8 <tt>directorargout</tt> typemap</H4>
|
||||
<H4><a name="Ocaml_nn29"></a>22.2.5.8 <tt>directorargout</tt> typemap</H4>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -935,7 +935,7 @@ In the event that you don't specify all of the necessary values, integral
|
|||
values will read zero, and struct or object returns have undefined results.
|
||||
</p>
|
||||
|
||||
<H3><a name="Ocaml_nn30"></a>21.2.6 Exceptions</H3>
|
||||
<H3><a name="Ocaml_nn30"></a>22.2.6 Exceptions</H3>
|
||||
|
||||
|
||||
Catching exceptions is now supported using SWIG's %exception feature. A simple
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue