@@ -145,11 +145,13 @@ Evaluate a `:foreigncall` (from a `ccall`) statement `callexpr` in the context o
145
145
`stack` and `pc` are unused, but supplied for consistency with [`evaluate_call!`](@ref).
146
146
"""
147
147
function evaluate_foreigncall! (stack, frame:: JuliaStackFrame , call_expr:: Expr , pc)
148
- args = collect_args (frame, call_expr; isfc= true )
148
+ head = call_expr. head
149
+ args = collect_args (frame, call_expr; isfc = head== :foreigncall )
149
150
for i = 2 : length (args)
150
151
arg = args[i]
151
152
args[i] = isa (arg, Symbol) ? QuoteNode (arg) : arg
152
153
end
154
+ head == :cfunction && (args[2 ] = QuoteNode (args[2 ]))
153
155
scope = frame. code. scope
154
156
if ! isempty (frame. sparams) && scope isa Method
155
157
sig = scope. sig
@@ -158,7 +160,7 @@ function evaluate_foreigncall!(stack, frame::JuliaStackFrame, call_expr::Expr, p
158
160
instantiate_type_in_env (arg, sig, frame. sparams)
159
161
end ... )
160
162
end
161
- return Core. eval (moduleof (frame), Expr (:foreigncall , args... ))
163
+ return Core. eval (moduleof (frame), Expr (head , args... ))
162
164
end
163
165
164
166
function evaluate_call! (:: Compiled , frame:: JuliaStackFrame , call_expr:: Expr , pc; #= unused=# exec!:: Function = finish_and_return!)
@@ -318,7 +320,7 @@ function eval_rhs(stack, frame, node::Expr, pc)
318
320
return check_isdefined (frame, node. args[1 ])
319
321
elseif head == :call
320
322
return evaluate_call! (stack, frame, node, pc)
321
- elseif head == :foreigncall
323
+ elseif head == :foreigncall || head == :cfunction
322
324
return evaluate_foreigncall! (stack, frame, node, pc)
323
325
elseif head == :copyast
324
326
val = (node. args[1 ]:: QuoteNode ). value
0 commit comments