[R] Help with interfacing C & R

Aimin Yan aiminy at iastate.edu
Fri Feb 9 06:15:28 CET 2007


in linux machine

it should be

 > source("hello2.r")
 > dyn.load("hello.so")
 > hello2(4)
My first try for C-R interface
My first try for C-R interface
My first try for C-R interface
My first try for C-R interface
[[1]]
[1] 4


>On 2/8/07, Oleg Sklyar <osklyar at ebi.ac.uk> wrote:
> >
> > On Windows you need:
> >   - download and install Cygwin (cygwin.com) with default options,
> >     supposedly you install into c:\cygwin. Add path to
> >     c:\cygwin\bin;c:\cygwin\lib to your system PATH
>
>
>No. You don't need Cygwin. I don't have it and I can compile Tim's code
>without any problem.
>Please see bottom of my message for which I used Tim's code without any
>modification.
>
>My assumption is rather that the path is not set correctly so he can call R
>from the command line.
>Maybe you could check, Tim, if you can start Rterm.exe or Rgui.exe from the
>command line.
>If not, this should be the first thing to fix.
>
>
>
>
>For help files:
> >   - get MS hhc, comes as part of htmlhelp.exe from here:
> >
> > 
> http://www.microsoft.com/downloads/details.aspx?FamilyID=00535334-c8a6-452f-9aa0-d597d16580cc&DisplayLang=en
> >     this is Microsoft HTML Help Compiler, add path to it to your PATH
> >   - you might want to consider MikTex, dowload, install, add to path if
> >     you have a package and a help system a should be built
>
>Yes, as you write for the help files. But I think it is not necessary if
>someone wants to make his/her first steps to interface to C from R.
>
>
>Best,
>Roland
>
>P.S.
>Here is the transcript of my shell session in emacs using Tim's code:
>
>Microsoft Windows XP [Version 5.1.2600]
>(C) Copyright 1985-2001 Microsoft Corp.
>
>c:\deletefolder\Rsandbox>R CMD SHLIB hello.c
>R CMD SHLIB hello.c
>making hello.d from hello.c
>gcc   -IC:/rolandprogs/R-2.3.1/include -Wall -O2   -c hello.c -o hello.o
>gcc  -shared -s  -o hello.dll hello.def hello.o  -LC:/rolandprogs/R-2.3.1/bin
>-lR
>
>c:\deletefolder\Rsandbox>Rterm --no-save
>Rterm --no-save
>
>R : Copyright 2006, The R Foundation for Statistical Computing
>Version 2.3.1 (2006-06-01)
>ISBN 3-900051-07-0
>
>R is free software and comes with ABSOLUTELY NO WARRANTY.
>You are welcome to redistribute it under certain conditions.
>Type 'license()' or 'licence()' for distribution details.
>
>R is a collaborative project with many contributors.
>Type 'contributors()' for more information and
>'citation()' on how to cite R or R packages in publications.
>
>Type 'demo()' for some demos, 'help()' for on-line help, or
>'help.start()' for an HTML browser interface to help.
>Type 'q()' to quit R.
>
> > source("hello2.r")
>source("hello2.r")
> > dyn.load("hello")
>dyn.load("hello")
> > hello2(3)
>hello2(3)
>Hello, world!
>Hello, world!
>Hello, world!
>[[1]]
>[1] 3
>
> >
>
>         [[alternative HTML version deleted]]
>
>______________________________________________
>R-help at stat.math.ethz.ch 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