[Rcpp-devel] getting the external pointer from a module created reference class

Ian Fellows ian.fellows at stat.ucla.edu
Mon Jun 27 22:30:29 CEST 2011


Okay, so at the risk of asking another stupid question...


I'm a bit unclear about how to write the R constructor for a class being exported via the module facility.


class Foo{
	public:
		int i;
		Foo();
		Foo(SEXP);
}



int test(Foo f){
	return f.i;
}

RCPP_MODULE(amodule){
	using namespace Rcpp ;
	function("test",&test);
	class<Foo>("Foo");
}


I assume that I need to write Foo(SEXP) in such a way that the external pointer is extracted, and then 'i' is copied over. How does one do this?


Thanks for the help,
Ian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20110627/93ed818c/attachment.htm>


More information about the Rcpp-devel mailing list