#pragma once #include #include #include #include #include #include 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, bool isGlobal); // Start/stop all currently loaded instances. void startAll(); void stopAll(); // Unload everything (calls stopAll first if not stopped). void unloadAll(); const std::vector& instances() const noexcept { return instances_; } private: std::vector handles_; std::vector instances_; }; } // namespace vl::log