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
The type annotation in notation_fn is not necessary, but I do find it helps with these long signature.
I was thinking of defining a custom struct, but that requires @cfunction($) and that is not fully supported everywhere.
So maybe a macro that makes the cfunction easier?
The text was updated successfully, but these errors were encountered:
Since the function signature that @cfunction needs is very tedious to write, I think we can export the Cvoid, (Csize_t, PMIx.API.pmix_status_t, Ptr{PMIx.API.pmix_proc_t}, Ptr{PMIx.API.pmix_info_t}, Csize_t, Ptr{PMIx.API.pmix_info_t}, Csize_t, Ptr{PMIx.API.pmix_event_notification_cbfunc_fn_t}, Ptr{Cvoid}) part as some constant pmix_event_notification_cbfunc_fn_t_signature, then we can write
julia> function foo_callback(x::Csize_t)::Cint
__impl_foo_callback(x)
end
foo_callback (generic function with 1 method)
julia> cb = @cfunction(foo_callback, Cint, (Csize_t,)) # this should be generated in `__init__()`
Ptr{Nothing} @0x0000000111e59180
julia> ccall(cb, Cint, (Csize_t,), 0)
ERROR: UndefVarError: __impl_foo_callback not defined
Stacktrace:
[1] foo_callback(x::UInt64)
@ Main ./REPL[1]:2
[2] top-level scope
@ ./REPL[3]:1
julia> __impl_foo_callback(x) = x + 1
__impl_foo_callback (generic function with 1 method)
julia> ccall(cb, Cint, (Csize_t,), 0)
1
In this way, users can define __impl_foo_callback without annotating argument types.
Right now we are generating:
And I find myself writing:
The type annotation in
notation_fn
is not necessary, but I do find it helps with these long signature.I was thinking of defining a custom struct, but that requires
@cfunction($)
and that is not fully supported everywhere.So maybe a macro that makes the cfunction easier?
The text was updated successfully, but these errors were encountered: