[R] Help with interfacing C & R

Oleg Sklyar osklyar at ebi.ac.uk
Fri Feb 9 01:48:16 CET 2007


Glad it worked for you. Unfortunately I will not help you with dyn.load, 
I do not use it and am not well familiar with the technicalities about 
its use. Why?.. please read the pdf file I mentioned in my first post 
and you will see why. Anyway as it compiles now it might probably be the 
best time time to read it to prevent further questions that could be 
prevented. It does not cover Windows, but the part it does not cover you 
have just mastered :) Again here is the address:

http://www.ebi.ac.uk/~osklyar/kb/CtoRinterfacingPrimer.pdf

Best,
Oleg

--
Dr Oleg Sklyar | EBI-EMBL, Cambridge CB10 1SD, UK | +44-1223-494466


Tim Smith wrote:
> Hi Oleg,
> 
> Thanks !! I did as you said, and it works from the Rterm window now.
> 
> My only other question is, that now I have the C code compiled, how do I 
> make 'hello2.r' run from the RGui? I tried to execute the r code from 
> this after I was able to run the code in the Rterm and got the following 
> errors:
> 
>  > source("tryc/hello2.r")
> Error in .C("hello", as.integer(n)) : C symbol name "hello" not in load 
> table
> 
> I also tried with putting 'dyn.load("hello")' at the begining of the r 
> code block, but got the following error:
> 
> ---------------------------------------------------------------------------------------
> Error in dyn.load(x, as.logical(local), as.logical(now)) :
>         unable to load shared library 'E:/My 
> Documents/work/projects/landmarks/hello':
>   LoadLibrary failure:  The specified module could not be found.
> ---------------------------------------------------------------------------------------
> 
> 
> Thanks again for all your help. I guess I'll try to figure out the RGui 
> error tomorrow.
> 
> 
> take care,
> 
> Tim
> 
> 
> */Oleg Sklyar <osklyar at ebi.ac.uk>/* wrote:
> 
>      > E:\My Documents\work\projects\landmarks\tryc>ls
>      > hello.c hello2.r
> 
>     It is always advisable not to have spaces in such directories (like the
>     ones you want to include into a system variable), but fine.
> 
>      > E:\My Documents\work\projects\landmarks\tryc>R CMD SHLIB hello.c
>      > 'R' is not recognized as an internal or external command,
>      > operable program or batch file.
> 
>     Your R is not in the PATH! You need to add it, see also below!
> 
>      > E:\My Documents\work\projects\landmarks\tryc>echo %PATH%
>      >
>     C:\texmf\miktex\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\P
>      > rogram Files\ATI Technologies\ATI Control
>      > Panel;E:\PROGRA~1\F-Secure\Ssh;E:\Prog
>      > ram Files\ESTsoft\ALZip\;C:\Program
>      > Files\QuickTime\QTSystem\;E:\prg_files\tools
>      >
>     \bin;E:\prg_files\cygwin\bin;E:\prg_files\cygwin\lib;E:\prg_files\ActivePerl\Act
>      >
>     ivePerl\Perl\bin;E:\prg_files\ActivePerl\ActivePerl\Perl\lib;E:\Program
>      > Files\ES
>      > Tsoft\ALZip\
> 
>     There are at least 2 mistakes that I see in your PATH above:
>     - you need to add: E:\prg_files\R\R-2.4.1\bin;
>     - you need to add path to wherever MinGW\bin is and add it before
>     cygwin! if you do not have MinGW installed, download and install it.
> 
>     I guess E:\prg_files\tools\bin are RTools, if so, this is fine. Your
>     own
>     program must not necessarily be in the PATH
> 
>     --
>     Dr Oleg Sklyar | EBI-EMBL, Cambridge CB10 1SD, UK | +44-1223-494466
> 
> 
> ------------------------------------------------------------------------
> Be a PS3 game guru.
> Get your game face on with the latest PS3 news and previews at Yahoo! 
> Games. <http://us.rd.yahoo.com/evt=49936/*http://videogames.yahoo.com>



More information about the R-help mailing list