You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#26486 introduced a struct CFunction in Base that is returned by @cfunction for interpolated function arguments:
julia>@cfunction$sin Float64 (Float64,)
Base.CFunction(Ptr{Nothing} @0x0000000116262a90, sin, Ptr{Nothing} @0x0000000000000000, Ptr{Nothing} @0x0000000000000000)
Although this type is user-visible, it is currently undocumented (both in the @cfunction docs and because it lacks a docstring).
CFunction has an unsafe_convert method to Ptr{Cvoid}, so it can be passed as a callback argument. (But CFunction doesn't work with ccall!) But users still need to know about the type — e.g. in PyCall I have to store it in a struct.
(Should this type be exported?)
The text was updated successfully, but these errors were encountered:
But users still need to know about the type — e.g. in PyCall I have to store it in a struct.
(Should this type be exported?)
I think I should make it a subtype of Ref{Cvoid} – that's typically the expected annotation for most of these ccall-related APIs. Note though that if python provides a void *env-type argument, it's much more efficient to use that argument for its intended purpose (much as you would have done in the past), rather than to ignore the argument and use the dynamic closures (as provided by $ and struct CFunction).
#26486 introduced a
struct CFunction
in Base that is returned by@cfunction
for interpolated function arguments:Although this type is user-visible, it is currently undocumented (both in the
@cfunction
docs and because it lacks a docstring).CFunction
has anunsafe_convert
method toPtr{Cvoid}
, so it can be passed as a callback argument. (ButCFunction
doesn't work withccall
!) But users still need to know about the type — e.g. in PyCall I have to store it in a struct.(Should this type be exported?)
The text was updated successfully, but these errors were encountered: