Skip to content

Engine → Scripting

script_host.h

The host interface: the object that owns the managed side of the two ABI tables. dotnet_script_host runs the real CLR, null_script_host is the C++ fake every other module's tests use. Both are created through create_script_host().

Structs

File Description
host_capabilities What hosting paths this build supports on this platform.
script_host_config

Classes

File Description
script_host

Enumerations

host_mode

enum class host_mode : u8 {
    FRAMEWORK_DEPENDENT,
    SELF_CONTAINED
};

How the CLR is hosted: framework-dependent through the runtime config, self-contained through the bootstrap command line.

script_backend

enum class script_backend : u8 {
    DOTNET,
    NULL_HOST
};

Which managed side a host talks to.

script_host_status

enum class script_host_status : u8 {
    UNINITIALISED,
    READY,
    DISABLED        // initialise failed; the host stays usable as an object but runs nothing
};

Functions

Public

create_script_host

[[nodiscard]] CONJURE_API std::unique_ptr<script_host> create_script_host(
    script_backend backend);

Creates the host for the backend. NULL_HOST never fails to initialise.

detect_host_mode

[[nodiscard]] CONJURE_API core::result<host_mode> detect_host_mode(
    const std::filesystem::path &managedDirectory);

Reads Conjure.Bootstrap.runtimeconfig.json in managedDirectory: SELF_CONTAINED when runtimeOptions.includedFrameworks is present, FRAMEWORK_DEPENDENT otherwise. RUNTIME_CONFIG_INVALID when the file is missing or malformed.

is_runtime_available

[[nodiscard]] CONJURE_API bool is_runtime_available() noexcept;

Static hostfxr probe: true when nethost finds a .NET runtime without starting one. Used as the DOTNET_RUNTIME test precondition.

query_host_capabilities

[[nodiscard]] CONJURE_API host_capabilities query_host_capabilities() noexcept;

The hosting paths available on this platform and build.

to_string

[[nodiscard]] CONJURE_API std::string_view to_string(
    script_host_status status) noexcept;

The upper-case name of a status ("READY").

[[nodiscard]] CONJURE_API std::string_view to_string(
    script_backend backend) noexcept;

The upper-case name of a backend ("NULL_HOST").

[[nodiscard]] CONJURE_API std::string_view to_string(
    host_mode mode) noexcept;

The upper-case name of a mode ("SELF_CONTAINED").

validate_managed_directory

[[nodiscard]] CONJURE_API core::result<void> validate_managed_directory(
    const std::filesystem::path &managedDirectory);

The anchor files a managed directory must hold: Conjure.Bootstrap.dll, its runtime config and Conjure.Managed.dll. MANAGED_SDK_MISSING naming the first absent file.