I'm trying to export C++ functions from my R package 'TreeTools' so they can be called from a different package. I've added the line
// [[Rcpp::interfaces(r, cpp)]]
to src/renumber_tree.cpp, per [https://dirk.eddelbuettel.com/code/rcpp/Rcpp-attributes.pdf / http://r-pkgs.had.co.nz/src.html] and when I compileAttributes() and document() the package, there are indicators that the export has been acknowledged:
- Relevant header files are added to
inst/includes; #include "../inst/include/TreeTools.h"is added to the start ofRcppExports.cpp- A function
RcppExport SEXP _TreeTools_RcppExport_registerCCallable()is added to the end ofRcppExports.cpp
Compliation nevertheless fails with
Error in .Call("_TreeTools_RcppExport_registerCCallable", PACKAGE = "TreeTools") :
"_TreeTools_RcppExport_registerCCallable" not available for .Call() for package "TreeTools"
Can anyone help me to debug this error?
Could it be related to the fact that I have a manually-generated PACKAGE-init.c file?
compileAttributes()when you (re-)define interface. I was just using this on a package the other day and corresponding glue is generated. Make sure all files are updated, what you show leads me to suspect one was left behind. - Dirk Eddelbuettelsrc/RcppExports.cpp. Also, and this may sound like extra work, maybe test the basic functionality on a one-function ad-hoc package. - Dirk Eddelbuettel