10 files changed
+169
-10
No files matched your search
+5
-3
@@ -1,4 +1,6 @@
|
||||
#include <Mods/LoadLibrary.hpp>
|
||||
#include <Mods/Loader.hpp>
|
||||
#include <Mods/LoadLibrary.hpp>
|
||||
#include <Agent.hpp>
|
||||
#include <dlfcn.h>
|
||||
#include <iostream>
|
||||
@@ -6,8 +8,8 @@
|
||||
|
||||
namespace vl::mod {
|
||||
|
||||
std::size_t ModLoader::loadModule(const std::string& path, const Context& ctx) {
|
||||
void* handle = dlopen(path.c_str(), RTLD_NOW | RTLD_GLOBAL);
|
||||
std::size_t ModLoader::loadModule(const std::string& path, const Context& ctx, bool isGlobal) {
|
||||
void* handle = LoadLibrary(path, isGlobal);
|
||||
if (!handle) throw std::runtime_error(std::string("dlopen failed: ") + dlerror());
|
||||
handles_.push_back(handle);
|
||||
|
||||
@@ -48,7 +50,7 @@ void ModLoader::stopAll() {
|
||||
void ModLoader::unloadAll() {
|
||||
stopAll();
|
||||
instances_.clear();
|
||||
for (auto* h : handles_) if (h) dlclose(h);
|
||||
for (auto* h : handles_) if (h) CloseLibrary(h);
|
||||
handles_.clear();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user