Re: [Rd] Issue with c++ .C call

2006-01-11 Thread Sean Davis
On 1/10/06 6:50 PM, "Thomas Lumley" <[EMAIL PROTECTED]> wrote: > On Tue, 10 Jan 2006, Sean Davis wrote: > >> >> Thanks, Thomas. That did fix the initialization issue (or apparent one). >> Unfortunately, the reason that I started debugging was for segmentation >> faults, which have not gone a

Re: [Rd] Issue with c++ .C call

2006-01-10 Thread Thomas Lumley
On Tue, 10 Jan 2006, Sean Davis wrote: > > Thanks, Thomas. That did fix the initialization issue (or apparent one). > Unfortunately, the reason that I started debugging was for segmentation > faults, which have not gone away. However, it now looks like the problem is > internal to the C++ code a

Re: [Rd] Issue with c++ .C call

2006-01-10 Thread Sean Davis
On 1/10/06 2:27 PM, "Thomas Lumley" <[EMAIL PROTECTED]> wrote: > On Tue, 10 Jan 2006, Sean Davis wrote: >> and such. However, the call to the function is via .C; parameters from the >> .C call are not being passed correctly to the function. As an example, I >> have attached a GDB run of the c

Re: [Rd] Issue with c++ .C call

2006-01-10 Thread Thomas Lumley
On Tue, 10 Jan 2006, Sean Davis wrote: > and such. However, the call to the function is via .C; parameters from the > .C call are not being passed correctly to the function. As an example, I > have attached a GDB run of the code. I set a breakpoint on entry to the > function I am calling from R.

Re: [Rd] Issue with c++ .C call

2006-01-10 Thread Sean Davis
On 1/10/06 1:41 PM, "Dominick Samperi" <[EMAIL PROTECTED]> wrote: > Sean, > > prm in your function calcStepgram is NOT a vector of doubles, it is of type > SEXP, and you need to use R macros to fetch the value(s). This is done > automatically in the Rcpp package, and if you want to see how thi

Re: [Rd] Issue with c++ .C call

2006-01-10 Thread Thomas Lumley
On Tue, 10 Jan 2006, Dominick Samperi wrote: > Sean, > > prm in your function calcStepgram is NOT a vector of doubles, it is of type > SEXP, and you need to use R macros to fetch the value(s). This is done > automatically in the Rcpp package, and if you want to see how this is > done look at the d

Re: [Rd] Issue with c++ .C call

2006-01-10 Thread Sean Davis
On 1/10/06 1:33 PM, "Prof Brian Ripley" <[EMAIL PROTECTED]> wrote: > Looks like a type mismatch in the call: you have not shown us the C++ > code. extern "C" void calcStepgram(double *data, double *prm, double *intervals, int *max, int *n,double *plot) { } > On Tue, 10 Jan 2006, Sean

Re: [Rd] Issue with c++ .C call

2006-01-10 Thread Dominick Samperi
Sean, prm in your function calcStepgram is NOT a vector of doubles, it is of type SEXP, and you need to use R macros to fetch the value(s). This is done automatically in the Rcpp package, and if you want to see how this is done look at the definition of the class RcppVector in Rcpp.cpp Dominick

[Rd] Issue with c++ .C call

2006-01-10 Thread Sean Davis
I am still having some difficulties with connecting R to a C++ function. I am able to call the function as expected after compiling the shared library and such. However, the call to the function is via .C; parameters from the .C call are not being passed correctly to the function. As an example,