From 6da021ff1fc9cd952728a739ef8673f3351dff01 Mon Sep 17 00:00:00 2001 From: Simon Schwab Date: Thu, 23 Mar 2017 16:56:19 +0000 Subject: [PATCH 1/2] Fixing R CRAN registration warning --- NAMESPACE | 2 +- devel/README.md | 51 +++++++++++++++++++++++++++++++++++++++++++++---- src/register.c | 22 +++++++++++++++++++++ 3 files changed, 70 insertions(+), 5 deletions(-) create mode 100644 src/register.c diff --git a/NAMESPACE b/NAMESPACE index f1502cd..a0d63a7 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,4 +1,4 @@ -useDynLib(multdyn) +useDynLib(multdyn, .registration = TRUE) # Generated by roxygen2: do not edit by hand export(binom.nettest) diff --git a/devel/README.md b/devel/README.md index 67422fb..9f0cd01 100644 --- a/devel/README.md +++ b/devel/README.md @@ -10,7 +10,7 @@ ### Switch to develop branch git checkout develop - + ### Review, pull, commit and push git status git diff @@ -28,7 +28,7 @@ git pull # to update the state to the latest remote master state git merge develop # to bring changes to local master from your develop branch git push origin master # push current HEAD to remote master branch - + ## Package building for CRAN make doc make build @@ -47,7 +47,7 @@ Test functions are written for the *testthat* package and can be found in the fo OK: 22 SKIPPED: 0 FAILED: 0 DONE ========================================================================================= - + ## Run benchmarks library(devtools) @@ -71,4 +71,47 @@ Test functions are written for the *testthat* package and can be found in the fo 60-fold speed improvement compared to the native R implementation (cpp=F). - +## Magic stuff to resolve CRAN complaints + +See https://github.com/RcppCore/Rcpp/issues/636 + +Download R-devel.tar.gz from https://cran.r-project.org/sources.html +``` +mkdir ~/tmp +cd ~/tmp +wget https://stat.ethz.ch/R/daily/R-devel.tar.gz +tar -xvf R-devel.tar.gz +``` +Then, in R, do the following: +``` +source("~/tmp/R-devel/src/library/tools/R/sotools.R") +source("~/tmp/R-devel/src/library/tools/R/utils.R") +setwd("~/workspace/multdyn") + +package_native_routine_registration_skeleton(".") +``` +The function will output some code, copy and paste this to `src/register.c` +``` +#include +#include +#include // for NULL +#include + +/* FIXME: + Check these declarations against the C/Fortran source code. +*/ + +/* .Call calls */ +extern SEXP multdyn_dlmLplCpp(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); + +static const R_CallMethodDef CallEntries[] = { + {"multdyn_dlmLplCpp", (DL_FUNC) &multdyn_dlmLplCpp, 7}, + {NULL, NULL, 0} +}; + +void R_init_multdyn(DllInfo *dll) +{ + R_registerRoutines(dll, NULL, CallEntries, NULL, NULL); + R_useDynamicSymbols(dll, FALSE); +} +``` diff --git a/src/register.c b/src/register.c new file mode 100644 index 0000000..00cf2ef --- /dev/null +++ b/src/register.c @@ -0,0 +1,22 @@ +#include +#include +#include // for NULL +#include + +/* FIXME: + Check these declarations against the C/Fortran source code. +*/ + +/* .Call calls */ +extern SEXP multdyn_dlmLplCpp(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); + +static const R_CallMethodDef CallEntries[] = { + {"multdyn_dlmLplCpp", (DL_FUNC) &multdyn_dlmLplCpp, 7}, + {NULL, NULL, 0} +}; + +void R_init_multdyn(DllInfo *dll) +{ + R_registerRoutines(dll, NULL, CallEntries, NULL, NULL); + R_useDynamicSymbols(dll, FALSE); +} From bd1c0c3a123b813f87d84e52540486c8cc7487e8 Mon Sep 17 00:00:00 2001 From: Simon Schwab Date: Thu, 23 Mar 2017 17:00:50 +0000 Subject: [PATCH 2/2] Fixing R CRAN registration warning --- DESCRIPTION | 2 +- devel/README.md | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 7b79e11..9743e86 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: multdyn -Version: 1.5 +Version: 1.5.1 Date: 2017-03-21 Title: Multiregression Dynamic Models Author: Simon Schwab , Ruth Harbord , diff --git a/devel/README.md b/devel/README.md index 9f0cd01..7a27f2b 100644 --- a/devel/README.md +++ b/devel/README.md @@ -115,3 +115,8 @@ void R_init_multdyn(DllInfo *dll) R_useDynamicSymbols(dll, FALSE); } ``` + +Finally, this needs to go into `NAMESPACE`, see Makefile. +``` +useDynLib(packagename, .registration = TRUE). +```