2017-07-29 15:02 GMT+02:00 Sokol Serguei <serguei.so...@gmail.com>: > Jj Allaire has written at Sat, 29 Jul 2017 07:58:13 -0400 > > The best you can do is to get the pointer to the function (not sure if that > does what you are hoping for): > > func <- Rcpp::cppFunction("int foo() { return 1; }") > >> body(func) > .Primitive(".Call")(<pointer: 0x103bf0f40>) > > And to narrow even more: >> Rcpp::cppFunction("int foo() { return 1; }") >> as.list(body(foo))[[2]] > <pointer: 0x7f01d493fae0> > attr(,"class") > [1] "NativeSymbol"
Oh, I went that far, but I didn't realise that it is already an externalptr, even if it says "NativeSymbol", isn't it? Thanks, JJ and Serguei for pointing this out! 2017-07-29 15:22 GMT+02:00 Dirk Eddelbuettel <e...@debian.org>: > > Are you aware of what we can do with Rcpp::XPtr and what e.g. the RcppDE > package does to pass __user-supplied C++ functions__ down to the core of the > optimization to avoid touching R code? There is also a Rcpp Gallery piece > on this: http://gallery.rcpp.org/articles/passing-cpp-function-pointers/ Yes, I am, and I think that my use case is slightly different. My understanding is, correct me if I'm wrong, that RcppDE implements some C++ functions and the user is able to choose which one the backend should use via its name. In my case, the user is the one that would implement a C++ function for which the backend is unaware: it doesn't know the name and it's located in another dynamic library. Iñaki _______________________________________________ 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