Re: [Rd] reinterpreting externalptr in R

2012-12-27 Thread andre__
Thanks a lot ... -- View this message in context: http://r.789695.n4.nabble.com/reinterpreting-externalptr-in-R-tp4653908p4654033.html Sent from the R devel mailing list archive at Nabble.com. __ R-devel@r-project.org mailing list https://stat.eth

Re: [Rd] reinterpreting externalptr in R

2012-12-26 Thread romain
Andre, For Rcpp, you can use the XPtr class template. Say you want to deal with pointers to Foo. You can create an R external pointer like this: SEXP create_xp_foo(){ Foo* foo = new Foo ; XPtr xp( foo ) ; return xp ; } Now, "xp" is an R external pointer, i.e. a SEXP of type EXTPTR

Re: [Rd] reinterpreting externalptr in R

2012-12-25 Thread Simon Urbanek
On Dec 25, 2012, at 6:39 AM, andre__ wrote: > Hi, > > I am using swig to build a wrapper for an c-function to use it in R. I would > like to define a generic function, which gives back a void pointer. On the R > side, I know what this pointer is pointing to, whether it is an integer or > an strin