Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warning related to registration of native routines #5

Closed
jefferis opened this issue Feb 20, 2017 · 4 comments
Closed

Fix warning related to registration of native routines #5

jefferis opened this issue Feb 20, 2017 · 4 comments

Comments

@jefferis
Copy link
Owner

Latest r-devel (as of 20 Feb 2017) has a problem.

Result: NOTE 
    File ‘nabor/libs/nabor.so’:
     Found no calls to: ‘R_registerRoutines’, ‘R_useDynamicSymbols’
    
    It is good practice to register native routines and to disable symbol
    search.

See:

https://cran.r-project.org/web/checks/check_results_jefferis_at_gmail.com.html#nabor

RcppCore/Rcpp#636

@jefferis jefferis changed the title Fix warning related Fix warning related to registration of native routines May 12, 2017
@jefferis
Copy link
Owner Author

See RcppCore/Rcpp#636

@jefferis
Copy link
Owner Author

See https://www.mail-archive.com/rcpp-devel@lists.r-forge.r-project.org/msg09132.html for discussion and a possible solution for modules. Just running

> tools::package_native_routine_registration_skeleton('.')
#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.
*/

/* .Call calls */
extern SEXP nabor_knn_generic(SEXP, SEXP, SEXP, SEXP, SEXP);

static const R_CallMethodDef CallEntries[] = {
    {"nabor_knn_generic", (DL_FUNC) &nabor_knn_generic, 5},
    {NULL, NULL, 0}
};

void R_init_nabor(DllInfo *dll)
{
    R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
    R_useDynamicSymbols(dll, FALSE);
}

produced an init.c that gave a module loading error exactly as described in the mailing list message linked above.

@jefferis
Copy link
Owner Author

This is the stripped down version

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

void R_init_nabor(DllInfo *dll)
{
    R_registerRoutines(dll, NULL, NULL, NULL, NULL);
    R_useDynamicSymbols(dll, TRUE);
}

@jefferis
Copy link
Owner Author

jefferis commented May 12, 2017

Note that I did not do useDynLib(nabor, .registration=TRUE) in the NAMESPACE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant