[R] Looking for R_Home ...

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Tue Oct 12 11:34:36 CEST 1999

Thomas Hoffmann <hoffmann at ehmgs2.et.tu-dresden.de> writes:

> This is my first question to this list and possibly a bit dumb, but anyway:
> Can anybody tell me, where, e.g. in the "unix" reference release a DEFINITION of 
> char * R_Home can be found? Via Defn.h the "extern" DECLARATION is everywhere,
> but when I derived a somewhat other main() program my linker complained about the 
> missing definition.

It is done using a sneaky trick also used in other projects: Defn.h
has this little thing inside:

#ifdef __MAIN__
#define extern
#define INI_as(v) = v
#define INI_as(v)

extern int      errno;
extern int      gc_inhibit_torture;

/* R Home Directory */
extern char*    R_Home;             /* Root of the R tree */

/* Memory Management */
extern int      R_NSize         INI_as(R_NSIZE);/* Size of cons cell heap */

#ifdef __MAIN__
#undef extern
#undef INI_as

...which causes the variable to defined *in the module that defines
__MAIN__* and declared everywhere else. It's explained briefly at the
top of src/main/main.c too.

   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
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