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/conf.h>
12#include <wasmtime/error.h>
13#include <wasmtime/extern.h>
14#include <wasmtime/func.h>
15#include <wasmtime/instance.h>
16#include <wasmtime/store.h>
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
39
47
54WASM_API_EXTERN wasmtime_linker_t *
56
60WASM_API_EXTERN void wasmtime_linker_delete(wasmtime_linker_t *linker);
61
69 bool allow_shadowing);
70
75WASM_API_EXTERN wasmtime_error_t *
77 wasmtime_module_t *module);
78
84WASM_API_EXTERN wasmtime_error_t *
87 wasmtime_module_t *module);
88
106WASM_API_EXTERN wasmtime_error_t *
108 const char *module, size_t module_len, const char *name,
109 size_t name_len, const wasmtime_extern_t *item);
110
138 wasmtime_linker_t *linker, const char *module, size_t module_len,
139 const char *name, size_t name_len, const wasm_functype_t *ty,
140 wasmtime_func_callback_t cb, void *data, void (*finalizer)(void *));
141
152 wasmtime_linker_t *linker, const char *module, size_t module_len,
153 const char *name, size_t name_len, const wasm_functype_t *ty,
155 void (*finalizer)(void *));
156
157#ifdef WASMTIME_FEATURE_WASI
158
176WASM_API_EXTERN wasmtime_error_t *
178
179#endif // WASMTIME_FEATURE_WASI
180
201 wasmtime_linker_t *linker, wasmtime_context_t *store, const char *name,
202 size_t name_len, const wasmtime_instance_t *instance);
203
226WASM_API_EXTERN wasmtime_error_t *
228 wasmtime_context_t *store,
229 const wasmtime_module_t *module,
230 wasmtime_instance_t *instance, wasm_trap_t **trap);
231
251WASM_API_EXTERN wasmtime_error_t *
253 const char *name, size_t name_len,
254 const wasmtime_module_t *module);
255
271WASM_API_EXTERN wasmtime_error_t *
273 wasmtime_context_t *store, const char *name,
274 size_t name_len, wasmtime_func_t *func);
275
290WASM_API_EXTERN bool wasmtime_linker_get(const wasmtime_linker_t *linker,
291 wasmtime_context_t *store,
292 const char *module, size_t module_len,
293 const char *name, size_t name_len,
294 wasmtime_extern_t *item);
295
309WASM_API_EXTERN wasmtime_error_t *
311 const wasmtime_module_t *module,
312 wasmtime_instance_pre_t **instance_pre);
313
314#ifdef __cplusplus
315} // extern "C"
316#endif
317
318#endif // WASMTIME_LINKER_H
Build-time defines for how the C API was built.
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:116
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
struct wasmtime_instance_pre wasmtime_instance_pre_t
A wasmtime_instance_t, pre-instantiation, that is ready to be instantiated.
Definition: instance.h:121
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_wasi(wasmtime_linker_t *linker)
Defines WASI functions in this linker.
wasmtime_error_t * wasmtime_linker_define(wasmtime_linker_t *linker, wasmtime_context_t *store, 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_instantiate_pre(const wasmtime_linker_t *linker, const wasmtime_module_t *module, wasmtime_instance_pre_t **instance_pre)
Perform all the checks for instantiating module with the linker, except that instantiation doesn't ac...
wasmtime_linker_t * wasmtime_linker_clone(wasmtime_linker_t *linker)
Clones existing 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_define_unknown_imports_as_traps(wasmtime_linker_t *linker, wasmtime_module_t *module)
Ensures that module can be instantiated with this linker by defining all functions otherwise missing ...
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.
wasmtime_error_t * wasmtime_linker_define_unknown_imports_as_default_values(wasmtime_linker_t *linker, wasmtime_context_t *store, wasmtime_module_t *module)
Ensures that module can be instantiated with this linker by defining all functions otherwise missing ...
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:145
Representation of a function in Wasmtime.
Definition: extern.h:25
Representation of a instance in Wasmtime.
Definition: instance.h:26
Object used to conveniently link together and instantiate wasm modules.
A compiled Wasmtime module.