fix unload
This commit is contained in:
@@ -71,10 +71,10 @@ void App::load(std::string lib) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
modules.push_back(m);
|
modules.push_back(m);
|
||||||
m->setSelf(modules.rbegin());
|
m->setSelf(modules.rbegin().base());
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::unload(std::list<Module*>::iterator it) {
|
void App::unload(decltype(Module::self) it) {
|
||||||
void* handle = (*it)->getHandle();
|
void* handle = (*it)->getHandle();
|
||||||
delete *it;
|
delete *it;
|
||||||
dlclose(handle);
|
dlclose(handle);
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class App {
|
|||||||
|
|
||||||
void load(std::string);
|
void load(std::string);
|
||||||
|
|
||||||
void unload(std::list<Module*>::iterator);
|
void unload(decltype(Module::self));
|
||||||
|
|
||||||
void handleArgs(const int&, char*[]);
|
void handleArgs(const int&, char*[]);
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ class App;
|
|||||||
|
|
||||||
class Module {
|
class Module {
|
||||||
|
|
||||||
|
friend class App;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef Module* create_t(void*, App&);
|
typedef Module* create_t(void*, App&);
|
||||||
typedef void* destroy_t(Module*);
|
typedef void* destroy_t(Module*);
|
||||||
@@ -17,12 +19,12 @@ class Module {
|
|||||||
std::string getName() const { return name; }
|
std::string getName() const { return name; }
|
||||||
void* getHandle() { return handle; }
|
void* getHandle() { return handle; }
|
||||||
|
|
||||||
void setSelf(std::list<Module*>::reverse_iterator s) { self = s; }
|
void setSelf(std::list<Module*>::iterator s) { self = s; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string name;
|
std::string name;
|
||||||
void* handle;
|
void* handle;
|
||||||
std::list<Module*>::reverse_iterator self;
|
std::list<Module*>::iterator self;
|
||||||
|
|
||||||
App& app;
|
App& app;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user