Skip to content

Commit

Permalink
Fix engine detection, revert #143 (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
musm authored Nov 27, 2018
1 parent ceaf113 commit 9c67743
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
9 changes: 3 additions & 6 deletions src/MATLAB.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions src/engine.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions src/mxbase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9c67743

Please sign in to comment.