心得和例子已被整合到工程wasm-usage-guide中。
当下,wasm 已被大多浏览器实现,其设计很巧妙,理论上任何可以编译成 LLVM 字节码的语言都可以被编译到 wasm (借助 llc 和 binary ),在这个项目中,我对几种编译方式进行了实践并总结出了一些心得:
有兴趣的话,可以直接 clone 下来研究,写的都很全了。
如有疏忽请指出。
1
bramblex 116 天前 via iPhone
好东西啊好东西,最后心疼一下 js
|
2
AngelCriss 116 天前 via Android
@bramblex 又见 jj 的思念
|
![]() |
3
zhouheyang0919 116 天前
现在 Rust 的 nightly 版本有一个 target: wasm32-unknown-unknown 可以直接编译到 WebAssembly,不需要手动编译到 LLVM bitcode 或借助 emscripten.
|
![]() |
4
dtysky 116 天前
@zhouheyang0919
嗯,昨儿有人提了个 issue,我早上加到说明里了 Now, rustc supports another method to generate pure wasm file, please see here for resolution: [Rust for the Web]( https://www.hellorust.com/setup/wasm-target/): ```bash rustc --target wasm32-unknown-unknown yourCode.rs -o yourCode.wasm ``` For reducing the size of file, your need to install **wasm-gc**: ```bash cargo install --git https://github.com/alexcrichton/wasm-gc wasm-gc yourCode.wasm small-yourCode.wasm ``` |