[R] dyn.load() function problem help!
Mu Yunming
ymu at students.uiuc.edu
Wed Jun 18 17:48:23 CEST 2003
First of all, thank you very much for your quick response.
>===== Original Message From Prof Brian D Ripley <ripley at stats.ox.ac.uk> =====
>On Wed, 18 Jun 2003, Mu Yunming wrote:
>
>> Hi!
>>
>> I would like to call a Fortran subroutine within R. For doing this, I first
>> built a shared library for loading into R under Unix and it was successful.
>
>How did you do this? Did you use R CMD SHLIB?
Yes, I typed R CMD SHLIB aaa.o under Unix. Before I did that, I complied my
fortran source code using f90 aaa.f90, which produced aaa.o.
>
>> But when I tried to load a shared library using dyn.load() function for use
in
>> .Fortran(), I got an error message.
>> The command I input below in R is:
>> >dyn.load("aaa.so")
>> The reslut is:
>>
>> error in dyn.load(x,as.logical(local),as.logical(now)):
>> unable to load shared library "/home/ymu/ft/aaa.so":
>> ld.so.1: /usr/local/lib/R/bin/R.bin: fatal: relocation error: file
>> /home/ymu/ft/aaa.so: symbol _F90free: referenced symbol not found.
>>
>> Does this mean that the shared library was not built successfully or my
>> fortran subroutine has some errors?
>
>The former. You appear to have used different Fortran compilers to build R
>and your shared object, since your Fortran support libraries are not being
>linked against.
>
My source code is writen in fortran 90 and i complied the source code using
command f90. How do you think I should complie my source file and build the
shared library?
>--
>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
Best,
Yunming *^_^*
More information about the R-help
mailing list