Skip to content
Prev 4004 / 63424 Next

Port of R header files to Delphi

On Wed, 21 Jun 2000, Duncan Murdoch wrote:

            
I suspect it is the best place, as most of your questions are about
R internals.  As for the R for Windows internals, probably only Guido 
knows, but you can read the code as I have to frequently.
I suspect that is just because you are not set up to run in interactive
mode (the internal variable R_Interactive).  The default error handler
does abort on error in non-interactive mode.  I don't know what your
`rterm' is, but rtest.c is specifically in non-interactive mode.
The real rterm.c sets R_Interactive based on isatty(0) and the --ess flag.
If you set interactive mode, you will need some way to interrupt,
and with a Windows front-end, the easiest way is to set UserBreak to
non-zero (which is equivalent to Ctrl-C on Unix or Esc in Rgui).

On my TODO list is to run more threads, so that there is a control
thread different from the one running the R interpreter.  Principally
to make interruption easier to handle, and to allow looping C code
to be interrupted.
That's a symbol, not a variable.  Section 3.6.7 of `Writing R Extensions'
may help: the key is to use findVar or one of the related functions.
Um. DLLs often export both.  Unfortunately, the mechanisms for *imports*
are messy, especially for exported pointers.  You need to refer to them as
_imp___blah, and that's purpose of globalvar.h.  There is no extra
indirection: apart from the name mapping they are handled just like
externs to other modules not in Dlls.
PrintValue can be called on a SEXP pointing to an R object: you may find
R_PV a little safer. (Both are in src/main/print.c.)  You will need
R_WriteConsole set up, of course.