<div dir="ltr">Thanks Tomas,<div><br><div>After fixing the library issue and getting the app running what happens when you terminate with q()?</div></div><div><br></div><div>You should see the usual "Save workspace image? [y/n/c]:", and under Linux this is what happens.</div><div><br></div><div>In my testing with the latest R source under Windows this doesn't happen, but I haven't been able</div><div>to build with modified R source to find out why.</div><div><br></div><div>Dominick</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 4:28 AM Tomas Kalibera <<a href="mailto:tomas.kalibera@gmail.com">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">On 1/20/23 02:40, Dirk Eddelbuettel wrote:<br>
> On 19 January 2023 at 19:41, Dominick Samperi wrote:<br>
> | I narrowed the problem down to the call to R_ReplDLLdo1() in RInside, and I<br>
> | built R-4.3.0 pre-release version for Windows from source to investigate<br>
> | further (online instructions by Tomas Kalibera were very helpful).<br>
><br>
> Yes Tomas is a master of many tools and deep source of tricks and general help.<br>
>   <br>
> | But the problem does not occur with this version of R! Note that the problem<br>
> | did not occur in some older versions of R either.<br>
> |<br>
> | This version-dependence may be related to the fact that this function and<br>
> | others used by Rcpp/RInside are not part of the supported API for R, so the<br>
> | underlying implementation details for internals like external pointers may<br>
> | change.<br>
><br>
> Well I probably don't agree here.<br>
><br>
> Because (as per your Subject) 'Rcpp_precious_remove' is in this, as we had a<br>
> bit of transition to get to more effortlessly growing internal objects, I<br>
> still suspect (as per my first message in this thread) that you may have had<br>
> a cross of 'old' and 'new' approaches. A simple consisten recompilation<br>
> generally fixes that.  Per the NEWS.Rd we did the finaly clean up (a reset)<br>
> in 1.0.9. (We had improved unwind_protect since just after that release.)<br>
><br>
> But by all means, keep digging and look around if you think something is<br>
> suspicious there. It could well that we do something wrong on Windows, or<br>
> have another issue somewhere.  But I remain quite confident that things are<br>
> generally in good working order -- these RInside examples have all been<br>
> working fine more or less unchanged for close to a decade.<br>
<br>
I tried the example sent by Dominick at the start of this thread with <br>
the current R-devel and Rtools43 and the current Rcpp and RInside. I <br>
also got the error message "Error: function 'Rcpp_precious_remove' not <br>
provided by package 'Rcpp'", but it was because R_LIBS was not set. <br>
After setting it, the program worked.<br>
<br>
In more detail, this was my make file:<br>
<br>
----<br>
<br>
PKLIB = C:/Users/tomas/AppData/Local/R/win-library/4.3<br>
RHOME = C:/msys64/home/tomas/ucrt3/r/trunk<br>
<br>
INC = -I"$(RHOME)/include" -I"$(PKLIB)/Rcpp/include" <br>
-I"$(PKLIB)/RInside/include"<br>
<br>
LIB = -L"$(RHOME)/bin/x64" -L"$(PKLIB)/RInside/lib/x64" -lRInside -lR<br>
<br>
repl: repl.o<br>
         g++ -o repl repl.o $(LIB)<br>
<br>
repl.o: repl.cpp<br>
         g++ -c -g -std=c++11 $(INC) repl.cpp<br>
<br>
clean:<br>
         rm *.o *.exe<br>
---<br>
<br>
This was repl.cpp:<br>
<br>
---<br>
<br>
#include <RInside.h>                    // for the embedded R via RInside<br>
<br>
int main(int argc, char *argv[]) {<br>
     RInside R(argc, argv, false, false, true); // Create an embedded R <br>
instance<br>
<br>
     std::cout << "[ You can finish the with Ctrl+D ]" << std::endl;<br>
     R.parseEval("options(prompt = 'R console > ')");<br>
     R.parseEval("X11()");<br>
     R.repl() ;<br>
     R.parseEval("dev.off()");<br>
     exit(0);<br>
}<br>
<br>
---<br>
<br>
I ran repl.exe from cmd.exe (not the Msys2 bash) so that I could see <br>
more error messages.<br>
<br>
I had to set PATH to make sure R.dll is found by repl.exe. And I had to <br>
set R_LIBS to make sure Rcpp is found. These settings made it work:<br>
<br>
set PATH=%PATH%;C:\msys64\home\tomas\ucrt3\r\trunk\bin\x64<br>
set R_LIBS=C:\Users\tomas\AppData\Local\R\win-library\4.3<br>
<br>
Without these variables set, executing repl.exe gave this error: "The <br>
code execution cannot proceed because R.dll was not found. ", hence I <br>
set PATH as above.<br>
<br>
Executing then without R_LIBS set gave this error:<br>
<br>
"<br>
Error: function 'Rcpp_precious_remove' not provided by package 'Rcpp'<br>
In addition: Warning message:<br>
In library(package, lib.loc = lib.loc, character.only = TRUE, <br>
logical.return = TRUE,  :<br>
   there is no package called 'Rcpp'<br>
"<br>
<br>
So I knew I had to set R_LIBS.<br>
<br>
Best<br>
Tomas<br>
<br>
<br>
><br>
> Cheers, Dirk<br>
><br>
</blockquote></div>