From ripley at stats.ox.ac.uk  Fri Dec  9 10:27:36 2005
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Fri, 9 Dec 2005 09:27:36 +0000 (GMT)
Subject: [Rd] Blocking problem with embeded R (windows)
In-Reply-To: <4f8ec3aa0512090118h6c7700d3v1c2a1a5278aa9f4d@mail.gmail.com>
References: <4f8ec3aa0512090118h6c7700d3v1c2a1a5278aa9f4d@mail.gmail.com>
Message-ID: <Pine.LNX.4.61.0512090925100.27801@gannet.stats>

You are not calling R, but rproxy.dll, part of a (D)COM interface.  Try 
calling R itself (via R.dll).

On Fri, 9 Dec 2005, Simon Knapp wrote:

> 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 at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] Blocking problem with embeded R (windows)
Prof Brian Ripley