Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose Config::static_memory_forced to C #6413

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions crates/c-api/include/wasmtime/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,16 @@ WASMTIME_CONFIG_PROP(void, cranelift_opt_level, wasmtime_opt_level_t)
*/
WASMTIME_CONFIG_PROP(void, profiler, wasmtime_profiling_strategy_t)

/**
* \brief Configures the “static” style of memory to always be used.
*
* This setting is `false` by default.
*
* For more information see the Rust documentation at
* https://bytecodealliance.github.io/wasmtime/api/wasmtime/struct.Config.html#method.static_memory_forced.
*/
WASMTIME_CONFIG_PROP(void, static_memory_forced, bool)

/**
* \brief Configures the maximum size for memory to be considered "static"
*
Expand Down
5 changes: 5 additions & 0 deletions crates/c-api/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ pub unsafe extern "C" fn wasmtime_config_cache_config_load(
)
}

#[no_mangle]
pub extern "C" fn wasmtime_config_static_memory_forced_set(c: &mut wasm_config_t, enable: bool) {
c.config.static_memory_forced(enable);
}

#[no_mangle]
pub extern "C" fn wasmtime_config_static_memory_maximum_size_set(c: &mut wasm_config_t, size: u64) {
c.config.static_memory_maximum_size(size);
Expand Down