Displaying 1 result from an estimated 1 matches for "ncallrfromc".
Did you mean:
callrfromc
2001 Mar 28
1
Help: Using R from C
...xe program. Here is a simple code I am trying to
compile and run (no C++, VC++ is instructed to treat it strictly as C):
#include "R.h"
#include "Rinternals.h"
int main(void)
{
int i;
char *greeting;
SEXP x;
greeting = (char *) Calloc(31, char);
sprintf(greeting, "\nCallRFromC: test 1\n");
printf(greeting);
printf("Here is a vector:\n");
/* allocate an R vector */
PROTECT(x = allocVector(REALSXP, 10));
for(i=0; i<10; i++) {
REAL(x)[i] = (double)i;
printf(" x[%2d] = %lf\n", REAL(x)[i]);
}
UNPROTECT(1);
return 0;
}
The code buil...