Skip to content

Engine → Modules

module_types.h

Handles, enumerations and flag sets of the module system.

Structs

File Description
binary_triplet Names the bin/<platform>-<arch>-<config>/ directory a module binary lives in.
module_id 32-bit module handle. The generation increments on every unload so a stale id is detected instead of addressing the slot's next occupant.
std::formatter<conjure::modules::binary_triplet>
std::formatter<conjure::modules::module_id>
std::formatter<conjure::modules::module_state>

Enumerations

build_config

enum class build_config : u8 {
    DEBUG = 1,
    DEVELOPMENT = 2,
    DISTRIBUTION = 3
};

module_architecture

enum class module_architecture : u8 {
    X64,
    ARM64
};

module_entry_status

enum class module_entry_status : u32 {
    OK = 0,
    FAILED = 1
};

What a module entry function returns through the C boundary.

module_feature_flags

enum class module_feature_flags : u32 {
    NONE = 0,
    RENDERER = 1 << 0,
    PHYSICS = 1 << 1,
    AUDIO = 1 << 2,
    SCRIPTING = 1 << 3,
    EDITOR = 1 << 4
};

Engine features a module may require ("requires" in module.json). Mirrors the CONJURE_WITH_* options and CONJURE_BUILD_EDITOR.

module_host_kind

enum class module_host_kind : u8 {
    EDITOR,
    RUNTIME,
    TEST
};

module_kind

enum class module_kind : u8 {
    ENGINE,     // a built-in engine library registered as a manifest-only static module
    PLUGIN,     // a shared or static module that is not the game
    GAME        // the single project module, always loaded last
};

module_platform

enum class module_platform : u8 {
    WINDOWS,
    LINUX,
    MACOS
};

module_platform_flags

enum class module_platform_flags : u8 {
    NONE = 0,
    WINDOWS = 1 << 0,
    LINUX = 1 << 1,
    MACOS = 1 << 2,
    ALL = WINDOWS | LINUX | MACOS
};

module_state

enum class module_state : u8 {
    DISCOVERED,     // manifest accepted, not resolved yet
    SKIPPED,        // the manifest excludes the host platform; never loaded, never an error
    RESOLVED,       // part of a resolved load order, about to load
    LOADED,         // entry ran, every consumer attached
    FAILED,         // the last load attempt failed; last_error() says why; a retry is allowed
    UNLOADED,       // was LOADED once; may be loaded again
    FAULTED         // an unload went wrong half-way; the binary stays resident, nothing else works
};

reload_scope

enum class reload_scope : u8 {
    FULL,           // close and reopen the binary, every consumer detaches and restores
    MANAGED_ONLY    // only consumers with participates_in_managed_reload() take part
};

unload_policy

enum class unload_policy : u8 {
    REFUSE_IF_IN_USE,   // consumers veto with IN_USE when anything still uses the module
    REMOVE_INSTANCES    // consumers strip every instance the module owns
};

Macros

CONJURE_ENUM_FLAGS

CONJURE_ENUM_FLAGS(module_platform_flags)

Functions

Public

host_architecture

[[nodiscard]] constexpr module_architecture host_architecture() noexcept;

host_binary_triplet

[[nodiscard]] constexpr binary_triplet host_binary_triplet(
    build_config config = host_build_config()) noexcept;

The host platform and architecture combined with the given configuration.

host_build_config

[[nodiscard]] constexpr build_config host_build_config() noexcept;

host_feature_flags

[[nodiscard]] constexpr module_feature_flags host_feature_flags() noexcept;

The features compiled into this engine build (CONJURE_WITH_RENDERER, ..., CONJURE_BUILD_EDITOR).

host_platform

[[nodiscard]] constexpr module_platform host_platform() noexcept;

host_platform_flag

[[nodiscard]] constexpr module_platform_flags host_platform_flag() noexcept;

parse_build_config

[[nodiscard]] CONJURE_API std::optional<build_config> parse_build_config(
    std::string_view text) noexcept;

parse_module_feature

[[nodiscard]] CONJURE_API std::optional<module_feature_flags> parse_module_feature(
    std::string_view text) noexcept;

parse_module_kind

[[nodiscard]] CONJURE_API std::optional<module_kind> parse_module_kind(
    std::string_view text) noexcept;

Parses the manifest spellings; nullopt for anything else (case-sensitive).

parse_module_platform

[[nodiscard]] CONJURE_API std::optional<module_platform> parse_module_platform(
    std::string_view text) noexcept;

to_flag

[[nodiscard]] constexpr module_platform_flags to_flag(
    module_platform platform) noexcept;

The flag bit of a platform.

to_string

[[nodiscard]] CONJURE_API std::string_view to_string(
    module_kind kind) noexcept;
[[nodiscard]] CONJURE_API std::string_view to_string(
    module_host_kind host) noexcept;
[[nodiscard]] CONJURE_API std::string_view to_string(
    module_state state) noexcept;
[[nodiscard]] CONJURE_API std::string_view to_string(
    unload_policy policy) noexcept;
[[nodiscard]] CONJURE_API std::string_view to_string(
    reload_scope scope) noexcept;
[[nodiscard]] CONJURE_API std::string_view to_string(
    build_config config) noexcept;
[[nodiscard]] CONJURE_API std::string_view to_string(
    module_platform platform) noexcept;
[[nodiscard]] CONJURE_API std::string_view to_string(
    module_architecture architecture) noexcept;
[[nodiscard]] CONJURE_API std::string to_string(
    const binary_triplet &triplet);

"windows-x64-debug".

[[nodiscard]] CONJURE_API std::string to_string(
    module_id id);

"index:generation", or "invalid" for the default id.

[[nodiscard]] CONJURE_API std::string to_string(
    module_feature_flags flags);

The manifest names of the set bits joined with ", " ("renderer, physics"); "" for NONE.

[[nodiscard]] CONJURE_API std::string to_string(
    module_platform_flags flags);