Wasmtime
instance.h
Go to the documentation of this file.
1
7#ifndef WASMTIME_INSTANCE_H
8#define WASMTIME_INSTANCE_H
9
10#include <wasm.h>
11#include <wasmtime/extern.h>
12#include <wasmtime/module.h>
13#include <wasmtime/store.h>
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
26typedef struct wasmtime_instance {
28 uint64_t store_id;
30 size_t index;
32
65WASM_API_EXTERN wasmtime_error_t *
67 const wasmtime_module_t *module,
68 const wasmtime_extern_t *imports, size_t nimports,
69 wasmtime_instance_t *instance, wasm_trap_t **trap);
70
86WASM_API_EXTERN bool wasmtime_instance_export_get(
87 wasmtime_context_t *store, const wasmtime_instance_t *instance,
88 const char *name, size_t name_len, wasmtime_extern_t *item);
89
108WASM_API_EXTERN bool wasmtime_instance_export_nth(
109 wasmtime_context_t *store, const wasmtime_instance_t *instance,
110 size_t index, char **name, size_t *name_len, wasmtime_extern_t *item);
111
121typedef struct wasmtime_instance_pre wasmtime_instance_pre_t;
122
126WASM_API_EXTERN void
128
153 const wasmtime_instance_pre_t *instance_pre, wasmtime_store_t *store,
154 wasmtime_instance_t *instance, wasm_trap_t **trap_ptr);
155
162WASM_API_EXTERN wasmtime_module_t *
164
165#ifdef __cplusplus
166} // extern "C"
167#endif
168
169#endif // WASMTIME_INSTANCE_H
Definition of wasmtime_extern_t and external items.
struct wasmtime_instance_pre wasmtime_instance_pre_t
A wasmtime_instance_t, pre-instantiation, that is ready to be instantiated.
Definition: instance.h:121
void wasmtime_instance_pre_delete(wasmtime_instance_pre_t *instance_pre)
Delete a previously created wasmtime_instance_pre_t.
wasmtime_error_t * wasmtime_instance_pre_instantiate(const wasmtime_instance_pre_t *instance_pre, wasmtime_store_t *store, wasmtime_instance_t *instance, wasm_trap_t **trap_ptr)
Instantiates instance within the given store.
bool wasmtime_instance_export_get(wasmtime_context_t *store, const wasmtime_instance_t *instance, const char *name, size_t name_len, wasmtime_extern_t *item)
Get an export by name from an instance.
bool wasmtime_instance_export_nth(wasmtime_context_t *store, const wasmtime_instance_t *instance, size_t index, char **name, size_t *name_len, wasmtime_extern_t *item)
Get an export by index from an instance.
struct wasmtime_instance wasmtime_instance_t
Representation of a instance in Wasmtime.
wasmtime_module_t * wasmtime_instance_pre_module(wasmtime_instance_pre_t *instance_pre)
Get the module (as a shallow clone) for a instance_pre.
wasmtime_error_t * wasmtime_instance_new(wasmtime_context_t *store, const wasmtime_module_t *module, const wasmtime_extern_t *imports, size_t nimports, wasmtime_instance_t *instance, wasm_trap_t **trap)
Instantiate a wasm module.
Opaque struct representing a wasm trap.
An interior pointer into a wasmtime_store_t which is used as "context" for many functions.
Errors generated by Wasmtime.
Container for different kinds of extern items.
Definition: extern.h:133
Representation of a instance in Wasmtime.
Definition: instance.h:26
size_t index
Internal index within the store.
Definition: instance.h:30
uint64_t store_id
Internal identifier of what store this belongs to, never zero.
Definition: instance.h:28
A compiled Wasmtime module.
Storage of WebAssembly objects.