commit changes to svn
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9646 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
71c5f58bb3
commit
7e830cdf05
1 changed files with 33 additions and 12 deletions
|
|
@ -27,9 +27,9 @@ R is a GPL'ed open source statistical and plotting environment.
|
||||||
Information about R can be found at <a
|
Information about R can be found at <a
|
||||||
href="http://www.r-project.org/">www.r-project.org</a>.
|
href="http://www.r-project.org/">www.r-project.org</a>.
|
||||||
|
|
||||||
The R binding are under active development and are extremely
|
The R bindings are under active development. They have been used to
|
||||||
experimental. Not all features have been implemented and the API is
|
compile and run an R interface to QuantLib running on Mandriva Linux
|
||||||
not stable.
|
with gcc, and testing on other platforms is appreciated.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<H2><a name="R_nn2"></a>32.1 Bugs</H2>
|
<H2><a name="R_nn2"></a>32.1 Bugs</H2>
|
||||||
|
|
@ -50,13 +50,13 @@ Currently the following features are not implemented or broken:
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
To use R and SWIG in C mode, execute the following commands where
|
To use R and SWIG in C mode, execute the following commands where
|
||||||
example_func.c is the name of the file with the functions in them
|
example.c is the name of the file with the functions in them
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="shell">
|
<div class="shell">
|
||||||
<pre>
|
<pre>
|
||||||
swig -r -o example,c example.i
|
swig -r example.i
|
||||||
PKG_LIBS="example_func.c" R CMD SHLIB example.c
|
PKG_LIBS="example.c" R CMD SHLIB example_wrap.c
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -66,8 +66,8 @@ The corresponding comments for C++ mode are
|
||||||
|
|
||||||
<div class="shell">
|
<div class="shell">
|
||||||
<pre>
|
<pre>
|
||||||
swig -c++ -r -o example.cpp example.i
|
swig -c++ -r example.i
|
||||||
PKG_LIBS="example_func.cxx" R CMD SHLIB example.cpp
|
PKG_LIBS="example.cxx" R CMD SHLIB example_wrap.cpp
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -79,22 +79,43 @@ rather than cxx for the R compile command to recognize it.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The commands produce two files. A dynamic shared object file called
|
The commands produces two files. A dynamic shared object file called
|
||||||
example.so and an R wrapper file called example_wrap.S. To load these
|
example_wrap.so and an R wrapper file called example_wrap.R. To load these
|
||||||
files, start up R and type in the following commands
|
files, start up R and type in the following commands
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="shell">
|
<div class="shell">
|
||||||
<pre>
|
<pre>
|
||||||
dyn.load('example.so')
|
dyn.load('example_wrap.so')
|
||||||
source('example_wrap.S')
|
source('example_wrap.R')
|
||||||
|
cacheMetaData(1)
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
The cacheMetaData(1) will cause R to refresh its object tables.
|
||||||
|
Without it, inheritance of wrapped objects may fail.
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
These two files can be loaded in any order
|
These two files can be loaded in any order
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<H2>Precompiling large R files</H2>
|
||||||
|
|
||||||
|
In cases where the R file is large, one make save a lot of loading
|
||||||
|
time by precompiling the R wrapper. This can be done by creating the
|
||||||
|
file makeRData.R which contains the following
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
source('BigFile_wrap.R')
|
||||||
|
save(list=ls(all=TRUE),file="BigFile_wrap.RData", compress=TRUE)
|
||||||
|
q(save="no")
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
This will generate a compiled R file called BigFile_wrap.RData that
|
||||||
|
will save a large amount of loading time.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<H2><a name="R_nn4"></a>32.3 General policy</H2>
|
<H2><a name="R_nn4"></a>32.3 General policy</H2>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue