Implement wasm_global_type (#898)

This commit is contained in:
Yury Delendik
2020-02-04 13:50:56 -06:00
committed by GitHub
parent 76f9e7ea41
commit a01bcff219

View File

@@ -1422,6 +1422,16 @@ pub unsafe extern "C" fn wasm_global_new(
Box::into_raw(g) 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] #[no_mangle]
pub unsafe extern "C" fn wasm_global_get(g: *const wasm_global_t, out: *mut wasm_val_t) { pub unsafe extern "C" fn wasm_global_get(g: *const wasm_global_t, out: *mut wasm_val_t) {
(*out).set((*g).global().borrow().get()); (*out).set((*g).global().borrow().get());