diff --git a/src/MATLAB.jl b/src/MATLAB.jl index f2c8667..68046e5 100644 --- a/src/MATLAB.jl +++ b/src/MATLAB.jl @@ -66,15 +66,12 @@ end function __init__() - if matlabcmd != matlab_cmd() - error("MATLAB.jl built with version at $(matlabcmd), but detected new installation at $(matlab_cmd()).\nRun `import Pkg; Pkg.build(\"MATLAB\")` and restart Julia.") - end # load libraries - libmx[] = Libdl.dlopen(joinpath(matlablibpath, "libmx"), Libdl.RTLD_GLOBAL) - libmat[] = Libdl.dlopen(joinpath(matlablibpath, "libmat"), Libdl.RTLD_GLOBAL) - libeng[] = Libdl.dlopen(joinpath(matlablibpath, "libeng"), Libdl.RTLD_GLOBAL) + libmx[] = Libdl.dlopen(joinpath(matlab_libpath(), "libmx"), Libdl.RTLD_GLOBAL) + libmat[] = Libdl.dlopen(joinpath(matlab_libpath(), "libmat"), Libdl.RTLD_GLOBAL) + libeng[] = Libdl.dlopen(joinpath(matlab_libpath(), "libeng"), Libdl.RTLD_GLOBAL) # engine functions diff --git a/src/engine.jl b/src/engine.jl index 6c741a5..ec78c74 100644 --- a/src/engine.jl +++ b/src/engine.jl @@ -5,11 +5,11 @@ # Session open & close # ########################################################### -const default_matlabcmd = matlabcmd * " -nosplash" -const default_startflag = "-nosplash" +const default_startflag = "" # no additional flags +default_matlabcmd() = matlab_cmd() * " -nosplash" # pass matlab flags directly or as a Vector of flags, i.e. "-a" or ["-a", "-b", "-c"] -startcmd(flag::AbstractString = default_startflag) = default_matlabcmd * " " * flag -startcmd(flags::AbstractVector{T}) where {T<:AbstractString} = default_matlabcmd * " " * join(flags, " ") +startcmd(flag::AbstractString = default_startflag) = isempty(flag) ? default_matlabcmd() : default_matlabcmd() * " " * flag +startcmd(flags::AbstractVector{T}) where {T<:AbstractString} = isempty(flags) ? default_matlabcmd() : default_matlabcmd() * " " * join(flags, " ") # 64 K buffer should be sufficient to store the output text in most cases const default_output_buffer_size = 64 * 1024 diff --git a/src/mxbase.jl b/src/mxbase.jl index 4e320d0..2855e63 100644 --- a/src/mxbase.jl +++ b/src/mxbase.jl @@ -67,9 +67,6 @@ function matlab_cmd() end -const matlablibpath = matlab_libpath() -const matlabcmd = matlab_cmd() - # helper library access function engfunc(fun::Symbol) = Libdl.dlsym(libeng[], fun)