Hi, I am trying to call Rdqags (from R_ext/Applic.h) in a C++ program that uses RcppArmadillo. Everything seems to work fine except the compiler warns about conflicts. Is there a way to avoid these conflicts? Could they cause any unforeseen problems? Below is a self-contained example illustrating the problem. Note that RcppArmadillo is not actually required in the example, but it is in my program. See below for sessionInfo().
Thanks, Richard library(RcppArmadillo) library(inline) # Integrand inc <- " #include <R_ext/Applic.h> void f(double *x, int n, void *ex) { double *v; v = (double*)ex; double sigma = v[0]; for(int i=0; i<n; i++) { x[i] = exp(-(x[i]*x[i]) / (2*sigma*sigma)); } } " # Compute integral f <- cxxfunction(signature(sigma_="numeric", lower_="numeric", upper_="numeric"), " double sigma = as<double>(sigma_); double lower = as<double>(lower_); double upper = as<double>(upper_); void *ex; ex = σ double epsabs = 0.001; double epsrel = 0.001; double result = 0.0; double abserr = 0.0; int neval = 0; int ier = 0; int limit = 50; int lenw = 200; int last = 0; int iwork = 50; double work = 200.0; Rdqags(f, ex, &lower, &upper, &epsabs, &epsrel, &result, &abserr, &neval, &ier, &limit, &lenw, &last, &iwork, &work); return Rcpp::List::create(result, abserr, last, ier); ", plugin="RcppArmadillo", includes=inc) fr <- function(x, sigma=1) exp(-x^2 / (2*sigma*sigma)) sig <- 10 f(sig, 0, 2) str(integrate(fr, 0, 2, sigma=sig)) > sessionInfo() R version 2.14.1 (2011-12-22) Platform: i386-pc-mingw32/i386 (32-bit) locale: [1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C [5] LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] inline_0.3.8 unmarked_0.9-6 RcppArmadillo_0.2.34 [4] Rcpp_0.9.9 lattice_0.20-0 reshape_0.8.4 [7] plyr_1.7.1 loaded via a namespace (and not attached): [1] grid_2.14.1 tools_2.14.1 _______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel