Skip to content

Commit ce92d22

Browse files
lazify dSFMT_jll
1 parent 3655631 commit ce92d22

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

stdlib/dSFMT_jll/src/dSFMT_jll.jl

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,41 +5,41 @@
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

18+
_libdSFMT_dependencies = LazyLibrary[]
19+
2020
if Sys.iswindows()
21-
const libdSFMT = "libdSFMT.dll"
21+
const _libdSFMT_path = BundledLazyLibraryPath("libdSFMT.dll")
2222
elseif Sys.isapple()
23-
const libdSFMT = "@rpath/libdSFMT.dylib"
23+
const _libdSFMT_path = BundledLazyLibraryPath("libdSFMT.dylib")
2424
else
25-
const libdSFMT = "libdSFMT.so"
25+
const _libdSFMT_path = BundledLazyLibraryPath("libdSFMT.so")
2626
end
2727

28+
const libdSFMT = LazyLibrary(
29+
_libdSFMT_path,
30+
dependencies=_libdSFMT_dependencies,
31+
)
32+
33+
function eager_mode()
34+
dlopen(libdSFMT)
35+
end
36+
is_available() = true
37+
2838
function __init__()
29-
global libdSFMT_handle = dlopen(libdSFMT)
30-
global libdSFMT_path = dlpath(libdSFMT_handle)
39+
global libdSFMT_path = string(_libdSFMT_path)
3140
global artifact_dir = dirname(Sys.BINDIR)
3241
LIBPATH[] = dirname(libdSFMT_path)
3342
push!(LIBPATH_list, LIBPATH[])
3443
end
3544

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-
4545
end # module dSFMT_jll

0 commit comments

Comments
 (0)