[R] Calling Fortran from R: Issues with dynamic loading of fortran dll

Berend Hasselman bhh at xs4all.nl
Mon Jan 16 15:23:19 CET 2012


On 16-01-2012, at 14:55, David Stevens wrote:

> I installed RTools - though I'm unable to use it within R, from the 
> command prompt the file will compile and create the foo.dll using R CMD 
> SHLIB foo.f.  I simlified to code for fortran IV (?really) compliance
> 
> foo.f:
> 
>        Subroutine foo(x)
>        real x
>        x = x + 2.
>        return
>        end

Fortran IV is not necessary. Fortran77 is ok (and with a lot of compilers you can use things like "enddo" and "do .. while").

Considering your previous posts in this matter, you should declare variable x to be real*8 or double precision.
Making x a  real implies a real*4 or 32 bit floating point number.
And I would use 2.d0 (because I'm paranoid).

Windows gurus will have to provide help for solving the other problem.

Berend
 


More information about the R-help mailing list