Skip to content

Commit d295d35

Browse files
pemryanKristofferC
authored andcommitted
@cfunction: swap at, rt (#33267)
swap at (types of arguments) and rt (return value type).
1 parent 3e8f257 commit d295d35

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

base/c.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,20 @@ julia> @cfunction(foo, Int, (Int, Int))
6161
Ptr{Cvoid} @0x000000001b82fcd0
6262
```
6363
"""
64-
macro cfunction(f, at, rt)
65-
if !(isa(rt, Expr) && rt.head === :tuple)
64+
macro cfunction(f, rt, at)
65+
if !(isa(at, Expr) && at.head === :tuple)
6666
throw(ArgumentError("@cfunction argument types must be a literal tuple"))
6767
end
68-
rt.head = :call
69-
pushfirst!(rt.args, GlobalRef(Core, :svec))
68+
at.head = :call
69+
pushfirst!(at.args, GlobalRef(Core, :svec))
7070
if isa(f, Expr) && f.head === :$
7171
fptr = f.args[1]
7272
typ = CFunction
7373
else
7474
fptr = QuoteNode(f)
7575
typ = Ptr{Cvoid}
7676
end
77-
cfun = Expr(:cfunction, typ, fptr, at, rt, QuoteNode(:ccall))
77+
cfun = Expr(:cfunction, typ, fptr, rt, at, QuoteNode(:ccall))
7878
return esc(cfun)
7979
end
8080

0 commit comments

Comments
 (0)