[R] problem of compile fortran program

Gao Feng (FIN) gaofeng at baf.msmail.cuhk.edu.hk
Thu May 30 16:34:09 CEST 2002



I want to call dll from R but encounter problem in compiling the fortran
program.

First I try "Rcmd shlib prog.f", it failed and warning:

 make[1]: `libR.a' is up to date.
 make: *** No rule to make target `'prog.o', needed by `prog.a'. stop.

Then I try to compile it by absoft fortran compiler, it works and produces
prog.dll.
But when this routine is called in R, it did nothing in fact.
For example,

> x<-1:20
> phi<-0.75
> n<-20
> .Fortran("_ARSIM",x,phi,n)
[[1]]
 [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20

[[2]]
[1] 0.75

[[3]]
[1] 20


What's wrong? I don't know how to deal with it.
Any suggestions would be great appreciated.

Thanks in advance.

-------FORTRAN CODE:  prog.f-------
      SUBROUTINE ARSIM_(X,NDIM,PHI)
      INTEGER NDIM
      REAL X(NDIM),PHI
      IF(NDIM.GT.1)THEN
      DO 10 I=2,NDIM
          X(I) = PHI*X(I-1)+X(I)
   10 CONTINUE
      ENDIF
      RETURN
      END
----------------------------

> R.version
         _              
platform i386-pc-mingw32
arch     i386           
os       mingw32        
system   i386, mingw32  
status   Patched        
major    1              
minor    5.0            
year     2002           
month    05             
day      15             
language R              

OS: win98 se
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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