Add support for the -external-runtime argument and update all language modules to use it
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6993 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
6c63b1c5b9
commit
ef58056ffd
18 changed files with 233 additions and 46 deletions
|
|
@ -75,44 +75,28 @@ languages provide. One solution is to load all modules before spawning any thre
|
|||
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>
|
||||
to call the SWIG run-time functions from another C file, there is one header you need
|
||||
to include. To generate the header that needs to be included, run the following command:
|
||||
|
||||
<blockquote><pre>
|
||||
#include <swigrun.swg>
|
||||
#include <python/pyrun.swg> /* Or other header, see below */
|
||||
#include <runtime.swg>
|
||||
$ swig -python -external-runtime <filename>
|
||||
</pre></blockquote>
|
||||
|
||||
<p>After including these three headers, your code should be able to call <tt>SWIG_TypeQuery</tt>,
|
||||
<p>The filename argument is optional and if it is not passed, then the default filename will
|
||||
be something like <tt>swigpyrun.h</tt>, depending on the language. This header file should
|
||||
be treated like any of the other _wrap.c output files, and should be regenerated when the
|
||||
_wrap files are. After including this header, your code will 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,
|
||||
<p>Inside this header 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 <python/pyrun.swg>
|
||||
for the different language modules are:</p>
|
||||
<ul>
|
||||
<li>Chicken - <chicken/chickenrun.swg></li>
|
||||
<li>Guile (scm) - <guile/guile_scm_run.swg></li>
|
||||
<li>Guile (gh) - This does not work with the -gh API, use the -scm API</li>
|
||||
<li>MzScheme - <mzscheme/mzrun.swg></li>
|
||||
<li>Ocaml - <ocaml/ocaml.swg></li>
|
||||
<li>Python - <python/pyrun.swg></li>
|
||||
<li>Perl5 - <perl5/perlrun.swg></li>
|
||||
<li>Ruby - <ruby/rubydef.swg></li>
|
||||
<li>Tcl - <tcl/swigtcl8.swg></li>
|
||||
</ul>
|
||||
file and the _wrap.c files through a global variable in the scripting language. It is also
|
||||
possible to copy this header file along with the generated wrapper files into your own package,
|
||||
so that you can distribute a package that can be compiled without SWIG installed (this works
|
||||
because the header file is self contained, and does not need to link with anything).</p>
|
||||
|
||||
<H2><a name="Modules_nn4"></a>15.3 A word of caution about static libraries</H2>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue