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

From: Berwin A Turlach <berwin_at_maths.uwa.edu.au>
Date: Thu, 13 Mar 2008 00:17:37 +0800

G'day Krishna,

On Wed, 12 Mar 2008 08:59:30 -0700 (PDT) "poolloopus_at_yahoo.com" <poolloopus_at_yahoo.com> 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.

Cheers,

        Berwin


R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html 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 https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive