Re: [R] Problem with .C

2011-10-06 Thread Jan van der Laan
Quoting Uwe Ligges : I don't agree that it's overkill -- you get to sidestep the whole `R CMD SHLIB ...` and `dyn.load` dance this way while you experiment with C(++) code 'live" using the inline package. You need two additional packages now where you have to rely on the fact those are avai

Re: [R] Problem with .C

2011-10-06 Thread Uwe Ligges
On 06.10.2011 15:41, Steve Lianoglou wrote: Hi, 2011/10/6 Uwe Ligges: On 06.10.2011 14:51, Jan van der Laan wrote: An obvious reason might be that your second argument should be a pointer to int. As others have mentioned, you might want to have a look at Rccp and/or inline. The documentati

Re: [R] Problem with .C

2011-10-06 Thread Steve Lianoglou
Hi, 2011/10/6 Uwe Ligges : > On 06.10.2011 14:51, Jan van der Laan wrote: >> >> An obvious reason might be that your second argument should be a pointer >> to int. >> >> As others have mentioned, you might want to have a look at Rccp and/or >> inline. The documentation is good and I find it much e

Re: [R] Problem with .C

2011-10-06 Thread Uwe Ligges
On 06.10.2011 14:51, Jan van der Laan wrote: An obvious reason might be that your second argument should be a pointer to int. As others have mentioned, you might want to have a look at Rccp and/or inline. The documentation is good and I find it much easier to work with. For example, your exampl

Re: [R] Problem with .C

2011-10-06 Thread Jan van der Laan
An obvious reason might be that your second argument should be a pointer to int. As others have mentioned, you might want to have a look at Rccp and/or inline. The documentation is good and I find it much easier to work with. For example, your example could be written as: library(Rcpp) l

Re: [R] Problem with .C

2011-10-06 Thread Grigory Alexandrovich
Hello, first thank you for your answers. I did not read the whole pdf Writing R Extension, but I read this strongly shortened introduction to this subject: http://www.math.kit.edu/stoch/~lindner/media/.c.call%20extensions.pdf I get the same error with this C-function: void test(double * b,

Re: [R] Problem with .C

2011-10-04 Thread Steve Lianoglou
Hi, As other have said, it's very difficult to help you without an example + code to know what you are talking about. That having been said, it seems as if you are just getting your feet wet in this R <--> C bridge, and I'd recommend you checkout the "Rcpp" and "inline" package to help make your

Re: [R] Problem with .C

2011-10-04 Thread Rolf Turner
On 05/10/11 01:04, Grigory Alexandrovich wrote: Hello, I wrote a function in C, which works fine if called from the main-function in C. But as soon as I try to call this function from R like .C('foo', as.double(x), as.integer(y)), the programm crashes. I created a dll with the cmd command

Re: [R] Problem with .C

2011-10-04 Thread Jeff Newmiller
This looks like a classic case of not reading the manual, and then compounding it by not reading the posting guide. The manual would be the "Writing R Extensions" pdf that comes with R or you can google it. The posting guide is referenced at the bottom of this and every other posting on this mai

Re: [R] Problem with .C

2011-10-04 Thread Uwe Ligges
Without knowing that C code, we cannot know. Have you read Writing R Extensions carefully? I.e. take care with memory allocation and printing as mentioned in the manual. Uwe Ligges On 04.10.2011 14:04, Grigory Alexandrovich wrote: Hello, I wrote a function in C, which works fine if called f

[R] Problem with .C

2011-10-04 Thread Grigory Alexandrovich
Hello, I wrote a function in C, which works fine if called from the main-function in C. But as soon as I try to call this function from R like .C('foo', as.double(x), as.integer(y)), the programm crashes. I created a dll with the cmd command R --arch x64 CMD SHLIB foo.c and loaded it into

Re: [R] Problem with .C()

2008-05-28 Thread Rolf Turner
Sorry for the noise. ***After*** sending off my previous post, I spotted the loony myself. The line for(k=0; kThat's m for Mike not n for November. Sigh. Staring me in the face all the time. Again, apologies for the noise. cheers, Rolf #

[R] Problem with .C()

2008-05-28 Thread Rolf Turner
I've been trying to get my head around using matrices in calls to .C(). As an exercise I wrote some code to calculate the product of two matrices. (Well, it makes it easy to check if one is getting the right answer!) After obtaining some advice from a Certain Very Wise Person at Oxford, (to f