Skip to content

Commit f328bf7

Browse files
lazify OpenLibm_jll
1 parent 2668604 commit f328bf7

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

stdlib/OpenLibm_jll/src/OpenLibm_jll.jl

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,36 @@
44
baremodule OpenLibm_jll
55
using Base, Libdl
66

7-
const PATH_list = String[]
8-
const LIBPATH_list = String[]
9-
107
export libopenlibm
118

129
# These get calculated in __init__()
1310
const PATH = Ref("")
11+
const PATH_list = String[]
1412
const LIBPATH = Ref("")
13+
const LIBPATH_list = String[]
1514
artifact_dir::String = ""
1615
libopenlibm_path::String = ""
1716

1817
if Sys.iswindows()
19-
const libopenlibm = "libopenlibm.dll"
18+
const _libopenlibm_path = BundledLazyLibraryPath("libopenlibm.dll")
2019
elseif Sys.isapple()
21-
const libopenlibm = "@rpath/libopenlibm.4.dylib"
20+
const _libopenlibm_path = BundledLazyLibraryPath("libopenlibm.4.dylib")
2221
else
23-
const libopenlibm = "libopenlibm.so.4"
22+
const _libopenlibm_path = BundledLazyLibraryPath("libopenlibm.so.4")
2423
end
2524

25+
const libopenlibm = LazyLibrary(_libopenlibm_path)
26+
27+
function eager_mode()
28+
dlopen(libopenlibm)
29+
end
30+
is_available() = true
31+
2632
function __init__()
27-
global libopenlibm_handle = dlopen(libopenlibm)
28-
global libopenlibm_path = dlpath(libopenlibm_handle)
33+
global libopenlibm_path = string(_libopenlibm_path)
2934
global artifact_dir = dirname(Sys.BINDIR)
3035
LIBPATH[] = dirname(libopenlibm_path)
3136
push!(LIBPATH_list, LIBPATH[])
3237
end
3338

34-
# JLLWrappers API compatibility shims. Note that not all of these will really make sense.
35-
# For instance, `find_artifact_dir()` won't actually be the artifact directory, because
36-
# there isn't one. It instead returns the overall Julia prefix.
37-
is_available() = true
38-
find_artifact_dir() = artifact_dir
39-
dev_jll() = error("stdlib JLLs cannot be dev'ed")
40-
best_wrapper = nothing
41-
get_libopenlibm_path() = libopenlibm_path
42-
4339
end # module OpenLibm_jll

0 commit comments

Comments
 (0)