[R] Writing R package that call Fortran codes

MacQueen, Don macqueen1 at llnl.gov
Thu Jun 16 18:36:36 CEST 2016


You might want to take this question to R-sig-mac.

-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 6/15/16, 1:20 PM, "R-help on behalf of Kodalore Vijayan, Vineetha W"
<r-help-bounces at r-project.org on behalf of vwkv13 at mun.ca> wrote:

>Hi,
>
>I'm trying to write an R package that calls a Fortran subroutine on my
>Mac
>os x El Capitan with Xcode 7 and gfortran 6.1, R 3.3.0.   I can build and
>load the library but when I try to use it in R I get this error:
>>library(NEpidemic)
>>random_epi(variable_names)
>
>Error in .Fortran("random_epi", : "random_pi" not resolved from current
>namespace (NEpidemic).
>
>Then I  tried adding useDynLib(random_epi.f95) in the NAMESPACE file,
>additional to useDynLib(NEpidemic). After doing that I couldn't build the
>package and it gave me another error:
>
>Error in library.dynam(lib, package, package.lib) :
>  shared object Œrandom_epi.so¹ not found
>Error: loading failed
>Execution halted
>ERROR: loading failed
>
>When I checked my src folder, there is only random_epi.o file.  How can I
>fix this issue? Any help would be much appreciated. I'm vey new to both R
>and Fortran coding, especially in package building.
>
>Thanks in advance!
>Vineetha
>
>	[[alternative HTML version deleted]]
>
>______________________________________________
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list