mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-25 22:51:32 +00:00
Add WASI support to runtime-c-api
This commit is contained in:
@ -154,6 +154,15 @@ struct wasmer_trampoline_buffer_t {
|
||||
|
||||
};
|
||||
|
||||
/// Opens a directory that's visible to the WASI module as `alias` but
|
||||
/// is backed by the host file at `host_file_path`
|
||||
struct wasmer_wasi_map_dir_entry_t {
|
||||
/// What the WASI module will see in its virtual root
|
||||
wasmer_byte_array alias;
|
||||
/// The backing file that the WASI module will interact with via the alias
|
||||
wasmer_byte_array host_file_path;
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
|
||||
/// Creates a new Module from the given wasm bytes.
|
||||
@ -590,6 +599,23 @@ void *wasmer_trampoline_get_context();
|
||||
/// Returns true for valid wasm bytes and false for invalid bytes
|
||||
bool wasmer_validate(const uint8_t *wasm_bytes, uint32_t wasm_bytes_len);
|
||||
|
||||
/// Convenience function that creates a WASI import object with no arguments,
|
||||
/// environment variables, preopened files, or mapped directories.
|
||||
///
|
||||
/// This function is the same as calling [`wasmer_wasi_generate_import_object`] with all
|
||||
/// empty values.
|
||||
wasmer_import_object_t *wasmer_wasi_generate_default_import_object();
|
||||
|
||||
/// Creates a WASI import object
|
||||
wasmer_import_object_t *wasmer_wasi_generate_import_object(const wasmer_byte_array *args,
|
||||
unsigned int args_len,
|
||||
const wasmer_byte_array *envs,
|
||||
unsigned int envs_len,
|
||||
const wasmer_byte_array *preopened_files,
|
||||
unsigned int preopened_files_len,
|
||||
const wasmer_wasi_map_dir_entry_t *mapped_dirs,
|
||||
unsigned int mapped_dirs_len);
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // WASMER_H
|
||||
|
Reference in New Issue
Block a user