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, or set
  appropriate environmental variables.

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

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.)
Note that in this version console input blocks the process so pager
and graphics windows will not respond during input: a real application
that uses these windows needs to have a non-blocking ReadConsole
function.  Rterm uses a separate thread to achieve this.


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

The example shows one way to handle user interrupts, although it might
be as easy to generate a SIGINT directly from a GUI front end.  For
this to be useful you will want to set R_Interactive to be true, and
you will need to use SETJMP to jump back to somewhere useful in your
code.

You will not (easily) be able to use Borland C++, as that uses leading
underscores in its library functions, and R.dll is built without.



A R proxy DLL
=============

Files bdx* and rproxy* are used to build a proxy DLL (by Thomas Baier) for
use with his automation server StatConnectorSrv.exe.

The interface can evaluate commands and transfer simple R objects (e.g.
vectors and matrices).

Look on CRAN under Software->Other->Non-standard packages for the
automation server.
