[Rcpp-devel] List of uniform_int_distribution objects
aakremena at aol.com
aakremena at aol.com
Tue Apr 26 20:45:59 CEST 2016
Hi everybody,
1. I am trying to create an Rcpp list, each of whose elements contain an uniform_int_distribution object.
2. My understanding is that since an uniform_int_distribution object is a non-SEXP one, I need to create a specialization of wrap() first.
3. To this end, I am using the following (sample) piece of code:
#include <RcppCommon.h>
#include <random>
namespace Rcpp {
template <> SEXP wrap(const std::uniform_int_distribution<int> &d);
}
#include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
Rcpp::List List_of_Distributions() {
Rcpp::List DISTR(2);
std::uniform_int_distribution<int> dist_1(0, 5); std::uniform_int_distribution<int> dist_2(0, 6);
DISTR[0] = Rcpp::wrap(dist_1); DISTR[1] = Rcpp::wrap(dist_2);
return DISTR;
}
/*** R
List_of_Distributions()
*/
4. The compilation fails with a message
Error in dyn.load("/var/folders/12/bqytpkx93w97r3s3_h9q9k_00000gn/T//Rtmpm2tVkx/sourcecpp_f9e75ec42b87/sourceCpp_220.so") :
unable to load shared object '/var/folders/12/bqytpkx93w97r3s3_h9q9k_00000gn/T//Rtmpm2tVkx/sourcecpp_f9e75ec42b87/sourceCpp_220.so':
dlopen(/var/folders/12/bqytpkx93w97r3s3_h9q9k_00000gn/T//Rtmpm2tVkx/sourcecpp_f9e75ec42b87/sourceCpp_220.so, 6): Symbol not found: __ZN4Rcpp4wrapINSt3__124uniform_int_distributionIiEEEEP7SEXPRECRKT_
Referenced from: /var/folders/12/bqytpkx93w97r3s3_h9q9k_00000gn/T//Rtmpm2tVkx/sourcecpp_f9e75ec42b87/sourceCpp_220.so
Expected in: flat namespace
in /var/folders/12/bqytpkx93w97r3s3_h9q9k_00000gn/T//Rtmpm2tVkx/sourcecpp_f9e75ec42b87/sourceCpp_220.so
5. I am working on OS X Mavericks and use clang-omp compiler
Can somebody possibly direct me to what I may be doing wrong here. Apologies if the question seems too basic to you.
Thank you in advance.
Anguel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20160426/227171ad/attachment.html>
More information about the Rcpp-devel
mailing list