From ripley at stats.ox.ac.uk  Tue Dec 18 10:37:25 2007
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Tue, 18 Dec 2007 09:37:25 +0000 (GMT)
Subject: [Rd] Fortran 90 and Windows
In-Reply-To: <4766E847.4060806@montana.edu>
References: <4766E847.4060806@montana.edu>
Message-ID: <Pine.LNX.4.64.0712180912470.7330@gannet.stats.ox.ac.uk>

On Mon, 17 Dec 2007, Dave Roberts wrote:

> I have been revising some FORTRAN 77 routines in R packages I have
> previously submitted.  Since R is now using gfortan I experimented with
> some Fortran 90 code (array intrinsics primarily).  So far the code is
> still in F77 fixed format, in files suffixed .f (not .f90), but
> incorporates some F90 constructs.  It has worked fine in linux/R.  I
> tried to follow the thread of previous discussions on this subject, but
> as fast as things are changing, it was somewhat dated, and not too
> definitive.

'Writing R Extensions' is both up-to-date and definitive, so please read 
the primary documentation.  In particular, we have strengthened the 
comments about not using Fortran I/O, which can cause severe problems when 
using the GUI version of R under Windows (although we now have a 
workaround).

> I don't so my own Windows versions of packages, but rather rely on CRAN
> to do the conversions, and I don't want to send them code that won't
> work on Windows.  Does anybody have extensive experience on what
> elements of F90 can be used in R packages for Windows?  If R CMD SHLIB
> is happy with it, is it likely to work?

Since Windows' builds nowadays use gcc 4.2.1, if it works on your 
unspecified version of gfortran on Linux it will very likely work on 
Windows.  And you can check that for yourself via 
win-builder.r-project.org.

However, using F9x code suffixed .f is not portable, and there are 
plenty of other systems where it will fail, some of which would accept 
.f90 or .f95 extensions.

See also my reply to John Fox:

https://stat.ethz.ch/pipermail/r-devel/2007-December/047695.html

-- 
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



[Rd] Fortran 90 and Windows
Prof Brian Ripley