From 481e7afbc6c187256a4088b7c60c9d2a2f1b030e Mon Sep 17 00:00:00 2001 From: Ian Date: Sun, 26 Sep 2021 00:16:26 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=B7=E2=80=8D=E2=99=82=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/setup.jl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/setup.jl b/src/setup.jl index 4d32785f..14f4cb4e 100644 --- a/src/setup.jl +++ b/src/setup.jl @@ -123,6 +123,12 @@ function initEmbeddedR() # fix an unicode issue # cf https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17677 try unsafe_store!(cglobal((:EmitEmbeddedUTF8, RCall.libR),Cint), 1) catch end + + # Julia 1.1+ no longer loads libraries in the main thread + # TODO: this needs to be set correctly + # https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Threading-issues + unsafe_store!(cglobal((:R_CStackLimit,libR),Csize_t), typemax(Csize_t)) + ccall((:setup_Rmainloop,libR),Cvoid,()) end @static if Sys.isunix() @@ -133,8 +139,8 @@ function initEmbeddedR() ENV["R_SHARE_DIR"] = joinpath(Rhome,"share") # initialize library - argv = ["REmbeddedJulia","--silent","--no-save", "--no-restore"] - ccall((:Rf_initialize_R,libR),Cint,(Cint,Ptr{Ptr{Cchar}}),length(argv),argv) + argv = ["REmbeddedJulia","--silent"] + ccall((:Rf_initEmbeddedR,libR),Cint,(Cint,Ptr{Ptr{Cchar}}),length(argv),argv) ptr_read_console = @cfunction($read_console,Cint,(Cstring,Ptr{UInt8},Cint,Cint)).ptr ptr_write_console_ex = @cfunction($write_console_ex,Nothing,(Ptr{UInt8},Cint,Cint)).ptr @@ -147,12 +153,6 @@ function initEmbeddedR() unsafe_store!(cglobal((:R_PolledEvents,libR),Ptr{Cvoid}), ptr_polled_events) end - # Julia 1.1+ no longer loads libraries in the main thread - # TODO: this needs to be set correctly - # https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Threading-issues - unsafe_store!(cglobal((:R_CStackLimit,libR),Csize_t), typemax(Csize_t)) - ccall((:setup_Rmainloop,libR),Cvoid,()) - Rembedded[] = true atexit(endEmbeddedR)