[R] Fortran (77) in R

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Tue Apr 9 10:13:30 CEST 2002


Ko-Kang Kevin Wang <kwan022 at stat.auckland.ac.nz> writes:

> Hi,
> 
> I'm learning Fortran and trying to load a Fortran subroutine into R.
> 
> I've done:
>    R SHLIB Fibonacci.f
> and it compiled fine.
> 
> Then I went into R and done:
> > dyn.load("Fibonacci.so")
> > Fib <- function(n) {
> +     .Fortran("Fibonacci",
> +              as.integer(n))[[1]]
> + }
> > Fib(5) 
> Error in .Fortran("Fibonacci", as.integer(n)) : 
>         C/Fortran function name not in load table
> 
> The dyn.load() worked fine, or so it seems.  I then tried writing a
> function that calls my Fortran subroutine.  However the error message was
> displayed, which I have no idea what it mean ;-(
> 
> Any help will be greatly appreciated!

It cannot find the entry point "Fibonacci" in your .so file. What is
the name of the subroutine you are trying to call? One possible issue
is that Fortran is not case sensitive, so it might be "fibonacci",
whichever way you spelled it originally. "nm Fibonacci.so" could be
enlightening.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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