[Rd] R in standalone application

Simon Urbanek simon.urbanek at r-project.org
Wed Apr 1 16:03:53 CEST 2009


On Mar 31, 2009, at 10:50 PM, Eric wrote:

> I am trying to build a C application where I need to compute some  
> statistics to take decisions about the direction to give to a user,  
> knowing his/her habits. Because I used R back at school, I thought I  
> can use some of his functions in my application,  as a shared  
> library. I reviewed the "Rinternals" and "R extensions"  documents,  
> and decided to give a try to the REmbedded.c file. Compilation and  
> linking went well. But the execution failed with a "Fatal error: R  
> home directory is not defined". Does it mean that R has to to be  
> distributed with my application or, did I miss something in my  
> readings ?

Yes - you didn't read the 8.1 section of R-ext attentively enough. It  
tells you that you need to setup the environment properly and the  
easiest way to do that on unix is to run
R CMD yourApp

Clearly, R must be installed in order to use your application, since  
your application is using R ;). It is common for the embedding  
application to determine the correct settings before starting R (see  
the R.app GUI on how to setup the environment on a Mac in a GUI  
application [you can still use R CMD though], see for example Rserve  
on how to find the R settings from the registry on Windows).


> If that is of any importance, I am working on unix but aim for full  
> portability (i.e Windows too)
> Thanks for any assistance.
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

More information about the R-devel mailing list