ropensci / redland-bindings

Redland librdf language bindings
http://librdf.org/bindings/
Other
17 stars 3 forks source link

register native routines for R 3.4 and after #71

Closed mbjones closed 6 years ago

mbjones commented 6 years ago

R now checks that native routines are registered (see https://github.com/RcppCore/Rcpp/issues/636#issuecomment-280985661 for an overview). The NOTE we get on the CRAN package page is:

checking compiled code ... NOTE
File ‘redland/libs/redland.so’:
  Found no call to: ‘R_useDynamicSymbols’

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

See ‘Writing portable packages’ in the ‘Writing R Extensions’ manual.

Add a skeleton init method to fix this. To seed this file, run tools::package_native_routine_registration_skeleton(".") which will produce the code needed to register the routines.

mbjones commented 6 years ago

More details in Writing R Extensions.

mbjones commented 6 years ago

Generated a skeleton init file and checked it into branch feature-register-methods, but still need to successfully compile and test on multiple platforms:

gothub commented 6 years ago

@mbjones this problem was addressed in commit 47879483432139222e9f03db184741595d8b0bdc. The solution in this commit was a bit different than the one in the feature branch, and involves updating the SWIG input file so that the generated 'redland.c' file includes the necessary source lines. This fix has been tested on R 3.5 for ubuntu, macos, windows.

gothub commented 6 years ago

This hasn't been tested on R 3.4, which I will do.

mbjones commented 6 years ago

OK, let's just be sure the SWIG generated version produces everything that comes out of tools::package_native_routine_registration_skeleton(".")

gothub commented 6 years ago

I updated src/redland.c to include everything that the tools::package_native_routine_registration_skeleton(".") version does. After considerable searching through SWIG docs and source, it's not apparent how to include

   {"isnull", (DL_FUNC) &isnull, 1},

in the block

SWIGINTERN R_CallMethodDef CallEntries[] = {
...
}

by adding directives, etc. to Redland.i, so I had to manually edit src/redland.c, which is not ideal, as these changes will be overwritten/omitted the next time a developer runs 'swig.sh' or make all in the redland-bindings/.R directory. If anyone knows an alternative approach, please let me know.

Updated in commit 4177381cb8747e002efafaac2009661b7e53beaf