Creating a Plugin
Module: AudioWeaver Plugins
Using the AudioWeaver Plugin API to create a dynamically loadable list of modules. More...
Functions
| Name | |
|---|---|
| const AWEPlugin * | AWEPlugin_initialize(const awe_PluginCallbacks * methods) AWEPlugin entrypoint method. |
Detailed Description
Using the AudioWeaver Plugin API to create a dynamically loadable list of modules.
Plugins will typically be created as follows.
#include "Framework.h"
#include "ModulePackAweStandard.h"
#include "AWEPlugin.h"
static const ModClassModule *PLUGIN_MODULES[] = { LISTOFCLASSOBJECTS };
static const AWEPlugin ModulePackAweStandardPlugin = {
.apiVersion = AWE_PLUGIN_API_VERSION,
.pluginVersion = NULL,
.name = "ModulePackAweStandard",
.modules = {
.count = sizeof(PLUGIN_MODULES) / sizeof(PLUGIN_MODULES[0]),
.array = PLUGIN_MODULES,
},
.cleanup = NULL,
};
const AWEPlugin *AWEPlugin_initialize(const awe_PluginCallbacks *callbacks)
{
const AWEPlugin *plugin = NULL;
if ((callbacks != NULL) && callbacks->checkApiVersion(AWE_PLUGIN_API_VERSION))
{
plugin = &ModulePackAweStandardPlugin;
}
return plugin;
}
In this example, the plugin struct is a static variable, but it can also be allocated dynamically. In that case, the memory should be freed in the plugin's cleanup function.
For information on how to load these plugins, see Loading a Plugin.
Functions Documentation
function AWEPlugin_initialize
const AWEPlugin * AWEPlugin_initialize(
const awe_PluginCallbacks * methods
)
AWEPlugin entrypoint method.
Parameters:
- methods Callbacks which the plugin entrypoint method may use during initialization.
See: awe_PluginCallbacks
A valid AWE Plugin must implement this method with external linkage. The loader will call it after opening the dynamic library to initialize the plugin. The loader takes ownership of the returned pointer in the sense that it will call its cleanup method when the loader's internal plugin list is freed, however it will not actually call free on the returned pointer directly. This is because many plugins will not need to dynamically allocate their AWEPlugin struct.
Updated on 2026-02-10 at 15:44:29 -0500