Skip to content

Commit 9c67743

Browse files
authored
Fix engine detection, revert #143 (#153)
1 parent ceaf113 commit 9c67743

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

src/MATLAB.jl

+3-6
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,12 @@ end
6666

6767
function __init__()
6868

69-
if matlabcmd != matlab_cmd()
70-
error("MATLAB.jl built with version at $(matlabcmd), but detected new installation at $(matlab_cmd()).\nRun `import Pkg; Pkg.build(\"MATLAB\")` and restart Julia.")
71-
end
7269

7370
# load libraries
7471

75-
libmx[] = Libdl.dlopen(joinpath(matlablibpath, "libmx"), Libdl.RTLD_GLOBAL)
76-
libmat[] = Libdl.dlopen(joinpath(matlablibpath, "libmat"), Libdl.RTLD_GLOBAL)
77-
libeng[] = Libdl.dlopen(joinpath(matlablibpath, "libeng"), Libdl.RTLD_GLOBAL)
72+
libmx[] = Libdl.dlopen(joinpath(matlab_libpath(), "libmx"), Libdl.RTLD_GLOBAL)
73+
libmat[] = Libdl.dlopen(joinpath(matlab_libpath(), "libmat"), Libdl.RTLD_GLOBAL)
74+
libeng[] = Libdl.dlopen(joinpath(matlab_libpath(), "libeng"), Libdl.RTLD_GLOBAL)
7875

7976
# engine functions
8077

src/engine.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
# Session open & close
66
#
77
###########################################################
8-
const default_matlabcmd = matlabcmd * " -nosplash"
9-
const default_startflag = "-nosplash"
8+
const default_startflag = "" # no additional flags
9+
default_matlabcmd() = matlab_cmd() * " -nosplash"
1010
# pass matlab flags directly or as a Vector of flags, i.e. "-a" or ["-a", "-b", "-c"]
11-
startcmd(flag::AbstractString = default_startflag) = default_matlabcmd * " " * flag
12-
startcmd(flags::AbstractVector{T}) where {T<:AbstractString} = default_matlabcmd * " " * join(flags, " ")
11+
startcmd(flag::AbstractString = default_startflag) = isempty(flag) ? default_matlabcmd() : default_matlabcmd() * " " * flag
12+
startcmd(flags::AbstractVector{T}) where {T<:AbstractString} = isempty(flags) ? default_matlabcmd() : default_matlabcmd() * " " * join(flags, " ")
1313

1414
# 64 K buffer should be sufficient to store the output text in most cases
1515
const default_output_buffer_size = 64 * 1024

src/mxbase.jl

-3
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,6 @@ function matlab_cmd()
6767
end
6868

6969

70-
const matlablibpath = matlab_libpath()
71-
const matlabcmd = matlab_cmd()
72-
7370
# helper library access function
7471

7572
engfunc(fun::Symbol) = Libdl.dlsym(libeng[], fun)

0 commit comments

Comments
 (0)