static int load_module_exports(struct obs_module *mod, const char *path)
{
	mod->load = os_dlsym(mod->module, "obs_module_load");
	if (!mod->load)
		return req_func_not_found("obs_module_load", path);

	mod->set_pointer = os_dlsym(mod->module, "obs_module_set_pointer");
	if (!mod->set_pointer)
		return req_func_not_found("obs_module_set_pointer", path);

	mod->ver = os_dlsym(mod->module, "obs_module_ver");
	if (!mod->ver)
		return req_func_not_found("obs_module_ver", path);

	/* optional exports */
	mod->unload      = os_dlsym(mod->module, "obs_module_unload");
	mod->set_locale  = os_dlsym(mod->module, "obs_module_set_locale");
	mod->free_locale = os_dlsym(mod->module, "obs_module_free_locale");
	mod->name        = os_dlsym(mod->module, "obs_module_name");
	mod->description = os_dlsym(mod->module, "obs_module_description");
	mod->author      = os_dlsym(mod->module, "obs_module_author");
	return MODULE_SUCCESS;
}
Exemple #2
0
static int call_module_load(void *module, const char *path)
{
	bool   (*obs_module_load)(uint32_t obs_ver)  = NULL;

	obs_module_load = os_dlsym(module, "obs_module_load");
	if (!obs_module_load)
		return req_func_not_found("obs_module_load", path);

	if (!obs_module_load(LIBOBS_API_VER)) {
		blog(LOG_ERROR, "Module '%s' failed to load: "
		                "obs_module_load failed", path);
		return MODULE_ERROR;
	}

	return MODULE_SUCCESS;
}