[Rcpp-devel] wrapping clone() via Rcpp module

Tama Ma pingnang at phys.ethz.ch
Tue Nov 15 22:17:11 CET 2011


Dear Rcpp developers,

	As I venture on, I find that the wrapping of clone() function couldn't be wrapped. However, the same can be done in boost python. May I know how I could help fixing this bug? The following is the error log:


Error log
====================
g++ -I/opt/local/lib/R/include -I/opt/local/lib/R/include/x86_64 -I/opt/local/share/R-packages/Rcpp-0.9.7/inst/include -dynamiclib -o ./dummy.so ./dummy.C -L/opt/local/lib/R/lib/x86_64 -lR -lRblas -lRlapack -L/opt/local/share/R-packages/Rcpp-0.9.7/inst/lib/x86_64 -lRcpp
In file included from /opt/local/share/R-packages/Rcpp-0.9.7/inst/include/RcppCommon.h:313,
                 from /opt/local/share/R-packages/Rcpp-0.9.7/inst/include/Rcpp.h:27,
                 from ./dummy.C:1:
/opt/local/share/R-packages/Rcpp-0.9.7/inst/include/Rcpp/internal/wrap.h: In function 'SEXPREC* Rcpp::internal::wrap_dispatch_unknown_iterable(const T&, Rcpp::traits::false_type) [with T = dummy]':
/opt/local/share/R-packages/Rcpp-0.9.7/inst/include/Rcpp/internal/wrap.h:638:   instantiated from 'SEXPREC* Rcpp::internal::wrap_dispatch_unknown(const T&, Rcpp::traits::false_type) [with T = dummy]'
/opt/local/share/R-packages/Rcpp-0.9.7/inst/include/Rcpp/internal/wrap.h:654:   instantiated from 'SEXPREC* Rcpp::internal::wrap_dispatch_eigen(const T&, Rcpp::traits::false_type) [with T = dummy]'
/opt/local/share/R-packages/Rcpp-0.9.7/inst/include/Rcpp/internal/wrap.h:669:   instantiated from 'SEXPREC* Rcpp::internal::wrap_dispatch_unknown_importable(const T&, Rcpp::traits::false_type) [with T = dummy]'
/opt/local/share/R-packages/Rcpp-0.9.7/inst/include/Rcpp/internal/wrap.h:687:   instantiated from 'SEXPREC* Rcpp::internal::wrap_dispatch(const T&, Rcpp::traits::wrap_type_unknown_tag) [with T = dummy]'
/opt/local/share/R-packages/Rcpp-0.9.7/inst/include/Rcpp/internal/wrap.h:791:   instantiated from 'SEXPREC* Rcpp::wrap(const T&) [with T = dummy]'
/opt/local/share/R-packages/Rcpp-0.9.7/inst/include/Rcpp/module/Module_generated_CppMethod.h:88:   instantiated from 'SEXPREC* Rcpp::const_CppMethod0<Class, OUT>::operator()(Class*, SEXPREC**) [with Class = dummy, OUT = dummy]'
./dummy.C:14:   instantiated from here
/opt/local/share/R-packages/Rcpp-0.9.7/inst/include/Rcpp/internal/wrap.h:433: error: cannot convert 'const dummy' to 'SEXPREC*' in initialization
make: *** [dummy.so] Error 1
dhcp-192-033-102-240:Rcpp_clone tamama$ 


<dummy.hpp>
===================
#include <iostream>

class dummy
{
public:
  ~dummy() {}
  dummy()  {}
  dummy(double a_)          : _a(a_)       {}
  dummy(const dummy& obj_)  : _a(obj_._a)  {}

  dummy clone() const  { return dummy(*this); }

  double a()  const  { return _a; }

private:
  double _a;
};


<dummy.C>
======================
#include <Rcpp.h>
#include "dummy.hpp"


RCPP_MODULE(tamama)
{
  Rcpp::class_<dummy>("dummy")
    .default_constructor()
    .constructor<double>()

    .method( "clone" , &dummy::clone  )
    .method( "a"     , &dummy::a      )
    ;
}

















Best regards,
Tama Ma 
(+41 78 640 50 15)

pingnang at phys.ethz.ch
www.phys.ethz.ch/~pingnang

HIT K 31.3
Institut für Theoretische Physik
Wolfgang-Pauli-Strasse 27
ETH Hönggerberg
8093 Zürich
Switzerland



More information about the Rcpp-devel mailing list