[Rcpp-devel] NULL value passed as symbol address with all C++ functions
Barth Riley
barthriley at comcast.net
Wed Nov 7 21:49:14 CET 2018
I apologize if this question has been asked before but after doing several searches I could not find an answer that is directly applicable to my problem. I am working on a package containing a number of Rcpp functions. The package builds and loads without a problem. However, when I call any of the Rcpp functions from within R, I get the following type of error message:
Error in .Call(<pointer: (nil)>, x, xMin, xMax, adjustment) :
NULL value passed as symbol address
As an example, here is the function that returned the error in the C++ file:
// [[Rcpp::export]]
NumericVector logit(Rcpp::NumericVector x,
Rcpp::NumericVector xMin,
Rcpp::NumericVector xMax,
double adjustment = 0.3) {
...
}
The exported function in RcppExports.cpp:
// logit
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
}
And the corresponding R file:
logit <- function(x, xMin, xMax, adjustment = 0.3) {
.Call(`_MFRM_logit`, x, xMin, xMax, adjustment)
}
First, how can there be two functions called "logit"--one in the main C++ file and one in RcppExports.cpp? And where does _MFRM_logit get defined? Might this be causing the problem?
I should note that hte problem is not limited to this one function, but to all the exported C++ functions.
Second, is there some option in the project or in the C++ files that needs to be set?
I am running R 3.51, RStudio 1.14, and Rcpp (0.12.19).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20181107/72f88b99/attachment.html>
More information about the Rcpp-devel
mailing list