diff --git a/base/libdl.jl b/base/libdl.jl index 4f29260bb24f8..9f37eb2034007 100644 --- a/base/libdl.jl +++ b/base/libdl.jl @@ -237,10 +237,9 @@ julia> dlpath("libjulia") ``` """ function dlpath(libname::Union{AbstractString, Symbol}) - handle = dlopen(libname) - path = dlpath(handle) - dlclose(handle) - return path + dlopen(libname, RTLD_NOLOAD) do handle + return dlpath(handle) + end end if Sys.isapple()