Expand description
The native C ABI (internal/pluginhost/loader_unix.go, host_callbacks_unix.go).
typedef struct { void* ptr; size_t len; } cliproxy_buffer;
typedef struct { uint32_t abi_version; void* host_ctx; host_call_fn call; host_free_fn free_buffer; } cliproxy_host_api;
typedef struct { uint32_t abi_version; plugin_call_fn call; plugin_free_fn free_buffer; plugin_shutdown_fn shutdown; } cliproxy_plugin_api;
int cliproxy_plugin_init(const cliproxy_host_api*, cliproxy_plugin_api*);Memory ownership matches Go: the host owns request buffers for the duration of a
call; a response buffer belongs to whoever allocated it and is released through that
side’s free_buffer. Host callback responses are malloced and freed with free.
The host API table and the host_ctx slot are malloced, stay valid after shutdown
(plugins keep the pointer), and host_ctx holds a numeric ID resolved through a
global table, so a stale context can never reach a dropped host. As in Go v8.0.35,
loaded images and their C callback tables stay resident even after failed init;
shutdown removes their callback registrations, not the memory a runtime may retain.
Structs§
- Buffer
cliproxy_buffer.- HostApi
cliproxy_host_api.- Native
Client - A loaded plugin library speaking ABI 1.
- Plugin
Api cliproxy_plugin_api.