[Rcpp-devel] Rcpp modules and parsing an object back and forth between R & C++
romain at r-enthusiasts.com
Tue Feb 19 18:14:06 CET 2013
Le 19/02/13 17:21, Hadley Wickham a écrit :
> Hi all,
> I'd like to have a simple C++ object that I can work with in either
> C++ or R. I can create the class, and expose it to R with modules
> (https://gist.github.com/hadley/4987110), but I don't know how to
> write the SEXP constructor or SEXP() operator to make it easy to move
> it back and worth between C++ and R. I presume I just have to grab and
> cast an external pointer, but I don't know the structure of the R
> object that the module creates. Could anyone point me in the right
Unfortunately, at the moment modules and attributes don't play together.
The attributes feature used to be built on top of modules, but this
caused issues on windows.
One thing we could perhaps negociate with JJ is recognition of the
export attribute on module. Something like :
or perhaps even just recognizing the RCPP_MODULE declaration.
Once we have that, you won't need the SEXP constructor or the SEXP
conversion operator, and you would only need that before your class
So that as and wrap are taken care of.
Professional R Enthusiast
+33(0) 6 28 91 30 30
R Graph Gallery: http://gallery.r-enthusiasts.com
|- http://bit.ly/14LJhmm : bibtex 0.3-5
`- http://bit.ly/RE6sYH : OOP with Rcpp modules
More information about the Rcpp-devel