| 11 | |
| 12 | #[unsafe(no_mangle)] |
| 13 | pub extern "C" fn wasm_engine_new() -> Box<wasm_engine_t> { |
| 14 | // Enable the `env_logger` crate since this is as good a place as any to |
| 15 | // support some "top level initialization" for the C API. Almost all support |
| 16 | // should go through this one way or another, so this ensures that |
| 17 | // `RUST_LOG` should work reasonably well. |
| 18 | // |
| 19 | // Note that we `drop` the result here since this fails after the first |
| 20 | // initialization attempt. We don't mind that though because this function |
| 21 | // can be called multiple times, so we just ignore the result. |
| 22 | #[cfg(feature = "logging")] |
| 23 | drop(env_logger::try_init()); |
| 24 | |
| 25 | Box::new(wasm_engine_t { |
| 26 | engine: Engine::default(), |
| 27 | }) |
| 28 | } |
| 29 | |
| 30 | #[unsafe(no_mangle)] |
| 31 | pub extern "C" fn wasm_engine_new_with_config(c: Box<wasm_config_t>) -> Box<wasm_engine_t> { |