On 28 July 2017 at 19:14, Iñaki Úcar wrote:
| 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).

I recall that clever trick.

The problem is that R Core really does not want us to access such unexported
access points.

Dirk

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org
_______________________________________________
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