Wasmtime
component/component.h
Go to the documentation of this file.
1
2
3#ifndef WASMTIME_COMPONENT_COMPONENT_H
4#define WASMTIME_COMPONENT_COMPONENT_H
5
6#include <wasm.h>
8#include <wasmtime/conf.h>
9#include <wasmtime/error.h>
10
11#ifdef WASMTIME_FEATURE_COMPONENT_MODEL
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
19
20#ifdef WASMTIME_FEATURE_COMPILER
21
42WASM_API_EXTERN wasmtime_error_t *
43wasmtime_component_new(const wasm_engine_t *engine, const uint8_t *buf,
44 size_t len, wasmtime_component_t **component_out);
45
59WASM_API_EXTERN wasmtime_error_t *
61 wasm_byte_vec_t *ret);
62
63#endif // WASMTIME_FEATURE_COMPILER
64
75WASM_API_EXTERN wasmtime_error_t *
76wasmtime_component_deserialize(const wasm_engine_t *engine, const uint8_t *buf,
77 size_t len,
78 wasmtime_component_t **component_out);
79
94WASM_API_EXTERN wasmtime_error_t *
96 const char *path,
97 wasmtime_component_t **component_out);
98
103WASM_API_EXTERN wasmtime_component_t *
105
112WASM_API_EXTERN wasmtime_component_type_t *
114
120WASM_API_EXTERN void wasmtime_component_delete(wasmtime_component_t *component);
121
125
136WASM_API_EXTERN wasmtime_component_export_index_t *
138 const wasmtime_component_t *component,
139 const wasmtime_component_export_index_t *instance_export_index,
140 const char *name, size_t name_len);
141
145WASM_API_EXTERN wasmtime_component_export_index_t *
148
156
157#ifdef __cplusplus
158} // extern "C"
159#endif
160
161#endif // WASMTIME_FEATURE_COMPONENT_MODEL
162
163#endif // WASMTIME_COMPONENT_COMPONENT_H
WASM_API_EXTERN wasmtime_error_t * wasmtime_component_new(const wasm_engine_t *engine, const uint8_t *buf, size_t len, wasmtime_component_t **component_out)
Compiles a WebAssembly binary into a wasmtime_component_t.
WASM_API_EXTERN wasmtime_component_type_t * wasmtime_component_type(const wasmtime_component_t *component)
Returns the type of this component.
struct wasmtime_component_export_index_t wasmtime_component_export_index_t
A value which represents a known export of a component.
Definition: component/component.h:123
WASM_API_EXTERN wasmtime_component_export_index_t * wasmtime_component_export_index_clone(const wasmtime_component_export_index_t *index)
Creates a new separately-owned copy of the specified index.
struct wasmtime_component_t wasmtime_component_t
Representation of a component in the component model.
Definition: component/component.h:18
WASM_API_EXTERN wasmtime_component_export_index_t * wasmtime_component_get_export_index(const wasmtime_component_t *component, const wasmtime_component_export_index_t *instance_export_index, const char *name, size_t name_len)
Looks up a specific export of this component by name optionally nested within the instance provided.
WASM_API_EXTERN void wasmtime_component_delete(wasmtime_component_t *component)
Deletes a wasmtime_component_t created by wasmtime_component_new.
WASM_API_EXTERN wasmtime_error_t * wasmtime_component_deserialize_file(const wasm_engine_t *engine, const char *path, wasmtime_component_t **component_out)
Deserialize a component from an on-disk file.
WASM_API_EXTERN wasmtime_error_t * wasmtime_component_deserialize(const wasm_engine_t *engine, const uint8_t *buf, size_t len, wasmtime_component_t **component_out)
Build a component from serialized data.
WASM_API_EXTERN void wasmtime_component_export_index_delete(wasmtime_component_export_index_t *export_index)
Deletes a wasmtime_component_export_index_t.
WASM_API_EXTERN wasmtime_component_t * wasmtime_component_clone(const wasmtime_component_t *component)
Creates a shallow clone of the specified component, increasing the internal reference count.
WASM_API_EXTERN wasmtime_error_t * wasmtime_component_serialize(const wasmtime_component_t *component, wasm_byte_vec_t *ret)
This function serializes compiled component artifacts as blob data.
struct wasmtime_component_type_t wasmtime_component_type_t
Represents the type of a WebAssembly component.
Definition: component/types/component.h:22
Build-time defines for how the C API was built.
Definition and accessors of wasmtime_error_t.
A list of bytes.
Definition: wasm.h:102
Compilation environment and configuration.
Errors generated by Wasmtime.