[Rcpp-devel] rcpp_modules: Passing object pointer back to C++

Dirk Eddelbuettel edd at debian.org
Mon Jan 23 01:20:17 CET 2012


Michael,

Can you mock up a more complete example of what you are trying to do?  

I am a little worried about the lifecycle of objects allocated that way,
about who owns them, and what happens to the memory. From my casual look at
it, Jelmer's code is pretty clever but I am not sure calling R's new() to
allocate inside of what you consider a C++ object might be too clever by half
and hurt you later.

Rcpp::XPtr() will always fit in the framework of .Call() functions receiving
and returning SEXP. 

On the other hand, Rcpp modules are very useful, but also known to have
limits as eg the lack of serialization/deserialization for load and save.

Dirk

-- 
"Outside of a dog, a book is a man's best friend. Inside of a dog, it is too
dark to read." -- Groucho Marx


More information about the Rcpp-devel mailing list