37 throw Exception(
"plugins.load: empty path");
38 if (loaded_.count(path))
42 HMODULE mod = LoadLibraryA(path.c_str());
44 throw Exception(
"plugins.load: LoadLibrary failed for '%s' (err=%lu)", path.c_str(),
46 auto init =
reinterpret_cast<PluginInitFn>(GetProcAddress(mod,
"eve_plugin_init"));
49 throw Exception(
"plugins.load: missing eve_plugin_init in '%s'", path.c_str());
54 throw Exception(
"plugins.load: eve_plugin_init returned %d for '%s'", rc, path.c_str());
56 loaded_[path] = Handle{mod, path};
58 void* mod = dlopen(path.c_str(), RTLD_NOW | RTLD_GLOBAL);
60 throw Exception(
"plugins.load: dlopen failed for '%s': %s", path.c_str(), dlerror());
62 auto init =
reinterpret_cast<PluginInitFn>(dlsym(mod,
"eve_plugin_init"));
63 const char* err = dlerror();
64 if (err !=
nullptr || !init) {
66 throw Exception(
"plugins.load: missing eve_plugin_init in '%s'%s%s", path.c_str(),
67 err ?
": " :
"", err ? err :
"");
72 throw Exception(
"plugins.load: eve_plugin_init returned %d for '%s'", rc, path.c_str());
74 loaded_[path] = Handle{mod, path};
78 throw Exception(
"plugins.load: expose_pending failed after loading '%s'", path.c_str());