On Sat, Jun 6, 2009 at 5:31 PM, Dirk Eddelbuettel <e...@debian.org> wrote:

>
> Try reading 'R Extensions' section 8.1 entitled 'Embedding R under
> Unix-alikes'.



That was just what I needed!  All it took was adding a single line before
the call to mkString (and adding one more header file):

#include <Rinternals.h>
#include <Rembedded.h>

SEXP hello() {
  return mkString("Hello, world!\n");
}

int main(int argc, char **argv) {
  SEXP x;
  Rf_initEmbeddedR(argc, argv);
  x = hello();
  return x == NULL;             /* i.e. 0 on success */
}

When I run the executable with

% myR/bin/R CMD hello_r -q --vanilla

...it goes without a hitch.

Many thanks!

kynn

        [[alternative HTML version deleted]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to