[R] using compiled fortran in R

Prof Brian D Ripley ripley at stats.ox.ac.uk
Wed Jul 25 08:32:33 CEST 2001

See `Writing R Extensions' for the information.

R CMD SHLIB hello.f

> dyn.load("hello.so")

might be what you need.  dyn.load in R loads shared libraries (on Linux),
not .o objects.  The error message does say your hello.o is not a valid
shared library.

Looks like the help page for dyn.load needs a cross-reference to SHLIB.

On Tue, 24 Jul 2001, Natalie Hawkins wrote:

> Hi,
> I would like to use a Fortran subroutine in R.  I have checked the R
> docs and Newsletter,
> but..., I am unable to load an object file into R.
> The steps I have taken are (on Debian Linux/recent Intel-type chip ):
> 1. g77 -c hello.f
>     to create hello.o
> 2. mymachine> R
>     to start R
> 3. > dyn.load("hello.o")
>     at which point I am getting the error msg:
>    Error in dyn.load(x, as.logical(local), as.logical(now)) :
>    unable to load shared library "/home/hawkins/Rfortran/hello.o":
>    /home/hawkins/Rfortran/hello.o: ELF file's phentsize not the expected
> size
> Can anyone (please) correct my procedure, offer a suggestion?
> thanks,
> Natalie Hawkins

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