Re: [Rcpp-devel] Wrapping a c++ class with singleton using RCPP Module

2024-02-21 Thread Nikhil Garg
Hi, Thanks, Inaki, Dirk, and Matthew for the replies to my query. Thank you Matthew for your code samples, they were very helpful in finding my way through the problem. I am trying to wrap some code from a library, though the code base is rather large so I didn't want to paste that into the

Re: [Rcpp-devel] Wrapping a c++ class with singleton using RCPP Module

2024-02-21 Thread Matthew Supernaw - NOAA Federal
Hi Nikhil, Here's an updated version that exposes a FooWrapper class in the module to the previous posted code. Hopefully this helps! class FooWrapper{ public: Foo* foo_m; FooWrapper(){} FooWrapper(const FooWrapper& other):foo_m(other.foo_m){ } FooWrapper(Foo* foo):foo_m(foo){ }

Re: [Rcpp-devel] Wrapping a c++ class with singleton using RCPP Module

2024-02-21 Thread Matthew Supernaw - NOAA Federal
Looks like I posted too soon. I just noticed the memory address from the "SayHello" function doesn't match. On Wed, Feb 21, 2024 at 10:47 AM Matthew Supernaw - NOAA Federal < matthew.super...@noaa.gov> wrote: > Hi Nikhil, > I'm not exactly sure what you are trying to do, but I hope this simple >

Re: [Rcpp-devel] Wrapping a c++ class with singleton using RCPP Module

2024-02-21 Thread Matthew Supernaw - NOAA Federal
Hi Nikhil, I'm not exactly sure what you are trying to do, but I hope this simple example is helpful. Thanks. Matthew #include using namespace Rcpp; class Foo{ public: static Foo* singleton; Foo(){ } void SayHello(){ Rcpp::Rcout << "From \"void SayHello()\" -> "< ";

Re: [Rcpp-devel] Wrapping a c++ class with singleton using RCPP Module

2024-02-21 Thread Dirk Eddelbuettel
On 21 February 2024 at 09:21, Iñaki Ucar wrote: | Could you please provide more details about what you tried so far and what are | the issues you found? A link to a public repo with a test case would be even | better. Seconded! I think I also did something like that 'way early' and 'way

Re: [Rcpp-devel] Wrapping a c++ class with singleton using RCPP Module

2024-02-21 Thread Iñaki Ucar
Could you please provide more details about what you tried so far and what are the issues you found? A link to a public repo with a test case would be even better. Iñaki El mié., 21 feb. 2024 7:34, Nikhil Garg escribió: > Hi, > > I am looking for some advice or hoping someone can point me in