From simon.urbanek at r-project.org  Wed Apr  1 16:03:53 2009
From: simon.urbanek at r-project.org (Simon Urbanek)
Date: Wed, 1 Apr 2009 10:03:53 -0400
Subject: [Rd] R in standalone application
In-Reply-To: <49D2D660.8040708@hotmail.com>
References: <49D2D660.8040708@hotmail.com>
Message-ID: <CE5A6A4C-63D7-4A6E-85BF-F481C42D3D78@r-project.org>

Eric,

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).

Cheers,
Simon


> 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
>
>



[Rd] R in standalone application
Simon Urbanek