[R] Re: [S] dyn.load

Prof Brian D Ripley ripley at stats.ox.ac.uk
Wed Sep 5 17:24:08 CEST 2001


Moved to R-help: this is an R-specific question.

On Wed, 5 Sep 2001, Juan Ramon Gonzalez wrote:

> Dear s-users,
>
> I need to translate a function of Splus in to R. The function calls a
DLL library using the instruction dll.load. In R exists the function
'dyn.load' and I get the following results

dll.load is not in the current S-PLUS Windows version, BTW.

> > dyn.load("c:/windows/system/my_function.dll")
> > is.loaded("my_function")
> [1] TRUE

>
> but I have problems when I use the  '.Fortran'  function. I get the following message:
>
> > .Fortran("my_function",.....)
> Error in .Fortran("my_function") : C/Fortran function name not in load table
>
> ( where ,....  are the parameters of my_function )
>
> I would like to know why it doesn't work

Because the symbol being looked for is "my_function_".  You are mis-using
is.loaded, in both R and S-PLUS:

     Functions `symbol.C' and `symbol.For' map function or subroutine
     names to the symbol name in the compiled code: `is.loaded' checks
     if the symbol name is loaded and hence available for use in `.C'
     or `.Fortran'.

You needed is.loaded(symbol.For("my_function")).


Perhaps you need to re-read the readme.packages file about Windows Fortran
compilers (assuming you did use a Fortran compiler).

-- 
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