Re: [Rcpp-devel] dyn.load error with particular functor

2014-10-22 Thread nate russell
Matt and Bill, Thank you both for your input. I was under the impression that std::transform would be calling a new trackIdx(c1,c2) object for each step along the input vectors, and therefore a static data member would be needed to ensure that the count was being accumulated properly (my knowledge

Re: [Rcpp-devel] dyn.load error with particular functor

2014-10-22 Thread William Dunlap
Why don't you make track non-static instead? Bill Dunlap TIBCO Software wdunlap tibco.com On Wed, Oct 22, 2014 at 12:03 PM, nate russell wrote: > Just for the sake of completeness, I noticed that the value of > trackIdx::tracker was persisting (and therefore continuing to be > incremented) betwe

Re: [Rcpp-devel] dyn.load error with particular functor

2014-10-22 Thread nate russell
Just for the sake of completeness, I noticed that the value of trackIdx::tracker was persisting (and therefore continuing to be incremented) between function calls with mc_index, so in addition to your first suggestion, I added a member function to reset the value to zero, and everything seems to b

Re: [Rcpp-devel] dyn.load error with particular functor

2014-10-22 Thread nate russell
Matthew, Thank you for such a quick response; both of those suggestions worked perfectly. Out of curiosity, is there any reason to use one of these implementations over the other - or are they essentially equivalent? Regards, Nathan Russell On Wed, Oct 22, 2014 at 2:10 PM, Matthew Wright wrote:

Re: [Rcpp-devel] dyn.load error with particular functor

2014-10-22 Thread Matthew Wright
Nate, The problem here is how you are have implemented your static member of trackIdx. You only declared it. I'd suggest one of two alternatives: // add this below the struct declaration. int trackIdx::tracker = 0; Or, just create it in the function where you actually use it instead of making

[Rcpp-devel] dyn.load error with particular functor

2014-10-22 Thread nate russell
Hello, I am running into the "Error in dyn.load [...] unable to load shared object ['/tmp/...'] undefined symbol [_...]" error; however it is only happening with one particular Rcpp function, which I find puzzling. Here is my .cpp file containing two functions - I can compile the first one without