[Rd] Using Fortran 95 in an R package?

Prof Brian Ripley ripley at stats.ox.ac.uk
Sun Dec 9 19:04:44 CET 2007

On Sun, 9 Dec 2007, John Fox wrote:

> Dear R-devel list members,
> What's the best current advice about writing Fortran code for use in R
> packages? The Writing R Extensions manual still says that the .Fortran
> interface is primarily intended for FORTRAN 77 code. In particular, are
> there portability issues if I use Fortran 95 in a package? For example, I
> see that Rtools for Windows now include the gfortran compiler.

Yes, there are still portability issues.  We do still see quite a few 
people using gcc3/g77 (especially on older Linux and commercial Unices) 
and there are further issues if you make use of subprogram names 
containing underlines.  We don't distribute a cross-building solution for 
Windows using gfortran (although one can be built, it will not be mature
until gcc 4.3.x is out).

However, I would not let that deter you: just use .f95 extensions on the 
Fortran 95 files and avoid underlines.  For Windows users you are 
effectively requiring R >= 2.6.0.


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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-devel mailing list