From rosterma at abo.fi  Sat Feb 26 20:45:36 2005
From: rosterma at abo.fi (=?ISO-8859-1?Q?Ralf_=D6stermark?=)
Date: Sat Feb 26 20:47:04 2005
Subject: [Rd] calling an R-function from C
Message-ID: <4220D1E0.2020800@abo.fi>

Hi,

I would like to invoke an R-function from a program written in ANSI C. 
Assume that I have written an R script "myRexample" and I want to invoke 
it from C. I assume that my R script loads its data from a datafile so 
no arguments need to be passed between my C program and R. Following 
R-exts.pdf  (section 4.7), I write the following main:

#include "my.h"                            /* includes all standard 
h-files */
#include <R.h>                            /* according to R-exts.pdf */
#include <Rinternals.h>
SEXP myRexample();
int main(int argc,char **argv) {
.External("myRexample");             /* invoking my R script */
exit(0);
}  /* end of main() */

Is this a correct interpretation, given that R is properly installed in 
the (unix) main frame?
I'm grateful for any advice on how to proceed.
regards
Ralf ?stermark


[Rd] calling an R-function from C
=?ISO-8859-1?Q?Ralf_=D6stermark?=