Initial reorg.
This is largely the same as #305, but updated for the current tree.
This commit is contained in:
20
crates/wasi-common/wasi-common-cbindgen/tests/mut_args.rs
Normal file
20
crates/wasi-common/wasi-common-cbindgen/tests/mut_args.rs
Normal file
@@ -0,0 +1,20 @@
|
||||
extern crate wasi_common_cbindgen;
|
||||
|
||||
pub use wasi_common_cbindgen::wasi_common_cbindgen;
|
||||
|
||||
#[wasi_common_cbindgen]
|
||||
fn mut_args(a: &mut usize) {
|
||||
*a = *a + 1
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let mut expected = Box::new(2);
|
||||
mut_args(expected.as_mut());
|
||||
let given = unsafe {
|
||||
let given = Box::new(2);
|
||||
let raw = Box::into_raw(given);
|
||||
wasi_common_mut_args(raw);
|
||||
Box::from_raw(raw)
|
||||
};
|
||||
assert_eq!(*given, *expected);
|
||||
}
|
||||
Reference in New Issue
Block a user