[R] using compiled fortran in R
Martin Maechler
maechler at stat.math.ethz.ch
Wed Jul 25 08:55:05 CEST 2001
>>>>> "Natalie" == Natalie Hawkins <hawkins at scharp.org> writes:
Natalie> I would like to use a Fortran subroutine in R. I have checked
Natalie> the R docs and Newsletter, but..., I am unable to load an
Natalie> object file into R.
Natalie> The steps I have taken are (on Debian Linux/recent Intel-type
Natalie> chip ):
Natalie> 1. g77 -c hello.f
Natalie> to create hello.o
You should say
R CMD SHLIB hello.f
which will create
hello.so
in one step.
Alternatively
R CMD COMPILE hello.f
R CMD SHLIB hello.o
should do the same in two steps (useful if there are several source files)
Natalie> 2. mymachine> R
Natalie> to start R
Natalie> 3. > dyn.load("hello.o")
which would then be
dyn.load("hello.so")
and I actually always use an explicit path
Natalie> at which point I am getting the error msg:
Natalie> Error in dyn.load(x, as.logical(local), as.logical(now)) :
Natalie> unable to load shared library "/home/hawkins/Rfortran/hello.o":
Natalie> /home/hawkins/Rfortran/hello.o: ELF file's phentsize not the
Natalie> expected size
Natalie> Can anyone (please) correct my procedure, offer a suggestion?
In R, try
?dyn.load
and
?SHLIB
(and yes, the next version of R will have a SEEALSO link from dyn.load to
SHLIB).
Martin Maechler <maechler at stat.math.ethz.ch> http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum LEO D10 Leonhardstr. 27
ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND
phone: x-41-1-632-3408 fax: ...-1228 <><
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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