[R] not safe to return vector pointer

Chris Jeffery cjeff at geog.ubc.ca
Mon Sep 10 22:09:31 CEST 2001


Hello All,

I recently upgraded from R-1.1.1 to R-1.2.2.

I have an R function that uses .Call() to
return a list from C code.  The C code
has the form:

SEXP function(SEXP var)
{
   SEXP rlist ;  
   PROTECT(rlist = NEW_LIST(3)) ;  
   VECTOR_PTR(rlist)[0] = NEW_INTEGER(1) ;
   VECTOR_PTR(rlist)[1] = NEW_STRING(1) ;

   ...

   UNPROTECT(1) ;

   return(rlist) ;
}

When I try to .Call("function",...) from R I get
the following error message:

Error: not safe to return vector pointer

Why is it no longer safe to return a vector pointer?
How can I correct this problem?

Thanks in advance,

Chris
------------------------------------------------------------
Chris Jeffery  (cjeff at geog.ubc.ca)
Department of Geography,                 Tel: (604) 822-2663
University of British Columbia, B.C.     Fax: (604) 822-6150

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list