On Fri, Dec 5, 2014 at 12:54 AM, Romain François
<rom...@r-enthusiasts.com> wrote:
>
> You are looking for XPtr.

Thanks guys, exactly what I needed indeed. One follow-up question:

Is there a way to use the XPtr object to prevent the c++ object it
points to from going out of scope? It seems like the c++ garbage
collector destroys the handle after the function returns, even though
the handle is referenced by the XPtr that I just created. I was hoping
that it would automatically be protected as long as the EXTPTRSXP is
pointing to it, but that does not seem to be the case.

I am currently working around it by maintaining a list of handles in
the global scope, but it would be more elegant if R(cpp) would take
care of it.
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to