[Rcpp-devel] Request for help with compiling Rcpp example

2011-10-12 Thread Slava Razbash
I am trying to compile the example program with "inline" from the jstatsoft article by Eddelbuettel and Francois (2011). I am using WinXP and R 2.13.2 and RCPP 0.9.7. I am using Rtools 2.14. My code: src <- ' Rcpp::NumericVector xa(a); Rcpp::NumericVector xb(b); int n_xa = xa.size(), n_xb =

Re: [Rcpp-devel] Success with integrating external C++ Code

2011-10-12 Thread Simon Fuller
Hello David, Yes, Whit's example is great. >From my own short experience, I would advise to stick to Whit's example closely. For instance, try not to separate a class between e.g. .h and .cpp, as inline seems to sometimes throw in an extra include for the user class, but without the right path. (

Re: [Rcpp-devel] Question regarding integrating preexisting C++ code via Rcpp

2011-10-12 Thread Simon Fuller
Hello again, "And had you posted reproducible examples we could have told you that days ago." That it is true. But I think I learned more about Rcpp this way. Also, I definitely learned more about how inline works than had I followed more instructions. Moreover, having seen the sheer amount of st

Re: [Rcpp-devel] Success with integrating external C++ Code

2011-10-12 Thread Silkworth,David J.
Thanks Whit, Actually, it had been my fault not to notice your elegant use of inline. But this is good. It helps to prototype inline, before converting to package. The debug and edit cycle is much faster using inline. Dave -Original Message- From: Whit Armstrong [mailto:armstrong.w...@g

Re: [Rcpp-devel] Success with integrating external C++ Code

2011-10-12 Thread Whit Armstrong
if you want it to be inline, then simply copy the contents of the .hpp and .cpp files into your R script and quote them. what the getModel function does is simply read the file into a string. I do it this way because emacs knows how to properly indent the file if I keep it separate (rather than a

Re: [Rcpp-devel] Success with integrating external C++ Code

2011-10-12 Thread Steve Lianoglou
Hi, On Wed, Oct 12, 2011 at 11:50 AM, Silkworth,David J. wrote: > I see, but this is not truly an inline example is it? Sorry -- I'm not sure what it is you're after, then. The run.cppbugs.r file sure looks like it's using inline to me ... and in a "complex fashion" at that, since you have sour

Re: [Rcpp-devel] Success with integrating external C++ Code

2011-10-12 Thread Silkworth,David J.
I see, but this is not truly an inline example is it? https://github.com/armstrtw/CppBugs/tree/master/test/r.inline.example Does that elucidate the things that need elucidating for you? -steve -- Steve Lianoglou Graduate Student: Computational Systems Biology  | Memorial Sloan-Kettering Cance

Re: [Rcpp-devel] Success with integrating external C++ Code

2011-10-12 Thread Dirk Eddelbuettel
On 12 October 2011 at 11:00, Silkworth,David J. wrote: | I have been observing Simon Fuller?s exploration here with interest, but not so | fully that I could replicate what he is now capable of doing. I wonder if | someone could build a small test case that would show how this works, since I | t

Re: [Rcpp-devel] Success with integrating external C++ Code

2011-10-12 Thread Steve Lianoglou
Hi, On Wed, Oct 12, 2011 at 11:00 AM, Silkworth,David J. wrote: > I have been observing Simon Fuller’s exploration here with interest, but not > so fully that I could replicate what he is now capable of doing.  I wonder > if someone could build a small test case that would show how this works, >

[Rcpp-devel] Success with integrating external C++ Code

2011-10-12 Thread Silkworth,David J.
I have been observing Simon Fuller's exploration here with interest, but not so fully that I could replicate what he is now capable of doing. I wonder if someone could build a small test case that would show how this works, since I think this would be of interest to many. _

Re: [Rcpp-devel] Question regarding integrating preexisting C++ code via Rcpp

2011-10-12 Thread Dirk Eddelbuettel
On 12 October 2011 at 14:51, Simon Fuller wrote: | Hello, | | We cross-posted. Yes, you're right. I misunderstood the use of includes - And had you posted reproducible examples we could have told you that days ago. Have a look at the recent post by Whit Armstrong about his updated CppBugs examp

Re: [Rcpp-devel] Question regarding integrating preexisting C++ code via Rcpp

2011-10-12 Thread Simon Fuller
Hello, We cross-posted. Yes, you're right. I misunderstood the use of includes - global - that is a good way of thinking about it. Thanks for everything. Simon On Wed, Oct 12, 2011 at 2:06 PM, Darren Cook wrote: > > pertain to packages. So I will post the relevant code here, and the full > >

Re: [Rcpp-devel] Question regarding integrating preexisting C++ code via Rcpp

2011-10-12 Thread Darren Cook
> pertain to packages. So I will post the relevant code here, and the full > output from verbose=TRUE below it: I think the verbose output was missing from your email (?). > linktest<-cxxfunction( signature( vec = "numeric", len = "integer" ), paste( > readLines( > "/home/simon/College/PackageOne

Re: [Rcpp-devel] Question regarding integrating preexisting C++ code via Rcpp

2011-10-12 Thread Simon Fuller
Hello again, I think I figured it out. I was messing up user includes by not using readLines. I then had the further epiphany that I could just c() include the cpp file as well there, because it is really just copying and pasting the text, so it can copy and paste any text you throw at it. Great

Re: [Rcpp-devel] Question regarding integrating preexisting C++ code via Rcpp

2011-10-12 Thread Simon Fuller
Hello Darren, Thank you for your advice. It makes good sense. I now have a linker problem, and I have written some code to abstract the problem for your viewing. The error message is: "Error in dyn.load(libLFile) : unable to load shared object '/tmp/RtmpBFr1mw/file44b636b6.so': /tmp/RtmpBFr1