Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/engine.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ mutable struct MSession

function MSession(bufsize::Integer = default_output_buffer_size)
ep = ccall(eng_open[], Ptr{Void}, (Ptr{UInt8},), default_startcmd)
if ep == C_NULL
if ep == C_NULL
Base.warn_once("Confirm MATLAB is installed and discoverable.")
if iswindows()
Base.warn_once("Ensure `matlab -regserver` has been run in a Command Prompt as Administrator.")
Expand All @@ -26,9 +26,12 @@ mutable struct MSession
end
throw(MEngineError("failed to open MATLAB engine session"))
end
# hide the MATLAB command window on Windows
iswindows() && ccall(eng_set_visible[], Cint, (Ptr{Void}, Cint), ep, 0)

if iswindows()
# hide the MATLAB command window on Windows and change to current directory
ccall(eng_set_visible[], Cint, (Ptr{Void}, Cint), ep, 0)
ccall(eng_eval_string[], Cint, (Ptr{Void}, Ptr{UInt8}),
ep, "try cd('$(escape_string(pwd()))'); end")
end
buf = Vector{UInt8}(bufsize)
if bufsize > 0
bufptr = pointer(buf)
Expand Down