<div dir="ltr"><div>On the changes for R 4.2.0, it is not clear how to distinguish</div><div>R API functions from R internal functions (and this probably</div><div>doesn't matter for Rcpp), but you are correct,</div><div>on closer inspection these changes should not have effected</div><div>the way R_DefParams() was used before R_DefParamsEx()</div><div>was introduced.</div><div><br></div>It would be helpful if others could test to see if they can reproduce<div>the problems I reported. I will submit a pull request when </div><div>ready, and if there is no objection, ifdefs will be included that<div>permit compiling Rcpp and RInside using MSVC (there are only</div><div>a few small changes with most of them applying to RInside.cpp).</div><div><br></div><div>I do not recommend MSVC for R package development and deployment,<br></div><div>just for debugging difficult problems like this. More than a decade ago</div><div>this helped to track down bugs in a popular R package (rgl). Bugs that</div><div>can slip by g++ can trigger problems with MSVC. Users who use</div><div>MSVC for this purpose should understand that they are completely</div><div>on their own, as you say. There may be some advantages to testing</div><div>with MSVC given its good support for the newer runtime UCRT.</div><div><br></div><div>Dominick</div><div><br></div><div><br></div><div> </div><div><br></div><div><br></div><div><br></div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jan 23, 2023 at 4:38 AM Tomas Kalibera <<a href="mailto:tomas.kalibera@gmail.com" target="_blank">tomas.kalibera@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<p><br>
</p>
<div>On 1/21/23 16:53, Dominick Samperi
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>There are problems with the R-devel version, but they
appear less frequently. </div>
<div>What happens is two instances of the program are started
instead of one, </div>
<div>but there is normally</div>
<div>a "dominant" one that hides the fact that there is another
instance lurking, so</div>
<div>the program seems to behave normally. Occasionally both
instances </div>
<div>come up (two terminals and two x11 panes). The R function </div>
<div>R_SetWin32(Rstart) is called twice on startup.</div>
<div><br>
</div>
<div>The problem is likely caused by the fact that R internals
changed for</div>
<div>R 4.2.0, in particular, the structRstart in
R_ext/RStartup.h changed,</div>
<div>and RSTART_VERSION was introduced. The requires use of</div>
<div>R_DefParamsEx(&Rst, RSTART_VERSION) in place of</div>
<div>R_DefParams(), and the return value must be zero for
version</div>
<div>compatibility. <br>
</div>
</div>
</blockquote>
A short comment from me, please see the source code comments for
more and R-exts. The changes in R 4.2.0 in the API carefully were
designed to be backwards compatible. It is of course a good idea to
switch to the new API and the embedding application should ideally
always use the current headers, but it is unlikely the cause of any
problems now.<br>
<blockquote type="cite">
<div dir="ltr">
<div><br>
</div>
<div>This is not Windows-specific, and I suspect there are </div>
<div>problems under Linux, but symptoms rarely surface due to</div>
<div>some quirks of that architecture (better immune system?).</div>
<div><br>
</div>
<div>I modified the source with hints from the example </div>
<div>src/gnuwin32/front-ends/rtest.c, and the program seems</div>
<div>to behave more consistently, but the multiple instance</div>
<div>problem persists.</div>
<div><br>
</div>
<div>I've attached a version of RInside.cpp with my changes. The</div>
<div>_MSC_VER ifdefs are for Video Studio, which I am using for</div>
<div>debugging. I had some problems with gdb.</div>
</div>
</blockquote>
<p>R code has not been used with Visual Studio compilers for many
years, and never officially supported by those. With MSVC, you are
completely on your own and I would expect a large number of
problems (solving many of which won't be relevant for R nor R
packages).<br>
</p>
<p>Tomas<br>
</p>
<blockquote type="cite">
<div dir="ltr">
<div><br>
</div>
<div>Dominick</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Fri, Jan 20, 2023 at 7:56
PM Dirk Eddelbuettel <<a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
On 20 January 2023 at 19:11, Dominick Samperi wrote:<br>
| You are right Dirk, RInside overrides what is specified
because the function<br>
| myAskYesNo doesn't actually ask, so this explains why there
is to<br>
| termination<br>
| prompt under Windows. This does not change what happens
under Linux<br>
| because this function is assigned to a Windows-specific
callback. Under<br>
| Linux the confirmation message appears.<br>
| <br>
| The current status is that the example seems to work using
R-devel,<br>
| but not using R-4.2.2.<br>
<br>
:-/<br>
<br>
If you can narrow it down we'd appreciate it. If not, well,
r-devel will be<br>
r-release in the three months time.<br>
<br>
And I don't think we have done any changes on the Windows side
since before<br>
UCRT with R 4.2.0.<br>
<br>
Dirk<br>
<br>
-- <br>
<a href="http://dirk.eddelbuettel.com" rel="noreferrer" target="_blank">dirk.eddelbuettel.com</a>
| @eddelbuettel | <a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a><br>
</blockquote>
</div>
</blockquote>
</div>
</blockquote></div>