[Rcpp-devel] rcpp_modules: Passing object pointer back to C++
Jelmer Ypma
jelmerypma at gmail.com
Mon Jan 23 08:00:42 CET 2012
The credit for that bit of cleverness should go to Romain. He
mentioned the trick here some time ago,
http://www.mail-archive.com/rcpp-devel@lists.r-forge.r-project.org/msg01807.html
Jelmer
On Mon, Jan 23, 2012 at 00:20, Dirk Eddelbuettel <edd at debian.org> wrote:
>
> 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