From a01bcff2193cfd9a3eb4a2ac99fd11af4fd14a94 Mon Sep 17 00:00:00 2001 From: Yury Delendik Date: Tue, 4 Feb 2020 13:50:56 -0600 Subject: [PATCH] Implement wasm_global_type (#898) --- crates/c-api/src/lib.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/c-api/src/lib.rs b/crates/c-api/src/lib.rs index 1fc5be8de1..877510652a 100644 --- a/crates/c-api/src/lib.rs +++ b/crates/c-api/src/lib.rs @@ -1422,6 +1422,16 @@ pub unsafe extern "C" fn wasm_global_new( Box::into_raw(g) } +#[no_mangle] +pub unsafe extern "C" fn wasm_global_type(g: *const wasm_global_t) -> *mut wasm_globaltype_t { + let globaltype = (*g).global().borrow().ty().clone(); + let g = Box::new(wasm_globaltype_t { + globaltype, + content_cache: None, + }); + Box::into_raw(g) +} + #[no_mangle] pub unsafe extern "C" fn wasm_global_get(g: *const wasm_global_t, out: *mut wasm_val_t) { (*out).set((*g).global().borrow().get());