Hi list, and happy new year, This is a follow-up to a previous query I made on Stack Overflow, http://stackoverflow.com/questions/20474303/using-c-function-from-other-package-in-rcpp where my goal is to use an existing library for numerical integration together with my existing functions using RcppArmadillo.
I've since taken a different perspective: I will call directly the original C routine and ship it with my package. With helpful guidance from Conrad Sanderson I managed to sort out the c/c++ side of things. I now have a stand-alone proof-of-principle code to use the cubature library for numerical integration, with an integrand based on Armadillo objects (and some glue between the two), https://github.com/baptiste/cubature/blob/master/minimal.c The command I'm using to create an executable is g++ -DHCUBATURE -o minimal hcubature.c minimal.c -lm -I /usr/local/include -O2 -larmadillo -framework Accelerate where hcubature.c and associated header files come from cubature ( http://ab-initio.mit.edu/wiki/index.php/Cubature ). The last piece I'm missing is how to compile such source files in a package with the correct flags; my understanding is that most of these flags can be taken care of with a suitable Makevars file. I currently have the following, PKG_LIBS = $(shell $(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()" ) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) but I don't see how to link hcubature.c together with another source file. Do I need a complete Makefile to specify this sort of command? I have zero experience in these matters of compilation, I'd appreciate some guidance or simple examples to follow. Best regards, baptiste
_______________________________________________ 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