Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ccall sometimes fails to statically evaluate arguments due to binding ages #57749

Open
topolarity opened this issue Mar 13, 2025 · 1 comment
Assignees

Comments

@topolarity
Copy link
Member

using Zstd_jll
const prefix = "Zstd version: "
const sym = :ZSTD_versionString
get_zstd_version() = prefix * unsafe_string(ccall((sym, libzstd), Cstring, ()))

On nightly:

julia> get_zstd_version()
ERROR: TypeError: in ccall: first argument not a pointer or valid constant expression, expected Ptr, got a value of type Tuple{Symbol, String}

It works if you swap the constant definition order:

using Zstd_jll
const sym = :ZSTD_versionString
const prefix = "Zstd version: "
get_zstd_version() = prefix * unsafe_string(ccall((sym, libzstd), Cstring, ()))
julia> get_zstd_version()
"Zstd version: 1.5.7"

This happens because the usage of prefix restricted the valid world range more tightly

@topolarity
Copy link
Member Author

This is only noticeably affecting 3 packages in the latest nightly PkgEval (3/10):

The first is probably due to the prediction of static vs. dynamic ccall being incorrect under the new binding logic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants