Skip to content
Prev 53619 / 63421 Next

Philosophy behind converting Fortran to C for use in R

Hi,

Just a quick comment on (1).

The C-Fortran interface has been standardized since Fortran 2003.  However, it does require the Fortran interface that is being called from C  to have been written with C operability in mind as specific C interoperable types etc. must be used.

Trying to call a Fortran interface that hasn't been written using C interoperable types still suffers from the issues that Bill describes.
 
Martyn

-----Original Message-----
From: R-devel [mailto:r-devel-bounces at r-project.org] On Behalf Of William Dunlap via R-devel
Sent: 06 June 2017 22:34
To: Avraham Adler <avraham.adler at gmail.com>
Cc: R-devel <r-devel at r-project.org>
Subject: Re: [Rd] Philosophy behind converting Fortran to C for use in R

Here are three reasons for converting Fortran code, especially older
Fortran code, to C:

1. The C-Fortran interface is not standardized.  Various Fortran compilers
pass logical and character arguments in various ways.  Various Fortran
compilers mangle function and common block names in variousl ways.  You can
avoid that problem by restricting R to using a certain Fortran compiler,
but that can make porting R to a new platform difficult.

2. By default, variables in Fortran routines are not allocated on the
stack, but are statically allocated, making recursion hard.

3. New CS graduates tend not to know Fortran.

(There are good reasons for not translating as well, risk and time being
the main ones.)


Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Tue, Jun 6, 2017 at 1:27 PM, Avraham Adler <avraham.adler at gmail.com>
wrote:
______________________________________________
R-devel at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

________________________________________________________________________
This e-mail has been scanned for all viruses by Star.
________________________________________________________________________
Message-ID: <DB5PR05MB15284C373683C21D617DBC40A1C80@DB5PR05MB1528.eurprd05.prod.outlook.com>
In-Reply-To: <CAF8bMcYjWOXhdM05Ce7SZZmkg=H+PYE364ncSM06P_omTmVC=w@mail.gmail.com>