mirror of
https://github.com/fluencelabs/wasmer
synced 2025-05-12 02:27:11 +00:00
doc(runtime-c-api) Improve documentation of wasmer_instance_destroy
.
This commit is contained in:
parent
f4c8997c6d
commit
8283b6d0da
@ -61,6 +61,9 @@ pub struct wasmer_instance_context_t;
|
|||||||
/// `wasmer_last_error_length()` with `wasmer_last_error_message()` must
|
/// `wasmer_last_error_length()` with `wasmer_last_error_message()` must
|
||||||
/// be used to read the error message.
|
/// be used to read the error message.
|
||||||
///
|
///
|
||||||
|
/// The caller is responsible to free the instance with
|
||||||
|
/// `wasmer_instance_destroy()`.
|
||||||
|
///
|
||||||
/// Example:
|
/// Example:
|
||||||
///
|
///
|
||||||
/// ```c
|
/// ```c
|
||||||
@ -87,6 +90,9 @@ pub struct wasmer_instance_context_t;
|
|||||||
/// wasmer_last_error_message(error, error_length);
|
/// wasmer_last_error_message(error, error_length);
|
||||||
/// // Do something with `error`…
|
/// // Do something with `error`…
|
||||||
/// }
|
/// }
|
||||||
|
///
|
||||||
|
/// // 5. Free the memory!
|
||||||
|
/// wasmer_instance_destroy(instance);
|
||||||
/// ```
|
/// ```
|
||||||
#[allow(clippy::cast_ptr_alignment)]
|
#[allow(clippy::cast_ptr_alignment)]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
@ -491,7 +497,23 @@ pub extern "C" fn wasmer_instance_context_data_get(
|
|||||||
ctx.data
|
ctx.data
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Frees memory for the given Instance
|
/// Frees memory for the given `wasmer_instance_t`.
|
||||||
|
///
|
||||||
|
/// Check the `wasmer_instantiate()` function to get a complete
|
||||||
|
/// example.
|
||||||
|
///
|
||||||
|
/// If `instance` is a null pointer, this function does nothing.
|
||||||
|
///
|
||||||
|
/// Example:
|
||||||
|
///
|
||||||
|
/// ```c
|
||||||
|
/// // Get an instance.
|
||||||
|
/// wasmer_instance_t *instance = NULL;
|
||||||
|
/// wasmer_instantiate(&instance, bytes, bytes_length, imports, 0);
|
||||||
|
///
|
||||||
|
/// // Destroy the instance.
|
||||||
|
/// wasmer_instance_destroy(instance);
|
||||||
|
/// ```
|
||||||
#[allow(clippy::cast_ptr_alignment)]
|
#[allow(clippy::cast_ptr_alignment)]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn wasmer_instance_destroy(instance: *mut wasmer_instance_t) {
|
pub extern "C" fn wasmer_instance_destroy(instance: *mut wasmer_instance_t) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user