class

FModuleManager

Module
Core
Header
#include "Core/FModuleManager.h"
Namespace
Mowo

Type aliases

AliasDescription
using FUnloadHandler = void (*)(void* moduleHandle)Module-unload broadcast: fired from UnloadModule after the module's own ShutdownModule hook and BEFORE the image is freed, so a handler can still touch code and data inside the dying module. This is how the additive registries (scene systems, reflection descriptors, online services, asset validators, net-session providers) drop function pointers that would otherwise keep pointing into freed pages. Handlers are process-lifetime plain function pointers from never-unloaded engine modules; duplicates are ignored.
using FModuleVerifier = bool (*)(const std::string& resolvedPath, void* image, std::string& outReason)Verify-before-load gate. The ABI check in LoadModuleFromPath only runs AFTER LoadLibrary has already executed the image's static init (DllMain), so a hostile or wrong module gets to run code before it is (maybe) refused. A higher tier — one that can reach the EdDSA/hash crypto in Filesystem — registers a verifier here; the loader calls it on the resolved binary PATH *before* the image is mapped, and a false result refuses the load with the image never touched. With no verifier registered the loader behaves exactly as before (unsigned local/dev modules load), so this is opt-in hardening a shipping host arms. One verifier, process-lifetime; the last registration wins. outReason is logged on refusal. A distribution build also checks every engine library against the engine's signed statement before this verifier runs (Core/ModuleIntegrity.h), whether or not one is registered. image is the IPlatformLibrary::OpenImageForLoad handle the loader holds from before the verifier runs until after the image is mapped: the verifier reads the bytes through it (IPlatformLibrary::ReadImage), so what it vouches for is what gets mapped. The module's imports that are files the game ships, not yet mapped, are held and verified the same way before the load — an unsigned DLL beside a signed plugin would otherwise come in as its dependency, without ever passing the gate.

Constructors

SignatureNameDescription
FModuleManager(const FModuleManager&) = deleteFModuleManager

Public functions

ReturnsNameDescription
FModuleManager&Get
FModuleManager&operator=
voidAddUnloadHandler
voidSetModuleVerifier
boolHasModuleVerifier
boolOwnsAddressTrue when address lies inside the loaded image handle refers to — the attribution primitive the unload handlers filter with (same Platform query FMObjectArray::PurgeModuleObjects uses on vtables).
boolLoadModuleLoad name from the executable's directory — the newest versioned binary when one exists, else <name>.dll.
boolLoadModuleFromPathLoad a specific binary path under a module name (hot reload hands the freshly-built versioned file directly).
std::stringGetLoadFailureWhy the last attempt to load name failed, in a sentence a person can act on: the missing file or dependency DLL, both build ids of a mismatch, the OS's own error text.
voidNoteLoadFailureRecords a reason a host knows before it ever calls LoadModule (the binary is not built), so GetLoadFailures and the Play error can report it.
voidSetProjectSourceDirThe project whose game modules the failures belong to: its Source/ folder is what an out-of-tree build needs as --extra-source.
voidClearLoadFailures
std::vector<std::string>OrderByImportsmodules ordered so a module that imports another's binary comes after it, so the dependency's InitializeModule has run when the dependent's does.
std::stringBuildCommandThe one spelling of "build this module" every refusal quotes.
std::vector<std::pair<std::string, std::string>>GetLoadFailuresEvery module whose last load failed, as (name, reason).
uint32_tModuleApiVersionThe version the loader compares against; a module exports the same number through MOWO_IMPLEMENT_MODULE_API_VERSION().
const char*BuildAbiThe engine's own MOWO_BUILD_ABI_SIGNATURE, as compiled into Core.
std::stringCompatibilityProblemWhy a module with these exports may not load, or empty when it may.
boolIsEngineOwnedModuleEngine runtime modules ("MowoEngine.<Name>") ship with the loader and need no version export; every other module (plugin, game, sandbox) must carry one or is refused.
boolUnloadModuleCalls the optional ShutdownModule export, then frees the library.
boolIsModuleLoaded
void*GetModuleHandleNative handle (HMODULE / dlopen handle) as void*.
std::stringFindModuleBinaryPath of the binary LoadModule would pick for name right now: the highest <name>.v<N>.dll in the executable directory, else <name>.dll, else empty when neither exists.

Function details

FModuleManager

C++
FModuleManager(const FModuleManager&) = delete

Get

C++
static FModuleManager& Get()

operator=

C++
FModuleManager& operator=(const FModuleManager&) = delete

