[R] Problem when calling FORTRAN subroutine (dll)

Berwin A Turlach berwin at maths.uwa.edu.au
Wed Mar 12 17:17:37 CET 2008


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 

=========================== Full address =============================
Berwin A Turlach                            Tel.: +65 6516 4416 (secr)
Dept of Statistics and Applied Probability        +65 6516 6650 (self)
Faculty of Science                          FAX : +65 6872 3919       
National University of Singapore     
6 Science Drive 2, Blk S16, Level 7          e-mail: statba at nus.edu.sg
Singapore 117546                    http://www.stat.nus.edu.sg/~statba



More information about the R-help mailing list