[R] Problem with .C

Uwe Ligges ligges at statistik.tu-dortmund.de
Tue Oct 4 18:25:54 CEST 2011


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 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 R with dyn.load().
>
> What can be the cause of such behaviour?
> Again, the C-funcion itself works, but not if called from R.
>
> Thanks
> Grigory Alexandrovich
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list