|
5 | 5 | The `wasm32-unknown-emscripten` target is a WebAssembly compilation target which
|
6 | 6 | uses the [Emscripten](https://emscripten.org/) compiler toolchain. Emscripten is
|
7 | 7 | a C/C++ toolchain designed to make it as easy as possible to port C/C++ code
|
8 |
| -written for Linux to run on the web. It thus provides POSIX-compatible (musl) `libc` |
9 |
| -and `libstd` implementations and many Linux APIs, access to the OpenGL and SDL APIs, |
10 |
| -and the ability to run arbitrary JavaScript code, all based on web APIs using JS |
11 |
| -glue code. With the `wasm32-unknown-emscripten` target, Rust code can interoperate |
12 |
| -with Emscripten's ecosystem, C/C++ and JS code, and web APIs. |
| 8 | +written for Linux to run on the web or in other JavaScript runtimes such as Node. |
| 9 | +It thus provides POSIX-compatible (musl) `libc` and `libstd` implementations and |
| 10 | +many Linux APIs, access to the OpenGL and SDL APIs, and the ability to run arbitrary |
| 11 | +JavaScript code, all based on web APIs using JS glue code. With the |
| 12 | +`wasm32-unknown-emscripten` target, Rust code can interoperate with Emscripten's |
| 13 | +ecosystem, C/C++ and JS code, and web APIs. |
13 | 14 |
|
14 | 15 | One existing user of this target is the
|
15 | 16 | [`pyodide` project](https://pyodide.org/) which provides a Python runtime in
|
16 | 17 | WebAssembly using Emscripten and compiles Python extension modules written in Rust
|
17 | 18 | to the `wasm32-unknown-emscripten` target.
|
18 | 19 |
|
19 |
| -If you want to generate a standalone WebAssembly binary that does not |
20 |
| -require access to the web APIs or the Rust standard library, |
21 |
| -the [`wasm32-unknown-unknown`](./wasm32-unknown-unknown.md) target may be better |
22 |
| -suited for you. However, [`wasm32-unknown-unknown`](./wasm32-unknown-unknown.md) does not (easily) |
23 |
| -support interop with C/C++ code. |
| 20 | +If you want to generate a standalone WebAssembly binary that does not require |
| 21 | +access to the web APIs or the Rust standard library, the |
| 22 | +[`wasm32-unknown-unknown`](./wasm32-unknown-unknown.md) target may be better |
| 23 | +suited for you. However, [`wasm32-unknown-unknown`](./wasm32-unknown-unknown.md) |
| 24 | +does not (easily) support interop with C/C++ code. Please refer to the |
| 25 | +[wasm-bindgen](https://crates.io/crates/wasm-bindgen) crate in case you want to |
| 26 | +interoperate with JavaScript with this target. |
24 | 27 |
|
25 | 28 | Like Emscripten, the WASI targets [`wasm32-wasip1`](./wasm32-wasip1.md) and
|
26 | 29 | [`wasm32-wasip2`](./wasm32-wasip2.md) also provide access to the host environment,
|
@@ -118,8 +121,8 @@ To run these tests, both `emcc` and `node` need to be in your `$PATH`. You can
|
118 | 121 | install `node`, for example, using `nvm` by following the instructions at
|
119 | 122 | <https://github.com/nvm-sh/nvm#install--update-script>.
|
120 | 123 |
|
121 |
| -Still, it's recommended to test the [`wasm32-wasip1`](./wasm32-wasip1.md) target |
122 |
| -instead for WebAssembly compatibility. |
| 124 | +If you need to test WebAssembly compatibility *in general*, it is recommended |
| 125 | +to test the [`wasm32-wasip1`](./wasm32-wasip1.md) target instead. |
123 | 126 |
|
124 | 127 | ## Conditionally compiling code
|
125 | 128 |
|
|
0 commit comments