Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
515 views
in Technique[技术] by (71.8m points)

compilation - R CMD check note: Found no calls to: ‘R_registerRoutines’, ‘R_useDynamicSymbols’

How to avoid the following NOTE that is appearing in R CMD check with the new R development version ( R Under development (unstable) (2017-02-15 r72179))?

? checking for unstated dependencies in examples ... OK
? checking line endings in C/C++/Fortran sources/headers ... OK
? checking compiled code ... NOTE
File ‘pkgname/libs/pkgname.so’:
  Found no calls to: ‘R_registerRoutines’, ‘R_useDynamicSymbols’

It is good practice to register native routines and to disable symbol
search.

For example in Hmisc

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The message is somewhat arcane. I looked around also in other packages and I found that the useDynLib(packagename) in the NAMESPACE file was replaced by useDynLib(packagename, .registration = TRUE).

In addition, I added a .c file, named registerDynamicSymbol in the src/ directory with the following code:

// RegisteringDynamic Symbols

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

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

I took this suggestion from GitHub Rcpp. The canonical reference is in Writing R Extensions

Also R Devel Mailinglist provided supplementary infos.

UPDATE

The most direct straightforward approach is:

  1. use the current R Development Version (that will eventually become 3.4)
  2. Run the tools::package_native_routine_registration_skeleton(".") and copy and paste the full output in a packagename_init.c file to be put in src/
  3. update NAMESPACE, verifying that useDynLib(packagename, .registration = TRUE)
  4. If necessary, replace the exportPattern with export( list of object to be exported )

UPDATE 18th July

As noted by @Symbolix using the most recent version of R and RStudio's devtools the point 2. (init.c files) appears handled by either devtools (using RStudio check digit) or tools packages.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...