[R] .Call setAttrib(ans,R_DimSymbol,dim); Crashes.

wolski wolski at molgen.mpg.de
Wed Feb 11 14:13:04 CET 2004


 Hi!


I want to return a matrix. 
The code does the R interfacing.
This version does it fine.

  SEXP ans,dim;
  PROTECT(ans = NEW_NUMERIC(count*2));
  memcpy(NUMERIC_POINTER(ans),result,count*sizeof(double));
  memcpy(&(NUMERIC_POINTER(ans)[count]),occur,count*sizeof(double));
/**  PROTECT(dim=NEW_INTEGER(2));
    INTEGER_POINTER(dim)[0]=2;
   INTEGER_POINTER(dim)[1]=count; 
   setAttrib(ans,R_DimSymbol,dim); 
*/
  UNPROTECT(7);

If I uncomment the lines 5 to 8 than all is working fine four small count's (tested 10,20).
But if the result is an array with about 2000 entries R crashes vicious and violently with the lax comment

Process R trace trap at Wed Feb 11 13:55:45 2004

Anyone is seeiing something what I can not see?

Sincerely Eryk.
Windows 2000
R 1.8.1




More information about the R-help mailing list