Skip to main content

Crate hao_runtime

Crate hao_runtime 

Source
Expand description

Host the .NET runtime in a Rust process and call into managed code.

Two backends are available behind features:

  • coreclr (default): .NET 8+, loading libcoreclr directly.
  • mono: the Mono embedding API, as used by Unity.

Managed methods are called through native function pointers, so the methods have to be callable from native code: [UnmanagedCallersOnly] static methods on CoreCLR, or any static method on Mono. Bindings generated by hao-runtime-macros produce such methods for you.

Re-exports§

pub use bindings::BoundAssembly;
pub use bindings::Object;

Modules§

attach
Attach to a CoreCLR game’s already-running runtime from a native mod loaded before the runtime starts (via LD_PRELOAD on Linux, or an injected DLL on Windows).
bindings
Support code for bindings generated by hao-runtime-macros.
console
Give an injected mod somewhere to see its logs.
profiler
A minimal CoreCLR profiler, implemented as COM objects by hand.
reflect
Reflection roots for the reflect feature. See hao::reflect for the pattern. The runtime handles (Runtime, ClrHost, the backends) hold raw pointers and library handles and are not reflected; the configuration and descriptor types are.
rewrite
Rewrite a managed assembly’s IL with hao before the runtime JITs it.

Structs§

CoreClrOptions
Where to find .NET and which framework version to run.
MonoOptions
Where to find Mono.
Runtime
A handle to a running .NET runtime. Cheap to clone.

Enums§

Backend
Error

Functions§

find_dotnet_root

Type Aliases§

Result