|
5 | 5 | baremodule dSFMT_jll |
6 | 6 | using Base, Libdl |
7 | 7 |
|
8 | | -const PATH_list = String[] |
9 | | -const LIBPATH_list = String[] |
10 | | - |
11 | 8 | export libdSFMT |
12 | 9 |
|
13 | 10 | # These get calculated in __init__() |
14 | 11 | const PATH = Ref("") |
| 12 | +const PATH_list = String[] |
15 | 13 | const LIBPATH = Ref("") |
| 14 | +const LIBPATH_list = String[] |
16 | 15 | artifact_dir::String = "" |
17 | | -libdSFMT_handle::Ptr{Cvoid} = C_NULL |
18 | 16 | libdSFMT_path::String = "" |
19 | 17 |
|
20 | 18 | if Sys.iswindows() |
21 | | - const libdSFMT = "libdSFMT.dll" |
| 19 | + const _libdSFMT_path = BundledLazyLibraryPath("libdSFMT.dll") |
22 | 20 | elseif Sys.isapple() |
23 | | - const libdSFMT = "@rpath/libdSFMT.dylib" |
| 21 | + const _libdSFMT_path = BundledLazyLibraryPath("libdSFMT.dylib") |
24 | 22 | else |
25 | | - const libdSFMT = "libdSFMT.so" |
| 23 | + const _libdSFMT_path = BundledLazyLibraryPath("libdSFMT.so") |
26 | 24 | end |
27 | 25 |
|
| 26 | +const libdSFMT = LazyLibrary(_libdSFMT_path) |
| 27 | + |
| 28 | +function eager_mode() |
| 29 | + dlopen(libdSFMT) |
| 30 | +end |
| 31 | +is_available() = true |
| 32 | + |
28 | 33 | function __init__() |
29 | | - global libdSFMT_handle = dlopen(libdSFMT) |
30 | | - global libdSFMT_path = dlpath(libdSFMT_handle) |
| 34 | + global libdSFMT_path = string(_libdSFMT_path) |
31 | 35 | global artifact_dir = dirname(Sys.BINDIR) |
32 | 36 | LIBPATH[] = dirname(libdSFMT_path) |
33 | 37 | push!(LIBPATH_list, LIBPATH[]) |
34 | 38 | end |
35 | 39 |
|
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 | | - |
45 | 40 | end # module dSFMT_jll |
0 commit comments