Hi all,

I was trying to set up an interface for using C functions in R. For this, my R 
file hello2.r is:

---------------------------------------------------------------------------------

hello2 <- function(n) {
.C("hello", as.integer(n))
}

hello2(3)
--------------------------------------------------------------------------------

and my hello.c file is:

------------------------------------------------------------------------------
#include <R.h>
void hello(int *n)
{
    int i;
    for(i=0; i < *n; i++) {
    Rprintf("Hello, world!\n");
    }
}
---------------------------------------------------------------------------

>From my windows command line, I execute:

> R CMD SHLIB hello.c

but I get the error message:
Error: syntax error in "R CMD". I am trying to look up information on the web 
page at:  
http://cran.r-project.org/doc/manuals/R-exts.html#dyn_002eload-and-dyn_002eunload

As I understand it, I need to load some files, but I don't understand which 
commands I need to execute to compile & execute my 'hello world' code.

I am running R 2.4.0 on Windows XP machine.

Any help would be highly appreciated.

thanks!

 
---------------------------------
Food fight? Enjoy some healthy debate

        [[alternative HTML version deleted]]

______________________________________________
[email protected] 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.

Reply via email to