diff --git a/CHANGELOG.md b/CHANGELOG.md index 6810ec225d4..06af7a1a893 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - [#2059](https://github.com/wasmerio/wasmer/pull/2059) Ability to capture `stdout` and `stderr` with WASI in the C API. - [#2040](https://github.com/wasmerio/wasmer/pull/2040) Add `InstanceHandle::vmoffsets` to expose the offsets of the `vmctx` region. - [#2026](https://github.com/wasmerio/wasmer/pull/2010) Expose trap code of a `RuntimeError`, if it's a `Trap`. +- [#2054](https://github.com/wasmerio/wasmer/pull/2054) Add `wasm_config_delete` to the Wasm C API. ### Changed - [#2042](https://github.com/wasmerio/wasmer/pull/2042) Parse more exotic environment variables in `wasmer run`. diff --git a/lib/c-api/src/wasm_c_api/engine.rs b/lib/c-api/src/wasm_c_api/engine.rs index efc07f95d4b..dd3b6fa416a 100644 --- a/lib/c-api/src/wasm_c_api/engine.rs +++ b/lib/c-api/src/wasm_c_api/engine.rs @@ -131,6 +131,36 @@ pub extern "C" fn wasm_config_new() -> Box { Box::new(wasm_config_t::default()) } +/// Delete a Wasmer config object. +/// +/// This function does not need to be called if `wasm_engine_new_with_config` or +/// another function that takes ownership of the `wasm_config_t` is called. +/// +/// # Example +/// +/// ```rust +/// # use inline_c::assert_c; +/// # fn main() { +/// # (assert_c! { +/// # #include "tests/wasmer_wasm.h" +/// # +/// int main() { +/// // Create the configuration. +/// wasm_config_t* config = wasm_config_new(); +/// +/// // Delete the configuration +/// wasm_config_delete(config); +/// +/// return 0; +/// } +/// # }) +/// # .success(); +/// # } +/// ``` +/// cbindgen:ignore +#[no_mangle] +pub extern "C" fn wasm_config_delete(_config: Option>) {} + /// Updates the configuration to specify a particular compiler to use. /// /// This is a Wasmer-specific function.