c-api: adding wasmer_instance_context_get (instance.rs)

This commit is contained in:
Yaron Wittenstein
2019-07-31 14:12:25 +03:00
parent b5e20e508d
commit 847dd6f65e
7 changed files with 111 additions and 0 deletions

View File

@ -108,6 +108,18 @@ pub unsafe extern "C" fn wasmer_instantiate(
wasmer_result_t::WASMER_OK
}
#[allow(clippy::cast_ptr_alignment)]
#[no_mangle]
pub unsafe extern "C" fn wasmer_instance_context_get(
instance: *mut wasmer_instance_t,
) -> *const wasmer_instance_context_t {
let instance_ref = &*(instance as *const Instance);
let ctx: *const Ctx = instance_ref.context() as *const _;
ctx as *const wasmer_instance_context_t
}
/// Calls an instances exported function by `name` with the provided parameters.
/// Results are set using the provided `results` pointer.
///