[Rd] LOGICAL arguments in FORTRAN code

Berwin A Turlach berwin at maths.uwa.edu.au
Thu Apr 8 12:32:35 CEST 2010


G'day all,

I just took over maintenance of the quadprog package from Kurt Hornik
and noticed that one of the FORTRAN routines has an argument that is
declared to be a LOGICAL.  The R code that calls this routine (via
the .Fortran interface) passes the argument down wrapped in a call to
as.logical().

This was fine (and as documented) under S-Plus 3.4, for which this code
was originally developed.  However, as far as I know, in R objects of
storage mode logical were always supposed to be passed to FORTRAN
arguments of type INTEGER; and that is what the current "Writing R
extension manual states".

Thus, given that the port of quadprog existed for quite some time, I
am wondering whether it is o.k. to pass R objects with storage mode
logical into FORTRAN code to arguments declared as LOGICAL?  Or should
the FORTRAN code be corrected to declare the argument in question as
INTEGER?   

Cheers,

	Berwin



More information about the R-devel mailing list