3

When I submit my package to cran I get the error as Found no calls to: 'R_registerRoutines', 'R_useDynamicSymbols' It is good practice to register native routines and to disable symbol search. My package was tested in this version of R by CRAN:

R version 3.4.0 alpha (2017-03-28 r72427)

Note that there is a solution for this error here R CMD check note: Found no calls to: ‘R_registerRoutines’, ‘R_useDynamicSymbols’ but my external codes are in Fortran and tried the procedure described there but does not fix the issue for me. What can I do to overcome the issue? Thanks

Update: Following the procedure described https://www.r-bloggers.com/1-easy-package-registration/ I could pass the

Error:Found no calls to: ‘R_useDynamicSymbols’

But Found no call to: 'R_registerRoutines' still remains.

Community
  • 1
  • 1
Alam_jorab
  • 119
  • 1
  • 8

1 Answers1

6

I solved the problem and you may find it useful for your own case. Let's assume you have a subroutine called myf.f90 in src directory with following content:

    SUBROUTINE cf(r,cd,loci)
    INTEGER::r,cd
    DOUBLE PRECISION::loci
....
....
....
    END SUBROUTINE cf

To register this you need to do the following :

A) Run tools::package_native_routine_registration_skeleton("package directory")

B) Edit the output; for the example above would be:

#include <R.h>
#include <Rinternals.h>
#include <stdlib.h> // for NULL
#include <R_ext/Rdynload.h>

/* FIXME:
Check these declarations against the C/Fortran source code.
*/

/* .Fortran calls */
extern void F77_NAME(cf)(int *r, int *cd, double *loci);

static const R_FortranMethodDef FortranEntries[] = {
  {"cf", (DL_FUNC) &F77_NAME(cf),  3},
  {NULL, NULL, 0}
};

void R_init_packagename(DllInfo *dll)
{
  R_registerRoutines(dll, NULL, NULL, FortranEntries, NULL);
  R_useDynamicSymbols(dll, FALSE);
}

C) Copy and paste the full output in a packagename_init.c file to be put in src/

D) Update NAMESPACE, verifying that useDynLib(packagename, .registration = TRUE)

Alam_jorab
  • 119
  • 1
  • 8
  • Ys, that is exactly what was in the February email by Brian Ripley and eg in my [blog posts](http://dirk.eddelbuettel.com/blog/code/r4/) of last week. Should still point out that the `_xbreed` part reflects your package's name and needs updating. – Dirk Eddelbuettel Apr 04 '17 at 13:48
  • 1
    I was doing exactly like this and still was getting the error and finally I reported it as False Positive to Cran and they agreed that indeed it was a false positive. Thanks for the point. – Alam_jorab Apr 04 '17 at 14:00