/
githubmirror
/
julia
Обзор
Документация
Войти
/
githubmirror
/
julia
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
test/trim/BasicJLL/src/BasicJLL.jl
38 строк
1 KB
Cody Tapscott
Migrate `--trim` tests to use JuliaC, delete out-of-date `contrib/juliac` (#62128)
18 июн 2026, 00:01
Не верифицирован
18 июн 2026, 00:01
cfb686b
Код
Авторство
О чём код?
# Test that a JLL dependency works under trimming, at both build- and run-time module BasicJLL using Libdl using Zstd_jll # Note this uses the vendored older non-LazyLibrary version of Zstd_jll # JLL usage at build-time should function as expected Zstd_jll.__init__() const build_ver = unsafe_string(ccall((:ZSTD_versionString, libzstd), Cstring, ())) function print_string(fptr::Ptr{Cvoid}) println(Core.stdout, unsafe_string(ccall(fptr, Cstring, ()))) end version_str::String = "1.2.3" function @main(args::Vector{String})::Cint # Test the basic "Hello, world!" println(Core.stdout, "Julia! Hello, world!") # JLL usage at run-time should function as expected ver = unsafe_string(ccall((:ZSTD_versionString, libzstd), Cstring, ())) println(Core.stdout, ver) @assert ver == build_ver parsed_ver = VersionNumber(version_str) @assert parsed_ver == v"1.2.3" sleep(0.01) # Add an indirection via `@cfunction` / 1-arg ccall cfunc = @cfunction(print_string, Cvoid, (Ptr{Cvoid},)) fptr = dlsym(Zstd_jll.libzstd_handle, :ZSTD_versionString) ccall(cfunc, Cvoid, (Ptr{Cvoid},), fptr) return 0 end end