Skip to content

Commit 91b4fcc

Browse files
lazify dSFMT_jll
1 parent 3655631 commit 91b4fcc

File tree

1 file changed

+13
-18
lines changed

1 file changed

+13
-18
lines changed

stdlib/dSFMT_jll/src/dSFMT_jll.jl

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,41 +5,36 @@
55
baremodule dSFMT_jll
66
using Base, Libdl
77

8-
const PATH_list = String[]
9-
const LIBPATH_list = String[]
10-
118
export libdSFMT
129

1310
# These get calculated in __init__()
1411
const PATH = Ref("")
12+
const PATH_list = String[]
1513
const LIBPATH = Ref("")
14+
const LIBPATH_list = String[]
1615
artifact_dir::String = ""
17-
libdSFMT_handle::Ptr{Cvoid} = C_NULL
1816
libdSFMT_path::String = ""
1917

2018
if Sys.iswindows()
21-
const libdSFMT = "libdSFMT.dll"
19+
const _libdSFMT_path = BundledLazyLibraryPath("libdSFMT.dll")
2220
elseif Sys.isapple()
23-
const libdSFMT = "@rpath/libdSFMT.dylib"
21+
const _libdSFMT_path = BundledLazyLibraryPath("libdSFMT.dylib")
2422
else
25-
const libdSFMT = "libdSFMT.so"
23+
const _libdSFMT_path = BundledLazyLibraryPath("libdSFMT.so")
2624
end
2725

26+
const libdSFMT = LazyLibrary(_libdSFMT_path)
27+
28+
function eager_mode()
29+
dlopen(libdSFMT)
30+
end
31+
is_available() = true
32+
2833
function __init__()
29-
global libdSFMT_handle = dlopen(libdSFMT)
30-
global libdSFMT_path = dlpath(libdSFMT_handle)
34+
global libdSFMT_path = string(_libdSFMT_path)
3135
global artifact_dir = dirname(Sys.BINDIR)
3236
LIBPATH[] = dirname(libdSFMT_path)
3337
push!(LIBPATH_list, LIBPATH[])
3438
end
3539

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

0 commit comments

Comments
 (0)