search for: passptr

Displaying 1 result from an estimated 1 matches for "passptr".

2011 Nov 02
1
can one modify array in R memory from C++ without copying it?
...ng them, just by passing pointers to them. Since i don't know internal data structures of R, i am not sure it's possible, but i thought it was. Here is some toy code that i thought should work, but doesn't. Maybe someone could point out the error i am making i have the following in the passptr.cpp to multiply array elements by 2 =============================== extern "C"{ void modify(double *mem, int *nr, int *nc){ for(int i=0; i< (*nr)*(*nc); i++) mem[i]=2*mem[i]; } } ---------------------------------------------- I compile it into a shared library using R CMD SH...