Several c libraries like ONNX, primarily use structs of function pointers which then get translated to Ptr{Cvoid} eg
struct OrtCustomOp
version::UInt32
CreateKernel::Ptr{Cvoid}
GetName::Ptr{Cvoid}
GetExecutionProviderType::Ptr{Cvoid}
GetInputType::Ptr{Cvoid}
GetInputTypeCount::Ptr{Cvoid}
etc
end
It would be great if wrappers could be automatically created for the function ptr fields to make them easier to call eg
CreateKernel(ort_custom_op::OrtCustomOp, session_OrtCustomOpoptions, kernel_info, kernel) = @ccall $(ort_custom_op.CreateKernel)(session_options::Ptr{OrtSessionOptions}, kernel_info::Ptr{OrtKernelInfo}, kernel::Ptr{Ptr{OrtKernel}})::OrtStatusPtr
GetName(ort_custom_op::OrtCustomOp, op) = @ccall $(ort_custom_op.GetName)(op::Ptr{OrtCustomOp} )::Cwstring
GetExecutionProviderType(ort_custom_op::OrtCustomOp, op) = @ccall $(ort_custom_op.GetExecutionProviderType)(op::Ptr{OrtCustomOp})::Cwstring
etc