yambar/plugin.h
Daniel Eklöf bc62843c91 modules: get rid of struct module_info
Since this struct only contained function pointers, make all modules
export those functions directly.

The plugin manager now defines a module interface struct, and fills it
it by dlsym:ing the functions that used to be in module_info.
2019-01-13 17:09:11 +01:00

40 lines
1,005 B
C

#pragma once
#include "config-verify.h"
#include "module.h"
#include "particle.h"
struct module_iface {
bool (*verify_conf)(keychain_t *chain, const struct yml_node *node);
struct module *(*from_conf)(
const struct yml_node *node, struct conf_inherit inherited);
};
struct particle_iface {
bool (*verify_conf)(keychain_t *chain, const struct yml_node *node);
struct particle *(*from_conf)(
const struct yml_node *node, struct particle *common);
};
const struct module_iface *plugin_load_module(const char *name);
const struct particle_iface *plugin_load_particle(const char *name);
enum plugin_type { PLUGIN_MODULE, PLUGIN_PARTICLE };
struct plugin {
char *name;
enum plugin_type type;
void *lib;
union {
struct {
void *sym1;
void *sym2;
} dummy;
struct module_iface module;
struct particle_iface particle;
};
};
const struct plugin *plugin_load(const char *name, enum plugin_type type);