Skip to content

Commit

Permalink
Add type assertion to global accesses (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
topolarity authored May 16, 2024
1 parent 0aa5017 commit 183d162
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/products/executable_generators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,6 @@ macro init_executable_product(product_name, product_path)
end

# Add this executable's directory onto the list of PATH's that we'll need to expose to dependents
push!(PATH_list, dirname($(path_name)))
push!(PATH_list, dirname($(path_name)::String))
end)
end
10 changes: 5 additions & 5 deletions src/products/library_generators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ macro declare_library_product(product_name, product_soname)
)
end

function init_new_library_product(product_name)
function init_new_library_product(product_name, path_name)
@static if VERSION < v"1.6.0-DEV"
return nothing
else
return quote
# Initialize non-const variable export with the path to this product
global $(product_name) = $(Symbol(string(product_name, "_path")))
global $(product_name) = $(path_name)::String
end
end
end
Expand All @@ -60,10 +60,10 @@ macro init_library_product(product_name, product_path, dlopen_flags)
# of `ccall` with its path/SONAME will find this path immediately.
# dlopen_flags === nothing means to not dlopen the library.
if $(dlopen_flags) !== nothing
global $(handle_name) = dlopen($(path_name), $(dlopen_flags))
push!(LIBPATH_list, dirname($(path_name)))
global $(handle_name) = dlopen($(path_name)::String, $(dlopen_flags))
push!(LIBPATH_list, dirname($(path_name)::String))
end
end,
init_new_library_product(product_name),
init_new_library_product(product_name, path_name),
)
end

0 comments on commit 183d162

Please sign in to comment.