Helios Engine 0.1.0
A modular ECS based data-oriented C++23 game engine
 
Loading...
Searching...
No Matches
Library

Wrapper for dynamically loaded modules.

Wrapper for dynamically loaded modules. Loads a module from a shared library and manages its lifecycle. Supports hot-reloading: when the library file changes, the module can be unloaded and reloaded without restarting the application.

The dynamic library must export:

Note
Not thread-safe. External synchronization required for concurrent access.

implementation:

// In my_module.cpp (compiled as shared library)
class MyModule : public helios::app::Module {
public:
static constexpr std::string_view GetName() noexcept { return "MyModule"; }
void Build(App& app) override { ... }
void Destroy(App& app) override { ... }
};
extern "C" {
HELIOS_EXPORT helios::app::Module* helios_create_module() {
return new MyModule();
}
return helios::app::ModuleTypeIdOf<MyModule>();
}
HELIOS_EXPORT const char* helios_module_name() {
return "MyModule";
}
}
Base class for all modules.
Definition module.hpp:25
virtual void Destroy(App &app)
Destroys the module and cleans up resources.
Definition module.hpp:42
virtual void Build(App &app)=0
Builds the module.
#define HELIOS_EXPORT
Definition core.hpp:25
size_t ModuleTypeId
Definition module.hpp:84