Skip to content

Commit 514426d

Browse files
authored
[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.
1 parent 91c297b commit 514426d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

base/libdl.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,9 @@ julia> dlpath("libjulia")
237237
```
238238
"""
239239
function dlpath(libname::Union{AbstractString, Symbol})
240-
handle = dlopen(libname)
241-
path = dlpath(handle)
242-
dlclose(handle)
243-
return path
240+
dlopen(libname, RTLD_NOLOAD) do handle
241+
return dlpath(handle)
242+
end
244243
end
245244

246245
if Sys.isapple()

0 commit comments

Comments
 (0)