Wasmtime
linker.h
Go to the documentation of this file.
1
7#ifndef WASMTIME_LINKER_H
8#define WASMTIME_LINKER_H
9
10#include <wasm.h>
11#include <wasmtime/error.h>
12#include <wasmtime/store.h>
13#include <wasmtime/extern.h>
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
36
44
48WASM_API_EXTERN void wasmtime_linker_delete(wasmtime_linker_t* linker);
49
56WASM_API_EXTERN void wasmtime_linker_allow_shadowing(wasmtime_linker_t* linker, bool allow_shadowing);
57
75 wasmtime_linker_t *linker,
76 const char *module,
77 size_t module_len,
78 const char *name,
79 size_t name_len,
80 const wasmtime_extern_t *item
81);
82
109 wasmtime_linker_t *linker,
110 const char *module,
111 size_t module_len,
112 const char *name,
113 size_t name_len,
114 const wasm_functype_t *ty,
116 void *data,
117 void (*finalizer)(void*)
118);
119
130 wasmtime_linker_t *linker,
131 const char *module,
132 size_t module_len,
133 const char *name,
134 size_t name_len,
135 const wasm_functype_t *ty,
137 void *data,
138 void (*finalizer)(void*)
139);
140
159 wasmtime_linker_t *linker
160);
161
182 wasmtime_linker_t *linker,
183 wasmtime_context_t *store,
184 const char *name,
185 size_t name_len,
186 const wasmtime_instance_t *instance
187);
188
212 const wasmtime_linker_t *linker,
213 wasmtime_context_t *store,
214 const wasmtime_module_t *module,
215 wasmtime_instance_t *instance,
216 wasm_trap_t **trap
217);
218
239 wasmtime_linker_t *linker,
240 wasmtime_context_t *store,
241 const char *name,
242 size_t name_len,
243 const wasmtime_module_t *module
244);
245
262 const wasmtime_linker_t *linker,
263 wasmtime_context_t *store,
264 const char *name,
265 size_t name_len,
266 wasmtime_func_t *func
267);
268
283WASM_API_EXTERN bool wasmtime_linker_get(
284 const wasmtime_linker_t *linker,
285 wasmtime_context_t *store,
286 const char *module,
287 size_t module_len,
288 const char *name,
289 size_t name_len,
291);
292
293#ifdef __cplusplus
294} // extern "C"
295#endif
296
297#endif // WASMTIME_LINKER_H
Definition and accessors of wasmtime_error_t.
Definition of wasmtime_extern_t and external items.
wasm_trap_t *(* wasmtime_func_unchecked_callback_t)(void *env, wasmtime_caller_t *caller, wasmtime_val_raw_t *args_and_results, size_t num_args_and_results)
Callback signature for wasmtime_func_new_unchecked.
Definition: func.h:123
wasm_trap_t *(* wasmtime_func_callback_t)(void *env, wasmtime_caller_t *caller, const wasmtime_val_t *args, size_t nargs, wasmtime_val_t *results, size_t nresults)
Callback signature for wasmtime_func_new.
Definition: func.h:57
wasmtime_linker_t * wasmtime_linker_new(wasm_engine_t *engine)
Creates a new linker for the specified engine.
bool wasmtime_linker_get(const wasmtime_linker_t *linker, wasmtime_context_t *store, const char *module, size_t module_len, const char *name, size_t name_len, wasmtime_extern_t *item)
Loads an item by name from this linker.
wasmtime_error_t * wasmtime_linker_define_func_unchecked(wasmtime_linker_t *linker, const char *module, size_t module_len, const char *name, size_t name_len, const wasm_functype_t *ty, wasmtime_func_unchecked_callback_t cb, void *data, void(*finalizer)(void *))
Defines a new function in this linker.
wasmtime_error_t * wasmtime_linker_get_default(const wasmtime_linker_t *linker, wasmtime_context_t *store, const char *name, size_t name_len, wasmtime_func_t *func)
Acquires the "default export" of the named module in this linker.
wasmtime_error_t * wasmtime_linker_define(wasmtime_linker_t *linker, const char *module, size_t module_len, const char *name, size_t name_len, const wasmtime_extern_t *item)
Defines a new item in this linker.
wasmtime_error_t * wasmtime_linker_define_wasi(wasmtime_linker_t *linker)
Defines WASI functions in this linker.
void wasmtime_linker_allow_shadowing(wasmtime_linker_t *linker, bool allow_shadowing)
Configures whether this linker allows later definitions to shadow previous definitions.
wasmtime_error_t * wasmtime_linker_module(wasmtime_linker_t *linker, wasmtime_context_t *store, const char *name, size_t name_len, const wasmtime_module_t *module)
Defines automatic instantiations of a wasm_module_t in this linker.
wasmtime_error_t * wasmtime_linker_define_instance(wasmtime_linker_t *linker, wasmtime_context_t *store, const char *name, size_t name_len, const wasmtime_instance_t *instance)
Defines an instance under the specified name in this linker.
void wasmtime_linker_delete(wasmtime_linker_t *linker)
Deletes a linker.
wasmtime_error_t * wasmtime_linker_define_func(wasmtime_linker_t *linker, const char *module, size_t module_len, const char *name, size_t name_len, const wasm_functype_t *ty, wasmtime_func_callback_t cb, void *data, void(*finalizer)(void *))
Defines a new function in this linker.
wasmtime_error_t * wasmtime_linker_instantiate(const wasmtime_linker_t *linker, wasmtime_context_t *store, const wasmtime_module_t *module, wasmtime_instance_t *instance, wasm_trap_t **trap)
Instantiates a wasm_module_t with the items defined in this linker.
Compilation environment and configuration.
An opaque object representing the type of a function.
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:123
Representation of a function in Wasmtime.
Definition: extern.h:24
Representation of a instance in Wasmtime.
Definition: instance.h:26
Object used to conveniently link together and instantiate wasm modules.
A compiled Wasmtime module.