mirror of
https://github.com/debauchee/barrier.git
synced 2026-07-26 16:21:15 +08:00
added plugin unload and cleanup #4313
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
typedef void (*initFunc)(void*, void*);
|
||||
typedef int (*initEventFunc)(void (*sendEvent)(const char*, void*));
|
||||
typedef void* (*invokeFunc)(const char*, void**);
|
||||
typedef void (*cleanupFunc)();
|
||||
|
||||
void* g_eventTarget = NULL;
|
||||
IEventQueue* g_events = NULL;
|
||||
@@ -68,6 +69,20 @@ ArchPluginWindows::load()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ArchPluginWindows::unload()
|
||||
{
|
||||
PluginTable::iterator it;
|
||||
HINSTANCE lib;
|
||||
for (it = m_pluginTable.begin(); it != m_pluginTable.end(); it++) {
|
||||
lib = reinterpret_cast<HINSTANCE>(it->second);
|
||||
cleanupFunc cleanup = (cleanupFunc)GetProcAddress(lib, "cleanup");
|
||||
cleanup();
|
||||
LOG((CLOG_DEBUG "unloading plugin: %s", it->first.c_str()));
|
||||
FreeLibrary(lib);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ArchPluginWindows::init(void* log, void* arch)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user