-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Open
Labels
featureIndicates new feature / enhancement requestsIndicates new feature / enhancement requeststrimmingIssues with trimming functionality or PR's relevant to its performance/functionalityIssues with trimming functionality or PR's relevant to its performance/functionality
Description
Once #57706 is fixed, there will be no way to compute a library string dynamically for a ccall because
ccallforbids referring to local variables:
julia> foo() = (b = bar(); ccall((:test, b), Cvoid, ()))
ERROR: syntax: ccall function name and library expression cannot reference local variables- inference / optimizer never inlines / resolves the library function for a
ccall:
julia> bar() = string(rand(Int))
julia> foo() = ccall((:test, bar()), Cvoid, ())
julia> code_typed(foo, ())
1-element Vector{Any}:
CodeInfo(
1 ─ $(Expr(:foreigncall, :(Core.tuple(:test, Main.bar())), Nothing, svec(), 0, :(:ccall)))::Nothing
└── return nothing
) => NothingNotice that the call to Main.bar() is embedded as a sub-expression in Expr(:foreigncall) and is never explored by inference / optimizer.
Metadata
Metadata
Assignees
Labels
featureIndicates new feature / enhancement requestsIndicates new feature / enhancement requeststrimmingIssues with trimming functionality or PR's relevant to its performance/functionalityIssues with trimming functionality or PR's relevant to its performance/functionality