30#ifndef AWE_PLUGIN_LOADER_H
31#define AWE_PLUGIN_LOADER_H
45#ifndef AWE_PLUGIN_LOADER_MAX_PATH_LENGTH
49#define AWE_PLUGIN_LOADER_MAX_PATH_LENGTH (1024)
62 void* (*malloc)(
size_t size);
63 void* (*realloc)(
void* ptr,
size_t size);
65 void* (*open)(
const char* file);
67 void* (*sym)(
void* handle,
const char* name);
68 void (*
vlog)(int32_t level, uint32_t type,
const char* fmt, va_list args);
AudioWeaver Plugin Types.
struct _awe_PluginLoaderMethods awe_PluginLoaderMethods
Method table to provide overrides to awe_PluginLoader_initWithMethods.
enum awe_PluginLoader_Status awe_PluginLoader_load(const AWEPlugin **plugin, const char *file)
Load a plugin library.
Definition PluginLoader.c:588
size_t awe_PluginLoader_count()
Get the number of currently loaded plugins.
Definition PluginLoader.c:645
awe_PluginLoader_Status
Possible statuses which may be returned by plugin loader API functions.
Definition AWEPluginLoader.h:75
enum awe_PluginLoader_Status awe_PluginLoader_get(const AWEPlugin **plugin, size_t index)
Retrieve a loaded plugin by index.
Definition PluginLoader.c:655
enum awe_PluginLoader_Status awe_PluginLoader_find(const AWEPlugin **plugin, const char *file)
Retrieve a loaded plugin by file name.
Definition PluginLoader.c:685
enum awe_PluginLoader_Status awe_PluginLoader_loadWithEntrypoint(const AWEPlugin **plugin, const char *file, const char *entrypoint)
Load a plugin library with a custom entrypoint name.
Definition PluginLoader.c:598
enum awe_PluginLoader_Status awe_PluginLoader_init(size_t reserved_count)
Initialize the plugin loader.
Definition PluginLoader.c:531
enum awe_PluginLoader_Status awe_PluginLoader_initWithMethods(size_t reserved_count, const awe_PluginLoaderMethods *const overrides)
Initialize the plugin loader with a set of override callbacks.
Definition PluginLoader.c:492
enum awe_PluginLoader_Status awe_PluginLoader_loadWithNamespacePrefix(const AWEPlugin **plugin, const char *file, const char *prefix)
Load a plugin library with a namespaced entrypoint name.
Definition PluginLoader.c:593
enum awe_PluginLoader_Status awe_PluginLoader_unload(const char *file)
Unload a plugin library.
Definition PluginLoader.c:603
void awe_PluginLoader_free()
Clean up the plugin loader.
Definition PluginLoader.c:724
const char * awe_PluginLoader_statusToString(const enum awe_PluginLoader_Status status)
Get a description of the given status.
Definition PluginLoader.c:739
@ AWE_PLUGIN_LOADER_DL_OPEN_FAILED
Failed to open the dynamic library.
Definition AWEPluginLoader.h:82
@ AWE_PLUGIN_LOADER_UNINITIALIZED
Plugin loader is uninitialized.
Definition AWEPluginLoader.h:77
@ AWE_PLUGIN_LOADER_INVALID_INDEX
Plugin index is out of range.
Definition AWEPluginLoader.h:81
@ AWE_PLUGIN_LOADER_MISSING_METHOD
A required method is missing after applying overrides (this can happen when the library was not compi...
Definition AWEPluginLoader.h:79
@ AWE_PLUGIN_LOADER_ALREADY_INITIALIZED
Attempting to initialize the plugin loader after it has already been initialized.
Definition AWEPluginLoader.h:78
@ AWE_PLUGIN_LOADER_LIBRARY_FILE_NAME_TOO_LONG
The plugin loader was provided with a file name which is longer than AWE_PLUGIN_LOADER_MAX_PATH_LENGT...
Definition AWEPluginLoader.h:85
@ AWE_PLUGIN_LOADER_DL_INTERNAL_FAILURE
The plugin library's initialization function returned null.
Definition AWEPluginLoader.h:84
@ AWE_PLUGIN_LOADER_SUCCESS
Operation succeeded.
Definition AWEPluginLoader.h:76
@ AWE_PLUGIN_LOADER_DL_SYMBOL_NOT_FOUND
Initialization function was not found in the plugin library.
Definition AWEPluginLoader.h:83
@ AWE_PLUGIN_LOADER_ALLOCATION_FAILED
Memory allocation failed.
Definition AWEPluginLoader.h:80
Method table to provide overrides to awe_PluginLoader_initWithMethods.
Definition AWEPluginLoader.h:61
void(* vlog)(int32_t level, uint32_t type, const char *fmt, va_list args)
Handle a log message.
Definition AWEPluginLoader.h:68
void(* close)(void *handle)
Close a shared library.
Definition AWEPluginLoader.h:66
void(* free)(void *ptr)
Free memory.
Definition AWEPluginLoader.h:64
A struct encapsulating the functionality which can be provided by a plugin library.
Definition AWEPluginTypes.h:81