Skip to content

Commit

Permalink
C stack fix for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
randy3k committed Jan 31, 2019
1 parent b546e64 commit 853860d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/setup.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,15 @@ function initEmbeddedR()
end

argv = ["REmbeddedJulia","--silent","--no-save"]
i = ccall((:Rf_initEmbeddedR,libR),Cint,(Cint,Ptr{Ptr{Cchar}}),length(argv),argv)
i = ccall((:Rf_initialize_R,libR),Cint,(Cint,Ptr{Ptr{Cchar}}),length(argv),argv)
if i == 0
error("Could not start embedded R session.")
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,())

rs = RStart()
ccall((:R_DefParams,libR),Nothing,(Ptr{RStart},), Ref(rs))
Expand Down

0 comments on commit 853860d

Please sign in to comment.