[R] the use of the .C function

Bernardo Lagos Alvarez bla at udec.cl
Sat Oct 13 19:26:38 CEST 2007

Hi all,

here others doubts, when load and running the function

void gdot(double *x,double *y,int *n,double *output){
int i;
for (i=0;i<*n;i++){

as following

/examplesC$ R CMD SHLIB xby.c
gcc -std=gnu99 -I/usr/share/R/include -I/usr/share/R/include      -fpic  -g -O2 -c xby.c
-o xby.o
gcc -std=gnu99 -shared  -o xby.so xby.o   -L/usr/lib/R/lib -lR

/examplesC$ R
> dyn.load("xby.so")

 *** caught segfault ***
address (nil), cause 'memory not mapped'

 1: .C("gdot", myx = as.double(x), myy = as.double(y), myn = as.integer(NROW(x)),    
myoutput = numeric())

Possible actions:
1: abort (with core dump)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace

Can anybody answerme that happening with this Traceback?

Thanking you in advance,
Bernardo Lagos A.

More information about the R-help mailing list