Dear list,
This is probably not specific to Rcpp but I couldn't find any advice in the R-exts manual. I am using RcppArmadillo in a package to do some linear algebra. The C++ code is getting a bit too large to manage in one file only, I would like to split its content in several files. It seems possible, but I'm not sure how to deal with the scoping rules: if a function requires a subroutine defined in another file it seems to have a scoping problem (the compilation fails with message "error: ‘xxxx’ was not declared in this scope)". Currently my cpp file looks like this, /////////////////////////////////////////////////// #include "cda.h" #include <RcppArmadillo.h> #include <iostream> using namespace Rcpp ; using namespace RcppArmadillo ; using namespace std; extern "C" { arma::mat foo(const arma::mat& R) { return(R); } // R wrapper RCPP_FUNCTION_1(NumericMatrix, test, NumericMatrix IR) { arma::mat R = Rcpp::as< arma::mat >(IR); return wrap( foo(R) ); } // other routines } /////////////////////////////////////////////////// (The actual file is here: https://r-forge.r-project.org/scm/viewvc.php/pkg/cda/src/cda.cpp?diff_format=h&root=photonics&view=log) Are there workarounds / rules to split the content in several files? 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