AddUnloadHandler

C++
static void AddUnloadHandler(FUnloadHandler handler)

SetModuleVerifier

C++
static void SetModuleVerifier(FModuleVerifier verifier)

HasModuleVerifier

C++
static bool HasModuleVerifier()

OwnsAddress

C++
static bool OwnsAddress(void* moduleHandle, const void* address)

True when address lies inside the loaded image handle refers to — the attribution primitive the unload handlers filter with (same Platform query FMObjectArray::PurgeModuleObjects uses on vtables).

LoadModule

C++
bool LoadModule(const std::string& name)

Load name from the executable's directory — the newest versioned binary when one exists, else <name>.dll. Loading an already-loaded module is a no-op returning true. Calls the optional InitializeModule export.

LoadModuleFromPath

C++
bool LoadModuleFromPath(const std::string& name, const std::string& path)

Load a specific binary path under a module name (hot reload hands the freshly-built versioned file directly). A binary whose MowoModuleApiVersion export is missing or differs from MOWO_MODULE_API_VERSION is refused: its static registrations are swept back out and the image is freed before this returns false.

GetLoadFailure

C++
std::string GetLoadFailure(const std::string& name) const

Why the last attempt to load name failed, in a sentence a person can act on: the missing file or dependency DLL, both build ids of a mismatch, the OS's own error text. Empty when the last attempt succeeded or none was made. The same text goes to stderr; this is how a host with a log (the editor's Output Log) reports it too.

NoteLoadFailure

C++
void NoteLoadFailure(const std::string& name, const std::string& reason)

Records a reason a host knows before it ever calls LoadModule (the binary is not built), so GetLoadFailures and the Play error can report it.

SetProjectSourceDir

C++
void SetProjectSourceDir(const std::string& dir)

The project whose game modules the failures belong to: its Source/ folder is what an out-of-tree build needs as --extra-source. ClearLoadFailures runs when a project opens so one project's failures never read as another's.

ClearLoadFailures

C++
void ClearLoadFailures()

OrderByImports

C++
std::vector<std::string> OrderByImports(const std::vector<std::string>& modules) const

modules ordered so a module that imports another's binary comes after it, so the dependency's InitializeModule has run when the dependent's does. The OS loads an import by itself, without running InitializeModule, which is why directory order alone is wrong whenever a dependent sorts first. Ties and cycles keep the given order.

BuildCommand

C++
std::string BuildCommand(const std::string& module) const

The one spelling of "build this module" every refusal quotes.

GetLoadFailures

C++
std::vector<std::pair<std::string, std::string>> GetLoadFailures() const

Every module whose last load failed, as (name, reason).

ModuleApiVersion

C++
static uint32_t ModuleApiVersion()

The version the loader compares against; a module exports the same number through MOWO_IMPLEMENT_MODULE_API_VERSION().

BuildAbi

C++
static const char* BuildAbi()

The engine's own MOWO_BUILD_ABI_SIGNATURE, as compiled into Core.

CompatibilityProblem

C++
static std::string CompatibilityProblem(bool hasVersionExport, uint32_t version, const char* buildAbi)

Why a module with these exports may not load, or empty when it may. buildAbi is null when the module exports no MowoModuleBuildAbi. Pure, so the refusal rules can be pinned without building a binary for every way of getting them wrong.

IsEngineOwnedModule

C++
static bool IsEngineOwnedModule(const std::string& name)

Engine runtime modules ("MowoEngine.<Name>") ship with the loader and need no version export; every other module (plugin, game, sandbox) must carry one or is refused. A layout question only: anyone can name a DLL "MowoEngine.X", so no trust decision may read it — the signature gate verifies every module it is handed, whatever the name.

UnloadModule

C++
bool UnloadModule(const std::string& name)

Calls the optional ShutdownModule export, then frees the library. Returns false when the module isn't loaded.

IsModuleLoaded

C++
bool IsModuleLoaded(const std::string& name) const

GetModuleHandle

C++
void* GetModuleHandle(const std::string& name) const

Native handle (HMODULE / dlopen handle) as void*. nullptr when not loaded. Pass to MClassRegistry::UnregisterAllInModule.

FindModuleBinary

C++
std::string FindModuleBinary(const std::string& name) const

Path of the binary LoadModule would pick for name right now: the highest <name>.v<N>.dll in the executable directory, else <name>.dll, else empty when neither exists.

Generated from Core/FModuleManager.h via core.json · Nov 5, 2026Version 1.0.0