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
|
||||
href="http://www.r-project.org/">www.r-project.org</a>.
|
||||
|
||||
The R binding are under active development and are extremely
|
||||
experimental. Not all features have been implemented and the API is
|
||||
not stable.
|
||||
The R bindings are under active development. They have been used to
|
||||
compile and run an R interface to QuantLib running on Mandriva Linux
|
||||
with gcc, and testing on other platforms is appreciated.
|
||||
</p>
|
||||
|
||||
<H2><a name="R_nn2"></a>32.1 Bugs</H2>
|
||||
|
|
@ -50,13 +50,13 @@ Currently the following features are not implemented or broken:
|
|||
|
||||
<p>
|
||||
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>
|
||||
|
||||
<div class="shell">
|
||||
<pre>
|
||||
swig -r -o example,c example.i
|
||||
PKG_LIBS="example_func.c" R CMD SHLIB example.c
|
||||
swig -r example.i
|
||||
PKG_LIBS="example.c" R CMD SHLIB example_wrap.c
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
|
@ -66,8 +66,8 @@ The corresponding comments for C++ mode are
|
|||
|
||||
<div class="shell">
|
||||
<pre>
|
||||
swig -c++ -r -o example.cpp example.i
|
||||
PKG_LIBS="example_func.cxx" R CMD SHLIB example.cpp
|
||||
swig -c++ -r example.i
|
||||
PKG_LIBS="example.cxx" R CMD SHLIB example_wrap.cpp
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
|
@ -79,22 +79,43 @@ rather than cxx for the R compile command to recognize it.
|
|||
</p>
|
||||
|
||||
<p>
|
||||
The commands produce two files. A dynamic shared object file called
|
||||
example.so and an R wrapper file called example_wrap.S. To load these
|
||||
The commands produces two files. A dynamic shared object file called
|
||||
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
|
||||
</p>
|
||||
|
||||
<div class="shell">
|
||||
<pre>
|
||||
dyn.load('example.so')
|
||||
source('example_wrap.S')
|
||||
dyn.load('example_wrap.so')
|
||||
source('example_wrap.R')
|
||||
cacheMetaData(1)
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
The cacheMetaData(1) will cause R to refresh its object tables.
|
||||
Without it, inheritance of wrapped objects may fail.
|
||||
|
||||
<p>
|
||||
These two files can be loaded in any order
|
||||
</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>
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue