[Rcpp-devel] pass an arma::mat& to a exported function in a package
Dirk Eddelbuettel
edd at debian.org
Wed Dec 11 20:11:54 CET 2013
On 11 December 2013 at 18:53, riadh zaatour wrote:
| Hello,
| I have a code looking like this :
|
| #include <RcppArmadillo.h>
| // [[Rcpp::depends(RcppArmadillo)]]
| using namespace Rcpp;
|
| // [[Rcpp::export]]
| void func1(arma::mat& a) {
| ....
| }
| this compiles and executes fine when used with sourceCpp().
|
| Then I include this code in a package, I call compileAttributes(), then I build
| and install my package and all that works fine.
| Then, in R :
|
| a=matrix(c(0,1,1,0),ncol=2,byrow=TRUE)
| func1(a)
| does not work and I receive the message
|
| Error in .Call("pkgname_func1", PACKAGE = "pkgname", a, :
| "pkgname_func1" not available for .Call() for package "pkgname"
|
|
| If I put SEXP instead of arma::mat& as a parameter type in the exported function, all work fine.
|
| Have I missed something for that to work with sourceCpp() and fail when within a package?
We cannot tell as you supplied incomplete sources.
Package building via Rcpp Attributes and compileAttributes works for a lot of
people, as well as unit testing robots. so I suggest you sit down with the
corresponding vignette and work it out. We can't from here.
Dirk
| Thanks a lot
| Riadh
|
|
|
|
|
| ----------------------------------------------------------------------
| _______________________________________________
| Rcpp-devel mailing list
| Rcpp-devel at lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
--
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
More information about the Rcpp-devel
mailing list