Re: [R] Calling C code from R...wrapping C structures

2008-05-14 Thread Nathan Harmston
Hi, My function test is properly declared in the header file of the code: void test(Model *); and we just discovered yesterday we should be using .Call instead ,of .C. However we still can't get it to work. We arent trying to pass a primitive type from R but a complex one. We are trying to inter

Re: [R] Calling C code from R...wrapping C structures

2008-05-14 Thread Ramon Diaz-Uriarte
Dear Nathan, How is you C function "test" defined? What type of argument is it expecting? The mappings between R and C type of arguments you can pass is explained in: http://cran.r-project.org/doc/manuals/R-exts.html#Interface-functions-_002eC-and-_002eFortran which also provides some examples.

Re: [R] Calling C code from R...wrapping C structures

2008-05-13 Thread Duncan Murdoch
On 5/13/2008 7:51 AM, Nathan Harmston wrote: Hi everyone, I am currently trying to call some C code from R, specifically calling a function which populates a C struct. typedef struct{ // contents } Model; void test(Model *m){ // fill the struct with crap } I compile the C code into a sh

[R] Calling C code from R...wrapping C structures

2008-05-13 Thread Nathan Harmston
Hi everyone, I am currently trying to call some C code from R, specifically calling a function which populates a C struct. typedef struct{ // contents } Model; void test(Model *m){ // fill the struct with crap } I compile the C code into a shared library, which loads into R properly. My s