allow static dependencies

This commit is contained in:
2025-03-30 12:01:49 -05:00
parent 6de0e30313
commit a7b809d538
6 changed files with 12 additions and 4 deletions

View File

@@ -6,6 +6,7 @@
#include <list> #include <list>
#include <array> #include <array>
#include <vector> #include <vector>
#include <variant>
#include <unordered_map> #include <unordered_map>
#include <optional> #include <optional>

View File

@@ -76,7 +76,7 @@ namespace Archimedes {
skip = false; skip = false;
continue; continue;
} else { } else {
load(dynamicLoad(it->second), blacklist); load(it->second, blacklist);
} }
} }
@@ -88,6 +88,12 @@ namespace Archimedes {
return true; return true;
} }
bool App::load(std::string modulePath, std::list<std::string> blacklist = {}) {
Module* m = dynamicLoad(modulePath);
return load(m, blacklist);
}
void App::unload(std::list<Module*>::iterator it) { void App::unload(std::list<Module*>::iterator it) {
Module* m = *it; Module* m = *it;

View File

@@ -18,6 +18,7 @@ namespace Archimedes {
std::list<std::string> toOpen; std::list<std::string> toOpen;
Module* dynamicLoad(std::string); Module* dynamicLoad(std::string);
virtual bool load(std::string, std::list<std::string>);
virtual bool load(Module*, std::list<std::string>); virtual bool load(Module*, std::list<std::string>);
virtual void unload(std::list<Module*>::iterator); virtual void unload(std::list<Module*>::iterator);

View File

@@ -34,7 +34,7 @@ namespace Archimedes {
App* app; App* app;
std::unordered_map<std::string, std::string> deps; std::unordered_map<std::string, std::variant<std::string, Archimedes::Module*>> deps;
}; };
} }

View File

@@ -18,7 +18,7 @@ void ImguiEmbed::run() {
toClose.clear(); toClose.clear();
for(std::string s : toOpen) { for(std::string s : toOpen) {
load(dynamicLoad(s), getBlacklist()); load(s, getBlacklist());
} }
toOpen.clear(); toOpen.clear();
} }

View File

@@ -18,7 +18,7 @@ void MinimalApp::run() {
toClose.clear(); toClose.clear();
for(std::string s : toOpen) { for(std::string s : toOpen) {
load(dynamicLoad(s), getBlacklist()); load(s, getBlacklist());
} }
toOpen.clear(); toOpen.clear();
} }