From 03e2773ac4b1d63a21a9395b8422f7471adb86e9 Mon Sep 17 00:00:00 2001 From: Taylor McDonnell Date: Tue, 2 Nov 2021 11:09:38 -0600 Subject: [PATCH] Update Mex.jl --- src/Mex.jl | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Mex.jl b/src/Mex.jl index 7420123..50d035b 100644 --- a/src/Mex.jl +++ b/src/Mex.jl @@ -17,11 +17,18 @@ const ut_is_interrupt_pending = Ref{Ptr{Cvoid}}() function __init__() - libmex[] = Libdl.dlopen(joinpath(MATLAB.matlab_libpath, "libmex"), Libdl.RTLD_GLOBAL; throw_error=false) - mex_call_matlab_with_trap[] = Libdl.dlsym(libmex[], :mexCallMATLABWithTrap; throw_error=false) + result = Libdl.dlopen(joinpath(MATLAB.matlab_libpath, "libmex"), Libdl.RTLD_GLOBAL; throw_error=false) + if !isnothing(result) + libmex[] = result + mex_call_matlab_with_trap[] = Libdl.dlsym(libmex[], :mexCallMATLABWithTrap) + end - libut[] = Libdl.dlopen(joinpath(MATLAB.matlab_libpath, "libut"), Libdl.RTLD_GLOBAL; throw_error=false) - ut_is_interrupt_pending[] = Libdl.dlsym(libut[], :utIsInterruptPending; throw_error=false) + result = Libdl.dlopen(joinpath(MATLAB.matlab_libpath, "libut"), Libdl.RTLD_GLOBAL; throw_error=false) + if !isnothing(result) + libut[] = result + ut_is_interrupt_pending[] = Libdl.dlsym(libut[], :utIsInterruptPending) + end + end # --- Patches --- #