Rev 35751 | 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 intoanother front end. To build it- edit it to set Rp->rhome and Rp->home appropriately, or setappropriate environmental variables.- to make with gcc, make -f make.rtest- to make with VC++,copy ..\R.dll and ..\..\..\Rblas.dll to this directorylib /def:..\R.exp /machine:ix86 /out:Rdll.libcl /MT /Ox /I..\..\include /I.. rtest.c Rdll.libThis provides an rterm-like test front end. The main loop is in themain program here: R_ReplDLLdo1() parses one line (up to ; or \n) andreturns 1 if complete, 2 if incomplete as an R expression.There is a callback available during evaluation, plotting and consoleI/O, intended to be used for processing GUI events. (The pager andgraphics windows' GUI events are handled at these times byProcessEvents: the callback is called from within ProcessEvents.)Note that in this version console input blocks the process so pagerand graphics windows will not respond during input: a real applicationthat uses these windows needs to have a non-blocking ReadConsolefunction. Rterm uses a separate thread to achieve this.An alternative to linking the import library would be to explicitlyload the DLL from a known location or after searching for it.The example shows one way to handle user interrupts, although it mightbe as easy to generate a SIGINT directly from a GUI front end. Forthis to be useful you will want to set R_Interactive to be true, andyou will need to use SETJMP to jump back to somewhere useful in yourcode.You will not (easily) be able to use Borland C++, as that uses leadingunderscores 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) foruse 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 theautomation server.