Skip to main content

Module abi

Module abi 

Source
Expand description

Audio-plugin ABI version encoding and compatibility rules.

Every plugin cdylib must expose two extern "C" symbols describing its ABI contract with the host:

  • audio_plugin_abi_magic() -> u32 — must equal AUDIO_PLUGIN_ABI_MAGIC (0x41504C47, ASCII "APLG").
  • audio_plugin_abi_version() -> u32 — a version word encoded with encode_abi_version: the upper 16 bits are the major version, the lower 16 bits are the minor version.

§Compatibility

A plugin is ABI-compatible with the host when both hold:

  1. its magic equals AUDIO_PLUGIN_ABI_MAGIC, and
  2. its version major equals the host major (see is_abi_compatible).

The minor version may differ: minor is reserved for additive, backwards-compatible changes (new optional entry symbols, new metadata fields). A major bump is a breaking change and the host will refuse to load the plugin.

The magic is a separate symbol from the version word, so the loader checks it independently — compare the plugin’s audio_plugin_abi_magic() return value against AUDIO_PLUGIN_ABI_MAGIC.

Structs§

AbiVersion
A typed, validated wrapper around an encoded ABI version word.

Constants§

AUDIO_PLUGIN_ABI_MAGIC
Magic word every plugin must return from audio_plugin_abi_magic().
AUDIO_PLUGIN_ABI_VERSION
ABI version exposed by this host: 1.0.

Functions§

abi_major
Decode the major component (upper 16 bits) of an encoded ABI version word.
abi_minor
Decode the minor component (lower 16 bits) of an encoded ABI version word.
encode_abi_version
Encode a (major, minor) pair into a single ABI version word.
is_abi_compatible
Return true when host_version and plugin_version are ABI-compatible, i.e. their major components are equal.