reload lingering modules by name
This commit is contained in:
@@ -138,9 +138,20 @@ namespace Archimedes {
|
||||
return create(Get(), h);
|
||||
}
|
||||
|
||||
virtual Module* load(std::string modulePath) {
|
||||
Module* m = dynamicLoad(modulePath);
|
||||
return load(m);
|
||||
virtual Module* reload(std::string lib) {
|
||||
|
||||
for(std::string s : runOrder) {
|
||||
if(s == lib) {
|
||||
return modules[lib];
|
||||
}
|
||||
}
|
||||
|
||||
return modules.find(lib) != modules.end() ? load(modules[lib]) : nullptr;
|
||||
}
|
||||
|
||||
virtual Module* load(std::string moduleNameOrPath) {
|
||||
Module* m = reload(moduleNameOrPath);
|
||||
return m != nullptr ? m : dynamicLoad(moduleNameOrPath);
|
||||
}
|
||||
|
||||
virtual Module* load(Module* m) {
|
||||
@@ -157,11 +168,12 @@ namespace Archimedes {
|
||||
if(h) {
|
||||
dlclose(h);
|
||||
}
|
||||
return nullptr;
|
||||
return modules[*it];
|
||||
}
|
||||
}
|
||||
|
||||
modules[*m] = m;
|
||||
if(modules.find(*m) == modules.end())
|
||||
modules[*m] = m;
|
||||
|
||||
for(auto it = runOrder.begin(); it != runOrder.end(); it++) {
|
||||
|
||||
|
||||
@@ -25,13 +25,13 @@ namespace Archimedes {
|
||||
|
||||
virtual void run() {}
|
||||
virtual bool onEvent(const Event& e) { return false; }
|
||||
virtual void onLoad() {};
|
||||
|
||||
virtual void onLoad() {}
|
||||
virtual void onUnload() {}
|
||||
|
||||
operator std::string() const { return name; }
|
||||
void* getHandle() { return handle; }
|
||||
|
||||
//std::any getData(std::string s) { return data[s.c_str()]; };
|
||||
|
||||
protected:
|
||||
std::string name;
|
||||
|
||||
@@ -42,7 +42,6 @@ namespace Archimedes {
|
||||
std::unordered_map<std::string, std::variant<std::string, Module*>> exts;
|
||||
std::unordered_map<std::string, Module*> moduleInstances;
|
||||
|
||||
//std::unordered_map<std::string, std::any> data;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,9 @@ Ollama::~Ollama() {
|
||||
curl = nullptr;
|
||||
}
|
||||
curl_global_cleanup();
|
||||
|
||||
ImguiModule* im; { im = (ImguiModule*) moduleInstances[ImguiModule()]; }
|
||||
im->releaseContext(ImGui::GetCurrentContext());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +39,7 @@ void Ollama::onLoad() {
|
||||
std::abort();
|
||||
}
|
||||
|
||||
ImGui::SetCurrentContext(im->getContext());
|
||||
ImGui::SetCurrentContext(im->aquireContext());
|
||||
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
curl = curl_easy_init();
|
||||
|
||||
Reference in New Issue
Block a user