Skip to content
Prev 2664 / 10988 Next

[Rcpp-devel] Passing an exposed function to another C++ function as a parameter

Hi,

This looks very similar to a problem Dirk faced in rewriting the DEOptim 
package to use Rcpp (the RcppDE package is on the Rcpp svn repo).

Essentially the problem is that the Rcpp::Function is a C++ object that 
calls back to R, with additional protection, which eventually calls C++.

You should be able to bypass this entirely and access directly the 
pointer to the C++ function from the R variable. This way, you stay in 
the C++ world. This would allow you to branch your code depending on 
whether you loop over a pure R function or a C++ function.

I'll cook an example.

Romain

Le 03/08/11 08:22, Manuel Castej?n Limas a ?crit :