From 02f09ee78a383699bb1182ac135cdba5b2f7c044 Mon Sep 17 00:00:00 2001 From: Elliot Saba Date: Fri, 26 Mar 2021 10:01:42 -0700 Subject: [PATCH] [Libdl] Use RTLD_NOLOAD when calling dlpath(::String) (#39676) This should make it faster and have fewer side-effects to look up the absolute path of libraries. --- base/libdl.jl | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/base/libdl.jl b/base/libdl.jl index 4f29260bb24f82..9f37eb2034007c 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()