[Rcpp-devel] NULL value passed as symbol address
Barth Riley
barthriley at comcast.net
Mon May 13 17:52:47 CEST 2019
Dear list
I a writing a package containing 2 C++ functions using Rcpp version
1.00. I am using R version 3.5.3 and devtools version 2.0.2. I have had
devtools/Rcpp generate the RcppExport.cpp and RcpExport.R files. The
package compiles fine but when I attempt to call these C++ functions, I
receive a NULL value passed as symbol address error. Below is my
generated RcppExport.R file:
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
logit <- function(x, xMin, xMax, adjustment = 0.3) {
.Call('_MFRM_logit', PACKAGE = 'MFRM', x, xMin, xMax, adjustment)
}
#'
#' count_valid
#' @name count_valid
#' @param x A vector of integer values, including missing values
#' @return An integer representing the number of unique non-missing
values in x.
#' @export
#'
count_valid <- function(x) {
.Call('_MFRM_count_valid', PACKAGE = 'MFRM', x)
}
*And here is RcppExport.cpp:*
// Generated by using Rcpp::compileAttributes() -> do not edit by hand
// Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
#include <Rcpp.h>
using namespace Rcpp;
// logit
Rcpp::NumericVector logit(Rcpp::NumericVector x, Rcpp::NumericVector
xMin, Rcpp::NumericVector xMax, double adjustment);
RcppExport SEXP _MFRM_logit(SEXP xSEXP, SEXP xMinSEXP, SEXP xMaxSEXP,
SEXP adjustmentSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< Rcpp::NumericVector >::type x(xSEXP);
Rcpp::traits::input_parameter< Rcpp::NumericVector >::type
xMin(xMinSEXP);
Rcpp::traits::input_parameter< Rcpp::NumericVector >::type
xMax(xMaxSEXP);
Rcpp::traits::input_parameter< double >::type
adjustment(adjustmentSEXP);
rcpp_result_gen = Rcpp::wrap(logit(x, xMin, xMax, adjustment));
return rcpp_result_gen;
END_RCPP
}
// count_valid
int count_valid(IntegerVector x);
RcppExport SEXP _MFRM_count_valid(SEXP xSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< IntegerVector >::type x(xSEXP);
rcpp_result_gen = Rcpp::wrap(count_valid(x));
return rcpp_result_gen;
END_RCPP
}
static const R_CallMethodDef CallEntries[] = {
{"_MFRM_logit", (DL_FUNC) &_MFRM_logit, 4},
{"_MFRM_fitCurve", (DL_FUNC) &_MFRM_fitCurve, 10},
{"_MFRM_count_valid", (DL_FUNC) &_MFRM_count_valid, 1},
{NULL, NULL, 0}
};
RcppExport void R_init_MFRM(DllInfo *dll) {
R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
R_useDynamicSymbols(dll, FALSE);
}
Do the functions have to be sequentially numbered (1,2,3...) in the
R_CallMethodDef structure? And are there any additional procedures
required when compiling the package using the latest version of Rcpp?
Barth
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20190513/8c03f22a/attachment.html>
More information about the Rcpp-devel
mailing list