The R Project SVN R

Rev

Rev 5178 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

Linking the R DLL into other applications
=========================================

The file rtest.c provides an example of linking the R engine into
another front end. To build it

- edit it to set Rp->rhome and Rp->home appropriately.

- to make with gcc,  make -f make.rtest

- to make with VC++,

    copy ..\R.exp and ..\R.dll to this directory
    lib /def:R.exp
    cl /MT /Ox /D "WIN32"  /I..\..\include /I.. rtest.c R.lib

This provides an rterm-like test front end. The main loop is in the
main program here: R_ReplDLLdo1() parses one line (up to ; or \n) and
returns 1 if complete, 2 if incomplete as an R expression.

There is a callback available during evaluation, plotting and console I/O,
intended to be used for processing GUI events. (The pager and graphics
windows' GUI events are handled at these times by ProcessEvents: the
callback is called from within ProcessEvents.)

An alternative to linking the import library would be to explicitly
load the DLL from a known location or after searching for it.