- Improve the runtime type sytesm

- Update all languages to new type system
- Add DohSortList function
- Fix mzscheme Examples/Makefile


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6930 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
John Lenz 2005-02-01 00:08:24 +00:00
commit f6964f285f
48 changed files with 1383 additions and 1021 deletions

View file

@ -9,9 +9,10 @@
<!-- INDEX -->
<ul>
<li><a href="#Modules_nn2">The SWIG runtime code</a>
<li><a href="#Modules_nn3">A word of caution about static libraries</a>
<li><a href="#Modules_nn4">References</a>
<li><a href="#Modules_nn5">Reducing the wrapper file size</a>
<li><a href="#external_run_time">External access to runtime system</a>
<li><a href="#Modules_nn4">A word of caution about static libraries</a>
<li><a href="#Modules_nn5">References</a>
<li><a href="#Modules_nn6">Reducing the wrapper file size</a>
</ul>
<!-- INDEX -->
@ -68,7 +69,52 @@ Be careful if you use threads and the automatic module loading that some scripti
languages provide. One solution is to load all modules before spawning any threads.
</p>
<H2><a name="Modules_nn3"></a>15.2 A word of caution about static libraries</H2>
<H2><a name="external_run_time"></a>15.2 External access to the run-time system</a></H2>
<p>As described in <a href="Typemaps.html#runtime_type_checker">The run-time type checker</a>,
the functions <tt>SWIG_TypeQuery</tt>, <tt>SWIG_NewPointerObj</tt>, and others sometimes need
to be called. Calling these functions from a typemap is supported, since the typemap code
is embedded into the <tt>_wrap.c</tt> file, which has those declerations available. If you need
to call the SWIG run-time functions from another C file, there are three headers you need
to include. They are located in the Lib directory in the SWIG source, or wherever the
SWIG Library was installed. You can see the current library path by running
<tt>swig -swiglib</tt>.</p>
<blockquote><pre>
#include &lt;swigrun.swg&gt;
#include &lt;python/pyrun.swg&gt; /* Or other header, see below */
#include &lt;runtime.swg&gt;
</pre></blockquote>
<p>After including these three headers, your code should be able to call <tt>SWIG_TypeQuery</tt>,
<tt>SWIG_NewPointerObj</tt>, <tt>SWIG_ConvertPtr</tt> and others. The exact argument paramaters
for these functions might differ between language modules; please check the language module chapters
for more information.</p>
<p>Inside these headers the functions are declared static and are included inline into the file,
and thus the file does not need to be linked against any SWIG libraries or code (you might still
need to link against the language libraries like libpython-2.3). Data is shared between this
file and the _wrap.c files through a global variable in the wrapping language. It is also
possible to copy these three header files into your own package for distribution along with
the generated wrapper files, so that you can distribute a package that can be compiled
without SWIG installed (this works because the header files are self contained, and do not
need to link with anything).</p>
<p>The headers that should be included in place of the #include &lt;python/pyrun.swg&gt;
for the different language modules are:</p>
<ul>
<li>Chicken - &lt;chicken/chickenrun.swg&gt;</li>
<li>Guile (scm) - &lt;guile/guile_scm_run.swg&gt;</li>
<li>Guile (gh) - This does not work with the -gh API, use the -scm API</li>
<li>MzScheme - &lt;mzscheme/mzrun.swg&gt;</li>
<li>Ocaml - &lt;ocaml/ocaml.swg&gt;</li>
<li>Python - &lt;python/pyrun.swg&gt;</li>
<li>Perl5 - &lt;perl5/perlrun.swg&gt;</li>
<li>Ruby - &lt;ruby/rubydef.swg&gt;</li>
<li>Tcl - &lt;tcl/swigtcl8.swg&gt;</li>
</ul>
<H2><a name="Modules_nn4"></a>15.3 A word of caution about static libraries</H2>
When working with multiple SWIG modules, you should take care not to use static
@ -77,13 +123,13 @@ of SWIG modules with that library, each module will get its own private copy of
into it. This is very often <b>NOT</b> what you want and it can lead to unexpected or bizarre program
behavior. When working with dynamically loadable modules, you should try to work exclusively with shared libaries.
<H2><a name="Modules_nn4"></a>15.3 References</H2>
<H2><a name="Modules_nn5"></a>15.4 References</H2>
Due to the complexity of working with shared libraries and multiple modules, it might be a good idea to consult
an outside reference. John Levine's "Linkers and Loaders" is highly recommended.
<H2><a name="Modules_nn5"></a>15.4 Reducing the wrapper file size</H2>
<H2><a name="Modules_nn6"></a>15.5 Reducing the wrapper file size</H2>
<p>