[R] R_FindSymbol

Prof Brian D Ripley ripley at stats.ox.ac.uk
Tue Aug 1 20:43:43 CEST 2000


On Tue, 1 Aug 2000 Setzer.Woodrow at epamail.epa.gov wrote:

> 
> 
> I have written a function that uses LSODA from NETLIB to solve initial value
> problems, given a system of ODEs written as an R function.  There are times when
> it would be convenient to use the code with an ode system written in a compiled
> language.  Certainly, that can be done using .C or .Fortran within an R
> function, but that seems inefficient (indeed, it does not enormously speed up
> the numerical integration, in my limited testing).  What I would like to do is
> to dynamically load a shared library, and pass the name of a symbol as a string
> to my ode solver interface.  The C wrapper would then retrieve the pointer to
> the function named by the string (or fail gracefully trying), and pass that
> pointer to LSODA.  It looks like all I have to do is invoke R_FindSymbol with
> the name I am looking for as the first argument, and the null string as the
> second; the return value will be the pointer I am looking for.  Am I right, or
> is it more complicated than that?

What is a `symbol' here?  If it is a char* in C pointing to the name of the
entry point, almost.  (R symbols are something else.) You would do better
to use the second argument, as the loaded name of your shared library.
It's there to acoid name clashes.


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list