[R] C-Code in R (running Windows)

2006-03-01 Thread K.A.
Hello, I need to include C (or C++)-Code in R. I'm searching for a tutorial, how to do this. It is only a very small algorith (one function). Using google, I read somethig about including dll-Files and so on (on windows). Is there no possibility to include a C-File directly?!? -- View this

Re: [R] C-Code in R (running Windows)

2006-03-01 Thread Tuszynski, Jaroslaw W.
-Code in R (running Windows) Hello, I need to include C (or C++)-Code in R. I'm searching for a tutorial, how to do this. It is only a very small algorith (one function). Using google, I read somethig about including dll-Files and so on (on windows). Is there no possibility to include a C-File

Re: [R] C-Code in R (running Windows)

2006-03-01 Thread Liaw, Andy
The simplest interface is to use .C() in R to call the C function. The details (with examples) are in the Writing R Extensions manual that comes with every version of R. To compile and load the .dll/.so into R, do: - Type R CMD SHLIB file1.c file2.c (at the command prompt, not the R prompt)

Re: [R] C-Code in R (running Windows)

2006-03-01 Thread K.A.
I got it!!! As Andy said, I generated an dll-File (using Dev-C++, it was quite easy) and imported some R-header. This could be opened in R with dyn.load(dll-file) und executed with .C()!! Thanks for your help!! PS: I've taken the Files of my (Dev C++ -)project behind: dllmain.c: #include