[R] Problems embedding R in a C application

Prof Brian D Ripley ripley at stats.ox.ac.uk
Thu Apr 18 08:42:31 CEST 2002


On Wed, 17 Apr 2002, Neil Osborne wrote:

> I've encountered two serious issues that have stopped me in my tracks, and I
> would be most grateful to anyone who can provide some answers.
>
> I am using the examples provided on the page "Testing the Embeddable R
> Library". I am writing a C application, that I want to embedd R into (I'm
> not interested in embedding my application in R, that's not an option). I'm
> developing on a Win2K box. The two problems I've hit (so far!) are these:

But embedding R in that sense is not supported on Windows, AFAIK.  What is
supported is the DCOM interface on CRAN.

> Macro definition (R is using a macro already defined in one of the core
> windows libraries)
> Unresolved external - missing definition for func Rf_initEmbeddedR which is
> prototyped as an extern in EmbeddedRCall.c
>
>
> Here are the issues again (in more detail)
> ===========================================================
>
> 1. Macro re-definition
>
> In file ..\include\R_ext\RS.h
>
> the line (37):
>
> #define ERROR			),error(R_problem_buf);}
>
>
> causes this problem :
>
> warning C4005: 'ERROR' : macro redefinition
>         d:\visualstudio\vc98\include\wingdi.h(93) : see previous definition
> of 'ERROR'

Easy!  Just #undef ERROR after the include.  Or use a more selective set of
headers.

> 2. Unresolved external:
>
> unresolved external symbol _Rf_initEmbeddedR
>
> This function is not defined anywhere. Does anyone know how I can init a
> "session" of R in "embedded" mode (i.e. no direct writing to the console
> etc) ?

It *is* defined in src/unix/system.c: note *unix*.

Answer to Q: use the DCOM interface.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list