# wasm_test **Repository Path**: wasmtime/wasm_test ## Basic Information - **Project Name**: wasm_test - **Description**: 对wasm之wasmtime进行各种测试学习 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-06-28 - **Last Updated**: 2022-07-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # wasm_test #### 介绍 对wasm之wasmtime进行各种测试学习 #### use_wasm_in_rust 尝试在自己的rust项目中调用外部wasm文件(.wat: wasm text format file;.wasm: wasm binary format file) #### wasm之wasmtime wasm32-wasi外部链接 #### [use WebAssembly in Rust](https://docs.wasmtime.dev/lang-rust.html) #### [write WebAssembly by Rust](https://docs.wasmtime.dev/wasm-rust.html) 源码见工程[write_wasm_by_rust](https://gitee.com/wasmtime/wasm_test/tree/master/write_wasm_by_rust) 编译前准备: 1. 安装wasmtime: curl https://wasmtime.dev/install.sh -sSf | bash source ~/.bashrc 2. rust增加target wasm32-wasi: rustup target add wasm32-wasi 3. 进入rust工程目录: binary project: write_wasm_by_rust/just_hello_wasm cargo build --target=wasm32-wasi ls target/wasm32-wasi/debug/just_hello_wasm.wasm wasmtime target/wasm32-wasi/debug/just_hello_wasm.wasm cdylib project: write_wasm_by_rust/just_hello_wasm_lib cargo wasi build ls target/wasm32-wasi/debug/just_hello_wasm_lib.wasm wasmtime --invoke print_hello target/wasm32-wasi/debug/just_hello_wasm_lib.wasm #### [利用wasmtime尝试wasm-wasi](https://rustcc.cn/article?id=b8a26e3a-16f2-4657-acdb-dd64b3a6773c)