added plugin unload and cleanup #4313

This commit is contained in:
XinyuHou
2015-01-27 10:42:10 +00:00
parent 10cddb97a8
commit 85813fd49b
16 changed files with 86 additions and 19 deletions

View File

@@ -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)
{