From 33a6d6193d61527242780926e35cb64297a3c916 Mon Sep 17 00:00:00 2001 From: Non-Contradiction Date: Mon, 2 Oct 2017 14:28:41 -0400 Subject: [PATCH] Deal with the difference in include function between julia v0.6 and julia v0.7. Relevant to #10. --- R/zzz.R | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/R/zzz.R b/R/zzz.R index 40e9da45..cbf34cd9 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -99,6 +99,7 @@ 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;" @@ -106,7 +107,8 @@ julia_setup <- function(JULIA_HOME = NULL, verbose = TRUE, force = FALSE, useRCa .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;" @@ -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.")