[Rcpp-devel] Resolving NativeSymbolInfos from Rcpp (revisited)

Iñaki Úcar i.ucar86 at gmail.com
Fri Jul 28 19:14:36 CEST 2017


Hi all,

I found this interesting thread by Davor Cubranic in which Romain came
up with a solution for calling a C routine from the 'stats' package:
http://lists.r-forge.r-project.org/pipermail/rcpp-devel/2010-June/000753.html

In a nutshell, I would like to do the same, but with a user-provided
function compiled with Rcpp::cppfunction. Namely,

1) get the externalptr
2) get the DL_FUNC with R_ExternalPtrAddrFn
3) use it

Thanks to Romain, 2) and 3) are straightforward. The problem is the
first step. I saw that, if I compile a function like this

> Rcpp::cppFunction("int foo() { return 1; }")

then I can obtain the externalptr with

> getNativeSymbolInfo("sourceCpp_ID_foo")

but the problem is that you have to figure out this ID. Is there a
general way to obtain the name of the native symbol that Rcpp
produces? (Also I suppose that the initial "sourceCpp_" part could
change in the future).

Regards,
Iñaki


More information about the Rcpp-devel mailing list