17 files changed
+451
-421
No files matched your search
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
#include <Mod/Context.hpp>
|
||||
#include <Mods/Loaded.hpp>
|
||||
#include <Mods/Registry.hpp>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace vl::mod {
|
||||
|
||||
// Handles dlopen/dlsym, discovers mod registrations, constructs mods (C2)
|
||||
class ModLoader {
|
||||
public:
|
||||
// Load a module (.so), discover CRTP-registered mod types, instantiate each with Context.
|
||||
// Returns the number of instances created from this module.
|
||||
std::size_t loadModule(const std::string& path, const Context& ctx);
|
||||
|
||||
// Start/stop all currently loaded instances.
|
||||
void startAll();
|
||||
void stopAll();
|
||||
|
||||
// Unload everything (calls stopAll first if not stopped).
|
||||
void unloadAll();
|
||||
|
||||
const std::vector<LoadedMod>& instances() const noexcept { return instances_; }
|
||||
|
||||
private:
|
||||
std::vector<void*> handles_;
|
||||
std::vector<LoadedMod> instances_;
|
||||
};
|
||||
|
||||
} // namespace vl::log
|
||||
Reference in new issue
Block a user