feat(c-api) Instruct cbindgen to ignore all functions and types defined in wasm.h.

This commit is contained in:
Ivan Enderlin
2020-09-28 14:49:44 +02:00
parent 40865799e6
commit 8f627d9834
24 changed files with 178 additions and 55 deletions

View File

@@ -3,10 +3,12 @@ use std::convert::{TryFrom, TryInto};
use std::ptr::NonNull;
use wasmer::Val;
/// cbindgen:ignore
#[allow(non_camel_case_types)]
pub type wasm_valkind_t = u8;
#[repr(C)]
/// cbindgen:ignore
#[allow(non_camel_case_types)]
#[derive(Clone, Copy)]
pub union wasm_val_inner {
pub(crate) int32_t: i32,
@@ -16,7 +18,8 @@ pub union wasm_val_inner {
pub(crate) wref: *mut wasm_ref_t,
}
#[repr(C)]
/// cbindgen:ignore
#[allow(non_camel_case_types)]
pub struct wasm_val_t {
pub(crate) kind: wasm_valkind_t,
pub(crate) of: wasm_val_inner,
@@ -31,6 +34,7 @@ impl Clone for wasm_val_t {
}
}
/// cbindgen:ignore
#[no_mangle]
pub unsafe extern "C" fn wasm_val_copy(out_ptr: *mut wasm_val_t, val: &wasm_val_t) {
(*out_ptr).kind = val.kind;
@@ -46,6 +50,7 @@ pub unsafe extern "C" fn wasm_val_copy(out_ptr: *mut wasm_val_t, val: &wasm_val_
};
}
/// cbindgen:ignore
#[no_mangle]
pub unsafe extern "C" fn wasm_val_delete(val: Option<NonNull<wasm_val_t>>) {
if let Some(v_inner) = val {