0

I rebuilt the package I'm developing (and that I haven't been updating since one month) and I found that all my tests fail with the error:

Error in myCPlusPlusFun(...  : 
object 'myPackage_myCPlusPlusFun' not found

I then found out that the argument PACKAGE = myPackage is missing from all the functions in my RcppExports.R file, see the output of git diff:

 myCPlusPlusFun <- function(X) {
-    invisible(.Call('myPackage_myCPlusPlusFun', PACKAGE = 'myPackage', X))
+    invisible(.Call(myPackage_myCPlusPlusFun, X))

Any idea of what happened? I guess I would need to have the

invisible(.Call('myPackage_myCPlusPlusFun', PACKAGE = 'myPackage', X))

line generated again automatically when I build my package (?)

Thank you!

EDIT: I now have the following lines in my NAMESPACE file:

exportPattern("^[[:alpha:]]+")
importFrom(Rcpp,evalCpp)
useDynLib(locus, .registration = TRUE)

(plus some other imports and exports).

I also had to add recently a C file to register dynamics symbols with the following content:

#include <R.h>
#include <Rinternals.h>
#include <R_ext/Rdynload.h>

void R_init_myPackage(DllInfo* info) {
  R_registerRoutines(info, NULL, NULL, NULL, NULL);
  R_useDynamicSymbols(info, TRUE); 
}

is this latter file still needed?

ixpl
  • 259
  • 1
  • 8
  • Possible duplicate of [function leading to check error in automatically generated RcppExports.R](https://stackoverflow.com/questions/44666294/function-leading-to-check-error-in-automatically-generated-rcppexports-r) – coatless Jun 24 '17 at 18:59
  • Thanks, I'm having a look at this too (but not able to solve the problem for now)... – ixpl Jun 24 '17 at 19:44

1 Answers1

2

Yes, "everything changed" because R 3.4.0 made us, and we conform.

The second part is definitely ok -- that is how the is supposed to look like.

Please check that - you have the generated src/RcppExports.cpp - you have the proper registration information in NAMESPACE

Numerous packages have been updated over the last few weeks, this generally works. If in doubt, maybe create a quick one-off package via Rcpp.package.skeleton() and compare.

Also note that we had two corner cases which needed fixing, so there is a interim release available if you need it (cf rcpp-devel posting) -- but I don't think you do.

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
  • Thank you very much for your help. I've looked at the files generated using `Rcpp.package.skeleton()`. However, I'm still stuck with the issue. I've added an EDIT to my post which mention the info I have in my `NAMESPACE` and in another file registering dynamic symbols. Could you please give me your input on their content? Thanks again! – ixpl Jun 24 '17 at 19:43
  • You may not need that file. If there is no file with calls to `R_registerRoutines()`, then Rcpp will add this to `src/RcppExports.cpp`. However, if you already have it, then yours will be kept. Also, you may need to list the symbols you want exported from `NAMESPACE` as the wildcard expression you have also exports the generated symbol for `.Call()` so that you will get a warning about missing documentation. – Dirk Eddelbuettel Jun 24 '17 at 20:02
  • If [this](https://github.com/hruffieux/locus) is your repo, then all seems good. R only complains about Matrix in `Imports:` but not being imported from in `NAMESPACE`. Works both ways for, with and without regenerated `RcppExports.cpp` with its updated dyanmic registration. – Dirk Eddelbuettel Jun 24 '17 at 20:25
  • Thanks! It works now, I indeed had to remove the registration of dyn symbols (added 1-2 months ago to silence a note. But this note has disappeared now). And indeed, I hadn't realized that `exportPattern("^[[:alpha:]]+")` was exporting everything when I re-added it. Again, thanks for your help, it was more than useful! – ixpl Jun 24 '17 at 20:28