Skip to content

Commit

Permalink
Deal with the difference in include function between julia v0.6 and j…
Browse files Browse the repository at this point in the history
…ulia v0.7. Relevant to #10.
  • Loading branch information
Non-Contradiction committed Oct 2, 2017
1 parent 6c19421 commit 33a6d61
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,16 @@ julia_setup <- function(JULIA_HOME = NULL, verbose = TRUE, force = FALSE, useRCa
if (verbose) message(paste0("Julia version ", .julia$VERSION, " found."))

if (!newer(.julia$VERSION, "0.6.0")) {
## message("Before 0.6.0")
.julia$init_ <- .julia$compile(
sig = c(dir = "character"),
body = "jl_init(CHAR(STRING_ELT(dir, 0))); return R_NilValue;"
)

.julia$init <- function() .julia$init_(.julia$bin_dir)
}
if (newer(.julia$VERSION, "0.6.0")) {
else {
## message("After 0.6.0")
.julia$init <- .julia$compile(
sig = c(),
body = "jl_init(); return R_NilValue;"
Expand Down Expand Up @@ -145,7 +147,14 @@ julia_setup <- function(JULIA_HOME = NULL, verbose = TRUE, force = FALSE, useRCa

if (verbose) message("Loading setup script for JuliaCall...")

.julia$cmd(paste0('include("', system.file("julia/setup.jl", package = "JuliaCall"),'")'))
if (!newer(.julia$VERSION, "0.7.0")) {
## message("Before 0.7.0")
.julia$cmd(paste0('include("', system.file("julia/setup.jl", package = "JuliaCall"),'")'))
}
else {
## message("After 0.7.0")
.julia$cmd(paste0('Base.include(Main,"', system.file("julia/setup.jl", package = "JuliaCall"),'")'))
}

if (verbose) message("Finish loading setup script for JuliaCall.")

Expand Down

0 comments on commit 33a6d61

Please sign in to comment.