Re: [Rcpp-devel] Using cmake to build RInside examples (segfault)

2015-10-06 Thread Gaurav Veda
Hi Dirk, In general, please do not cross post. If you decide this is the better > venue, > maybe delete the post on SO? > Just deleted the post on SO. > | standard directory to /home/thenoob/tmp/RInside/src_cmake. Create a > separate > | build directory /home/thenoob/tmp/RInside/build and run c

Re: [Rcpp-devel] How to Get Pointer of Underlying Object of Rcpp Module Class

2015-10-06 Thread Tianqi Chen
Thanks to Wush Wu. I think I now find the answer to the question by using RCPP_EXPOSED_CLASS_NODECL One note is that I have to use Rcpp::internal::make_new_object to create the S4 object, instead of Rcpp::wrap. Because current wrap do copy-construct from an existing object to a new pointer. While

Re: [Rcpp-devel] How to Get Pointer of Underlying Object of Rcpp Module Class

2015-10-06 Thread Tianqi Chen
Oh, the question is not about supporting native Save/Load from R. I understand the hardness of that due to no customized loader from external pointer. The function listed here aims to write a customized function like ```save.list``` instead of R's native save/load, which is doable. The question is

Re: [Rcpp-devel] How to Get Pointer of Underlying Object of Rcpp Module Class

2015-10-06 Thread Dirk Eddelbuettel
On 6 October 2015 at 14:40, Tianqi Chen wrote: | Dear Rcpp Developers: | | ```c++ | class MyClass { | public: |    static void SaveList(SEXP list, const std::string& filename) { |           Rcpp::List data_lst(list); |           std::vector internals(data_lst[i]); |           for (size_t i = 0; i

Re: [Rcpp-devel] Using cmake to build RInside examples (segfault)

2015-10-06 Thread Dirk Eddelbuettel
On 6 October 2015 at 14:29, Gaurav Veda wrote: | I posted this on stackoverflow as well (http://stackoverflow.com/questions/ | 32979586/using-cmake-to-build-rinside-examples-segfault), but this is perhaps a | better venue. In general, please do not cross post. If you decide this is the better ve

Re: [Rcpp-devel] How to Get Pointer of Underlying Object of Rcpp Module Class

2015-10-06 Thread Tianqi Chen
Sorry about the in-complete message. I sent it earlier but did not get it posted. The question is about how to Get XPtr out from underlying Rcpp S4 object, and how to construct such object from C++ side. Tianqi On Tue, Oct 6, 2015 at 2:40 PM, Tianqi Chen wrote: > Dear Rcpp Developers: > > ```c+

[Rcpp-devel] How to Get Pointer of Underlying Object of Rcpp Module Class

2015-10-06 Thread Tianqi Chen
Dear Rcpp Developers: ```c++ class MyClass { public: static void SaveList(SEXP list, const std::string& filename) { Rcpp::List data_lst(list); std::vector internals(data_lst[i]); for (size_t i = 0; i < data_lst.size(); ++i) { SEXP obj = data_lst[i];

[Rcpp-devel] Using cmake to build RInside examples (segfault)

2015-10-06 Thread Gaurav Veda
Hi, I posted this on stackoverflow as well ( http://stackoverflow.com/questions/32979586/using-cmake-to-build-rinside-examples-segfault), but this is perhaps a better venue. I am trying to use RInside in an existing C++ project that uses cmake (on a linux box). I don't understand cmake that well.