[Rd] Blocking problem with embeded R (windows)

From: Simon Knapp <sleepingwell_at_gmail.com>
Date: Fri 09 Dec 2005 - 09:18:56 GMT

Hi all,

I am trying to make calls to R from an MFC application running on XP and am having problems blocking the application while the call executes.

I have tried the following approaches to using R from the application (note that I set a wait cursor while R is executing).

  1. call rcmd in BATCH mode using system(). This works well, except that I get the cmd window popping up... which makes the app look pretty tacky.
  2. use the com interface. This works OK... sometimes. When I call R_Proxy_evaluate_noreturn by pressing OK in the dialog that starts the execution, if the cursor happens to be over the applications window when the dialog disappears, then I get my wait cursor and the application blocks. If the cursor is not over the applications window, then I don't get the wait cursor and the application seems to block after the first mouse click within the applications window.
  3. use Rproxy.dll directly. The application does not block and I don't get a wait cursor at all.
  4. integrate the code used by Rproxy into my application (in verbatim). The application does not block and I don't get a wait cursor at all.

The things I have read about DLLs make statements like "a dll is just code and data loaded into your applications process", which I have taken to imply that the application should block while R is executing. This also seems to be implied by the discussion around the rtest example r-ext.pdf.

Can someone offer any advice on whether there is some way to make my application block when configuring R? If not, is there a simple way to make the app block (I have never coded using threads before, am a relative newbie to MFC and am struggling to figure out how I would to block otherwise).

Help would be greatly appreciated,
Simon Knapp

R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Fri Dec 09 20:23:52 2005

This archive was generated by hypermail 2.1.8 : Mon 20 Feb 2006 - 03:21:34 GMT