[Rcpp-devel] Pass an Rcpp module object to a method belonging to another module from R?
xian at unm.edu
Wed Sep 10 06:06:04 CEST 2014
> Below is a simplified example, with question marks where I'm not sure what
> to do. I've tried accepting a pointer to A, playing with using XPtrs, and a
> bunch of things which made far less sense, but so far no luck.
As an addendum to others' comments...
I've been working on a kinda-sorta similar problem: passing
user-supplied C++ worker functions to a module's method. Not sure if
it helps, but it's a full example of passing XPtrs from C++ to R back
to a module's method, where it's called in C++:
* In ./src/helpers.cpp, sapply_master(infun, cppfun=true) takes an R
function infun that returns an XPtr to a function that does something.
sapply_master pulls the XPtr, dereferences it to the C++ function, and
calls that function on a class member.
* In ./inst/tests/userFun.cpp are the user-specified worker functions,
and the associated XPtr-exporting wrapper functions that are passed to
Incidentally, my plan is for this to be a gallery post in the not too
A man, a plan, a cat, a ham, a yak, a yam, a hat, a canal – Panama!
More information about the Rcpp-devel