Skip to main content

Crate palladium_plugin_api

Crate palladium_plugin_api 

Source
Expand description

C ABI type definitions for the Palladium plugin system.

This crate is intentionally dependency-free. All types are #[repr(C)] and safe to expose across shared library (cdylib) and WASM boundaries.

Plugin authors implement the required C exports; the engine host reads plugin metadata and calls actor lifecycle functions through these types.

§Required exports (every plugin shared library)

PdPluginInfo* pd_plugin_init(void);
void          pd_plugin_shutdown(void);

void*   pd_actor_create (const char* type_name, uint32_t type_name_len,
                         const uint8_t* config,  uint32_t config_len);
void    pd_actor_destroy(void* actor);
int32_t pd_actor_on_start  (void* actor, PdActorContext* ctx);
int32_t pd_actor_on_message(void* actor, PdActorContext* ctx,
                            const uint8_t* envelope_bytes,
                            const uint8_t* payload, uint32_t payload_len);
void    pd_actor_on_stop   (void* actor, PdActorContext* ctx, int32_t reason);

Structs§

PdActorContext
Per-call context passed to every plugin actor lifecycle hook.
PdActorTypeInfo
Metadata for a single actor type exported by a plugin.
PdEnvelope
Fixed-size C-compatible message header passed to plugin lifecycle hooks.
PdHostVtable
Engine capabilities made available to plugin actors during lifecycle calls.
PdPluginInfo
Top-level plugin metadata returned by the pd_plugin_init export.

Enums§

PdError
Return codes for plugin actor lifecycle functions.

Constants§

ENVELOPE_SIZE
Expected byte size of PdEnvelope (matches palladium_actor::Envelope::SIZE).
FLAG_PRIORITY_MASK
Mask for the 2-bit priority field (bits 1–2); higher value = higher priority.
FLAG_RESPONSE
Flag bit: this message is a response to a previous request.
PD_ABI_VERSION
ABI version that every plugin and the engine must agree on at load time.