1-
2- function declare_old_library_product (product_name, product_soname)
3- return esc (quote
4-
5- end )
6- end
7-
8- function declare_new_library_product (product_name)
9- handle_name = Symbol (string (product_name, " _handle" ))
10- get_path_name = Symbol (string (" get_" , product_name, " _path" ))
11- path_name = Symbol (string (product_name, " _path" ))
12- end
13-
141macro declare_library_product (product_name, product_soname)
152 handle_name = Symbol (string (product_name, " _handle" ))
163 get_path_name = Symbol (string (" get_" , product_name, " _path" ))
@@ -31,7 +18,7 @@ macro declare_library_product(product_name, product_soname)
3118 quote
3219 # These will be filled in by init_library_product()
3320 $ (handle_name) = C_NULL
34- $ (path_name) = " "
21+ $ (path_name) = $ ( emit_preference_path_load ( string (product_name, " _path " )))
3522 function $ (get_path_name)()
3623 return $ (path_name):: String
3724 end
5340
5441macro init_library_product (product_name, product_path, dlopen_flags)
5542 handle_name = Symbol (string (product_name, " _handle" ))
56- path_name = Symbol (string (product_name, " _path" ))
43+ preference_name = string (product_name, " _path" )
44+ path_name = Symbol (preference_name)
5745 return excat (quote
58- global $ (path_name) = joinpath (artifact_dir, $ (product_path))
46+ global $ (path_name)
47+ if $ (path_name) === nothing
48+ $ (path_name) = joinpath (artifact_dir, $ (product_path))
49+ end
5950 # Manually `dlopen()` this right now so that future invocations
6051 # of `ccall` with its path/SONAME will find this path immediately.
6152 # dlopen_flags === nothing means to not dlopen the library.
6253 if $ (dlopen_flags) != = nothing
6354 global $ (handle_name) = dlopen ($ (path_name), $ (dlopen_flags))
64- push! (LIBPATH_list, joinpath (artifact_dir, $ ( dirname (product_path) )))
55+ push! (LIBPATH_list, dirname ( $ (path_name )))
6556 end
6657 end ,
6758 init_new_library_product (product_name),
0 commit comments