[Rd] Fortran 90 and Windows

Dave Roberts droberts at montana.edu
Tue Dec 18 17:43:47 CET 2007


Thank you kindly Professor Ripley, Peter Dalgaard and Jari Oksanen. 
Although I had searched for Fortran 90 in various R locations, I hadn't 
thought to search for Fortran 95, and so hadn't seen Professor Ripley's 
reply to John Fox.  I just joined this list yesterday, and saw the 
December archive just after posting.

As pointed out by Professor Ripley, my approach (Fortran 90 constructs 
in *.f files) relies on the idiosyncrasies of gcc and R CMD SHLIB, and 
is clearly not portable.  However, given that gcc is the engine of R, it 
seems almost worth the gamble.  Fortran 90 array intrinsics are almost 
like compiled S, and very compelling in some circumstances.

I was unaware of win-builder.r-project.org, and will certainly give that 
a shot.  On the other hand, if I hear from very old *nixes that my code 
won't work, I'll probably relent.

Again, thank you all, Dave

Prof Brian Ripley wrote:
> 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
> 


-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
David W. Roberts                                     office 406-994-4548
Professor and Head                                      FAX 406-994-3190
Department of Ecology                         email droberts at montana.edu
Montana State University
Bozeman, MT 59717-3460



More information about the R-devel mailing list