diff --git a/README.md b/README.md index f8eb1d2..32b8848 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,16 @@ Let WebAssembly's exported function support more data types for its parameters and return values. -## Example +## Build and run Example +``` +cd test/BindgenFuncs/wasm/rust_bindgen_funcs +cargo build --release --target=wasm32-wasi + +cd test/BindgenFuncs/host/rust/ +cargo build +./target/debug/bindgen-funcs ../../wasm/rust_bindgen_funcs/target/wasm32-wasi/release/rust_bindgen_funcs_lib.wasm +``` ## Export Rust things to host program diff --git a/test/BindgenFuncs/host/rust/Cargo.lock b/test/BindgenFuncs/host/rust/Cargo.lock index d2ea015..3d8f7f8 100644 --- a/test/BindgenFuncs/host/rust/Cargo.lock +++ b/test/BindgenFuncs/host/rust/Cargo.lock @@ -133,6 +133,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "lock_api" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +dependencies = [ + "autocfg", + "scopeguard", +] + [[package]] name = "memchr" version = "2.4.1" @@ -176,6 +186,29 @@ dependencies = [ "autocfg", ] +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets", +] + [[package]] name = "paste" version = "1.0.6" @@ -242,6 +275,15 @@ dependencies = [ "getrandom", ] +[[package]] +name = "redox_syscall" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags", +] + [[package]] name = "regex" version = "1.5.4" @@ -263,12 +305,24 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + [[package]] name = "shlex" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" +[[package]] +name = "smallvec" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" + [[package]] name = "syn" version = "1.0.86" @@ -326,7 +380,7 @@ checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" [[package]] name = "wasmedge-bindgen-host" -version = "0.4.0" +version = "0.4.1" dependencies = [ "num-derive", "num-traits", @@ -336,14 +390,15 @@ dependencies = [ [[package]] name = "wasmedge-sys" -version = "0.7.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb17b890cbf53fdc9b899c9c9a37a0cb1b4701deb818f34a1e1a443511c69fd4" +checksum = "ee931f695fe145f7838b8ada293802e64ca39b8e8a8869597748fd599c404c68" dependencies = [ "bindgen", "cmake", "lazy_static", "libc", + "parking_lot", "paste", "rand", "thiserror", @@ -352,9 +407,9 @@ dependencies = [ [[package]] name = "wasmedge-types" -version = "0.1.3" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f4d917f64db782e34599fc2fcade721341a532d363889a33020fcd0105673e5" +checksum = "f28bfe2dc292414ecc439b4d92bbb16b0a73bc704e9d4a46a0df41ad5f9e29a8" dependencies = [ "thiserror", "wat", @@ -401,3 +456,60 @@ name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" diff --git a/test/BindgenFuncs/host/rust/Cargo.toml b/test/BindgenFuncs/host/rust/Cargo.toml index 245dbeb..78b50fd 100644 --- a/test/BindgenFuncs/host/rust/Cargo.toml +++ b/test/BindgenFuncs/host/rust/Cargo.toml @@ -6,5 +6,5 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -wasmedge-sys = "0.7.0" +wasmedge-sys = "0.9.0" wasmedge-bindgen-host = { path = "../../../../host/rust" } \ No newline at end of file diff --git a/test/BindgenFuncs/wasm/rust_bindgen_funcs/Cargo.lock b/test/BindgenFuncs/wasm/rust_bindgen_funcs/Cargo.lock index e317625..be034e7 100644 --- a/test/BindgenFuncs/wasm/rust_bindgen_funcs/Cargo.lock +++ b/test/BindgenFuncs/wasm/rust_bindgen_funcs/Cargo.lock @@ -201,11 +201,11 @@ checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" [[package]] name = "wasmedge-bindgen" -version = "0.4.0" +version = "0.4.1" [[package]] name = "wasmedge-bindgen-macro" -version = "0.4.0" +version = "0.4.1" dependencies = [ "proc-macro2", "quote",