Re: [R] Problem when calling FORTRAN subroutine (dll)

From: Berwin A Turlach <>
Date: Thu, 13 Mar 2008 00:17:37 +0800

G'day Krishna,

On Wed, 12 Mar 2008 08:59:30 -0700 (PDT) "" <> wrote:

> > output<-.C("smooth_",as.integer(NROW),as.integer(NCOL),as.integer(NDIM),as.real(X),as.real(W),as.real(A),as.real(B),as.integer(NCYCLE),as.integer(ICYCLE),as.real(G),as.real(EPS),as.integer(IFAULT))

  1. You are calling FORTRAN code and not C code, so why are you using .C instead of .Fortran?
  2. Why do you append an underscore to the name of the routine that you are using?
  3. According to the FORTRAN source, the variables are defined as REALs, not as DOUBLE PRECISION. R, by default expects to interface to DOUBLE PRECISION. If you want to interface to REALs, you have to use as.single or set the storage mode to single.

Details regarding all these points are in the "Writing R Extensions" manual which I would strongly recommend you to study.


        Berwin mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Wed 12 Mar 2008 - 16:28:07 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 12 Mar 2008 - 16:30:21 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive