On Wed, 7 Apr 2004 15:55:38 +0200, "Alessandro Soranzo" <[EMAIL PROTECTED]> wrote :
>Dear all, >I'm studing how to include .c code in my .r functions . In the R-exts.pdf >manual I have found the following code. At one point the author write >"called from R by"... >How can I load a .c file on R? ( I am using a xp windows as so.) You need to compile it into a DLL. How to do that depends on your compiler. Instructions for the recommended compiler (MinGW's gcc) are in the readme.packages file (which should have been installed in the R home directory). Instructions for some other compilers are on my web page, at <http://www.stats.uwo.ca/faculty/murdoch/software/compilingDLLs/>. >} >#called from R by ?????????????????????? >conv <- function(a, b) >.C("convolve", >as.double(a), >as.integer(length(a)), >as.double(b), >as.integer(length(b)), >ab = double(length(a) + length(b) - 1))$ab This will look for a function named "convolve", in one of the loaded DLLs. It's safer (and R CMD CHECK now warns you about this) to specify the package where "convolve" lives; then the search will look in the DLL for that package. See the help for .C for the syntax. Duncan Murdoch ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
