Revert "created new instance of arch in plugin #4313"
This reverts commit 8e4f758cb1
.
This commit is contained in:
parent
9f1255d986
commit
4014176d8e
|
@ -48,9 +48,9 @@ public:
|
|||
|
||||
//! Init the common parts
|
||||
/*!
|
||||
Initializes common parts like log.
|
||||
Initializes common parts like log and arch.
|
||||
*/
|
||||
virtual void init(void* log) = 0;
|
||||
virtual void init(void* log, void* arch) = 0;
|
||||
|
||||
//! Init the event part
|
||||
/*!
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include <dirent.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
typedef void (*initFunc)(void*);
|
||||
typedef void (*initFunc)(void*, void*);
|
||||
typedef int (*initEventFunc)(void (*sendEvent)(const char*, void*));
|
||||
typedef void* (*invokeFunc)(const char*, void*);
|
||||
typedef void (*cleanupFunc)();
|
||||
|
@ -104,13 +104,13 @@ ArchPluginUnix::unload()
|
|||
}
|
||||
|
||||
void
|
||||
ArchPluginUnix::init(void* log)
|
||||
ArchPluginUnix::init(void* log, void* arch)
|
||||
{
|
||||
PluginTable::iterator it;
|
||||
for (it = m_pluginTable.begin(); it != m_pluginTable.end(); it++) {
|
||||
initFunc initPlugin = (initFunc)dlsym(it->second, "init");
|
||||
if (initPlugin != NULL) {
|
||||
initPlugin(log);
|
||||
initPlugin(log, arch);
|
||||
}
|
||||
else {
|
||||
LOG((CLOG_DEBUG "no init function in %s", it->first.c_str()));
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
// IArchPlugin overrides
|
||||
void load();
|
||||
void unload();
|
||||
void init(void* log);
|
||||
void init(void* log, void* arch);
|
||||
void initEvent(void* eventTarget, IEventQueue* events);
|
||||
bool exists(const char* name);
|
||||
virtual void* invoke(const char* pluginName,
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <Windows.h>
|
||||
#include <iostream>
|
||||
|
||||
typedef void (*initFunc)(void*);
|
||||
typedef void (*initFunc)(void*, void*);
|
||||
typedef int (*initEventFunc)(void (*sendEvent)(const char*, void*));
|
||||
typedef void* (*invokeFunc)(const char*, void**);
|
||||
typedef void (*cleanupFunc)();
|
||||
|
@ -90,7 +90,7 @@ ArchPluginWindows::unload()
|
|||
}
|
||||
|
||||
void
|
||||
ArchPluginWindows::init(void* log)
|
||||
ArchPluginWindows::init(void* log, void* arch)
|
||||
{
|
||||
PluginTable::iterator it;
|
||||
HINSTANCE lib;
|
||||
|
@ -98,7 +98,7 @@ ArchPluginWindows::init(void* log)
|
|||
lib = reinterpret_cast<HINSTANCE>(it->second);
|
||||
initFunc initPlugin = (initFunc)GetProcAddress(lib, "init");
|
||||
if (initPlugin != NULL) {
|
||||
initPlugin(log);
|
||||
initPlugin(log, arch);
|
||||
}
|
||||
else {
|
||||
LOG((CLOG_DEBUG "no init function in %s", it->first.c_str()));
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
// IArchPlugin overrides
|
||||
void load();
|
||||
void unload();
|
||||
void init(void* log);
|
||||
void init(void* log, void* arch);
|
||||
void initEvent(void* eventTarget, IEventQueue* events);
|
||||
bool exists(const char* name);
|
||||
void* invoke(const char* pluginName,
|
||||
|
|
|
@ -32,15 +32,14 @@ Log* g_log = NULL;
|
|||
extern "C" {
|
||||
|
||||
void
|
||||
init(void* log)
|
||||
init(void* log, void* arch)
|
||||
{
|
||||
if (g_log == NULL) {
|
||||
g_log = new Log(reinterpret_cast<Log*>(log));
|
||||
}
|
||||
|
||||
if (g_arch == NULL) {
|
||||
g_arch = new Arch();
|
||||
g_arch->init();
|
||||
g_arch = new Arch(reinterpret_cast<Arch*>(arch));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,10 +100,6 @@ cleanup()
|
|||
if (g_secureListenSocket != NULL) {
|
||||
delete g_secureListenSocket;
|
||||
}
|
||||
|
||||
if (g_arch != NULL) {
|
||||
delete g_arch;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
extern "C" {
|
||||
|
||||
NS_API void init(void* log);
|
||||
NS_API void init(void* log, void* arch);
|
||||
NS_API int initEvent(void (*sendEvent)(const char*, void*));
|
||||
NS_API void* invoke(const char* command, void** args);
|
||||
NS_API void cleanup();
|
||||
|
|
Loading…
Reference in New Issue