1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
//! Unstable non-standard Wasmer-specific types for the //! `wasm_engine_t` and siblings. use super::super::engine::wasm_config_t; use super::target_lexicon::wasm_target_t; /// Unstable non-standard Wasmer-specific API to update the /// configuration to specify a particular target for the engine. /// /// # 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(); /// /// // Set the target. /// { /// wasm_triple_t* triple = wasm_triple_new_from_host(); /// wasm_cpu_features_t* cpu_features = wasm_cpu_features_new(); /// wasm_target_t* target = wasm_target_new(triple, cpu_features); /// /// wasm_config_set_target(config, target); /// } /// /// // Create the engine. /// wasm_engine_t* engine = wasm_engine_new_with_config(config); /// /// // Check we have an engine! /// assert(engine); /// /// // Free everything. /// wasm_engine_delete(engine); /// /// return 0; /// } /// # }) /// # .success(); /// # } /// ``` #[no_mangle] pub extern "C" fn wasm_config_set_target(config: &mut wasm_config_t, target: Box<wasm_target_t>) { config.target = Some(target); }