Fortran character strings

Prof Brian Ripley Prof Brian Ripley <>
Mon, 6 Sep 1999 13:54:37 +0100 (BST)

Has anyone ever successfully used Fortran character strings with R?

?Foreign says

         R              C                  Fortran
      integer       int *              integer
      character     char **            [compiler dependent]

     Character strings are passed as C arrays of character
     strings to Fortran: the first string may be usable if
     its length is passed separately.

and I have been taking a look. The linkage sends char ** to Fortran.
On the other hand, INTPR and  DBLEPR assume Fortran character strings
are char *.  On all my systems DBLEPR works and .Fortran does not,
but I do know of one compiler (Watcom Fortran for Windows NT) where the 
linkage really is equivalent to char **.

Fortran in S takes the first string in a character vector and passes that as
char * (except on the Watcom-compiled Windows version), as far as I
can deduce without the source code.

I think we should either ban character strings in .Fortran or follow
the S prototype unless someone has a way around this.  With different
compilers on the same platform having different conventions whatever we
do (except a ban) will be compiler-dependent.

Any suggestions?

Brian D. Ripley,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

r-devel mailing list -- Read
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: