Import with #import "std/bundle_host".
HostValueKind :: enum { HostVoid = 0; HostInteger = 1; HostUnsigned = 2; HostReal = 3; HostString = 4; HostRecord = 5; HostSlice = 6; HostPointer = 7; HostArray = 8; }HostValue :: struct { kind: s32; type_name: *u8; integer: s64; bits: u64; real: float64; data: *u8; length: usize; fields: *HostField; field_count: usize; elements: *HostValue; pointer: *void; }HostField :: struct { name: *u8; value: HostValue; }HostCall :: #type (context: *void, module: *u8, function: *u8, arguments: *HostValue, count: s32, result: *HostValue) -> s32HostBinding :: struct { module: *u8; function: *u8; call: HostCall; context: *void; }BundleStateValue :: struct { module: *u8; name: *u8; type: *u8; value: HostValue; }BundleStateMigrate :: #type (context: *void, old_state: *void, new_state: *void) -> s32BundleComponentVerify :: #type (context: *void, instance: *void) -> s32BundleCapabilityAbi :: struct { module: *u8; function: *u8; signature: *u8; arguments: *u8; return_type: *u8; variable_arguments: s32; reads_arguments: s32; }UsePortableBundleVm :: (enabled: bool)Select the portable VM for subsequent opens and instances in this process.
OpenBundle :: (path: *u8) -> *voidOpenBundleWithLibraries :: (path: *u8, libraries: **void, count: u64) -> *voidOpenBundleBytesWithLibraries :: (data: *u8, size: u64, libraries: **void, count: u64) -> *voidOpenBundleBytes :: (data: *u8, size: u64) -> *voidCloseBundle :: (bundle: *void)BundleCapabilities :: (bundle: *void) -> u64Borrowed names remain valid until CloseBundle. A host can bind the exact package-qualified names in a downloaded program without knowing its lock.
BundleCapabilityModuleName :: (bundle: *void, index: u64) -> *u8BundleCapabilityFunctionName :: (bundle: *void, index: u64) -> *u8ReadBundleCapabilityAbi :: (bundle: *void, index: u64, abi: *BundleCapabilityAbi) -> s32BundlesAbiCompatible :: (left: *void, right: *void) -> boolBundleEntryModule :: (bundle: *void) -> *u8BundleEntryFunction :: (bundle: *void) -> *u8BundleCodeDigest :: (bundle: *void, identity: *u8)BundleAssets :: (bundle: *void) -> u64BundleOwnAssets :: (bundle: *void) -> u64Own assets precede inherited library assets in the resource table.
BundleAssetPath :: (bundle: *void, index: u64) -> *u8BundleAssetBytes :: (bundle: *void, index: u64) -> *u8BundleAssetLength :: (bundle: *void, index: u64) -> u64InstantiateBundle :: (bundle: *void, bindings: *HostBinding, count: u64) -> *voidInstantiateBundleLimited :: (bundle: *void, bindings: *HostBinding, count: u64, max_steps: s32) -> *voidPortable VM with one positive budget covering global initialization and runs.
InstantiateBundlePortable :: (bundle: *void, bindings: *HostBinding, count: u64) -> *voidRunBundleInstance :: (instance: *void, result: *s64, has_result: *s32) -> s32CloseBundleInstance :: (instance: *void)LimitBundleSteps :: (instance: *void, max_steps: s32)MatchBundleFieldsByName :: (instance: *void, enabled: bool)Records returned to the instance match fields by name, so a bundle built against an older or newer record layout still runs.
ExportBundleState :: (instance: *void, state: **void) -> boolImportBundleState :: (instance: *void, state: *void) -> boolBundleStateValueCount :: (state: *void) -> u64BundleStateBytes :: (state: *void) -> u64ReadBundleStateValue :: (state: *void, index: u64, value: *BundleStateValue) -> boolBundleStateValueReference :: (state: *void, index: u64) -> *BundleStateValueFindBundleStateValue :: (state: *void, module: *u8, name: *u8, index: *u64) -> boolSetBundleStateInteger :: (state: *void, index: u64, value: s64) -> boolSetBundleStateUnsigned :: (state: *void, index: u64, value: u64) -> boolSetBundleStateReal :: (state: *void, index: u64, value: float64) -> boolSetBundleStateString :: (state: *void, index: u64, data: *u8, length: u64) -> boolCloseBundleState :: (state: *void)OpenBundleComponent :: (bundle: *void, bindings: *HostBinding, count: u64, max_steps: s32) -> *voidAcquireBundleComponent :: (component: *void) -> *voidBundleComponentHandleIsValid :: (handle: *void) -> boolRunBundleComponent :: (handle: *void, result: *s64, has_result: *s32) -> s32ReplaceBundleComponent :: (component: *void, replacement: *void, migrate: BundleStateMigrate, verify: BundleComponentVerify, context: *void, new_handle: **void) -> boolBundleComponentLiveBytes :: (component: *void) -> u64CloseBundleComponent :: (component: *void)CloseBundleComponentHandle :: (handle: *void)