A tiny detail, but I wonder, for what the “at” and “rt” argument names stand in the cfunction macro?
From the help (@cfunction(callable, ReturnType, (ArgumentTypes...,)) -> Ptr{Cvoid}
…) I would have thought “argument type” and “return type”, but from the code (which I don’t fully understand) it seems to be switched.
Here is the commit where the code changed
- cfunction(f, r, a) = ccall(:jl_function_ptr, Ptr{Cvoid}, (Any, Any, Any), f, r, a)
+ macro cfunction(f, at, rt)
if !(isa(rt, Expr) && rt.head === :tuple)
throw(ArgumentError("@cfunction argument types must be a literal tuple"))
end
rt.head = :call
...
cfun = Expr(:cfunction, typ, fptr, at, rt, QuoteNode(:ccall))
...