Skip to content

Commit

Permalink
🤷‍♂️
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth committed Sep 26, 2021
1 parent 9a6fe94 commit 481e7af
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/setup.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
Expand All @@ -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)

Expand Down

0 comments on commit 481e7af

Please sign in to comment.