| ... | @@ -11336,12 +11336,12 @@ all your base are belong to us{#end_shell_samp#} | ... | @@ -11336,12 +11336,12 @@ all your base are belong to us{#end_shell_samp#} |
| 11336 | {#header_open|WebAssembly#} | 11336 | {#header_open|WebAssembly#} |
| 11337 | <p>Zig supports building for WebAssembly out of the box.</p> | 11337 | <p>Zig supports building for WebAssembly out of the box.</p> |
| 11338 | {#header_open|Freestanding#} | 11338 | {#header_open|Freestanding#} |
| 11339 | <p>For host environments like the web browser and nodejs, build as a dynamic library using the freestanding | 11339 | <p>For host environments like the web browser and nodejs, build as an executable using the freestanding |
| 11340 | OS target. Here's an example of running Zig code compiled to WebAssembly with nodejs.</p> | 11340 | OS target. Here's an example of running Zig code compiled to WebAssembly with nodejs.</p> |
| 11341 | {#code_begin|lib|math#} | 11341 | {#code_begin|exe|math#} |
| 11342 | {#target_wasm#} | 11342 | {#target_wasm#} |
| 11343 | {#link_mode_dynamic#} | 11343 | {#additonal_option|-fno-entry#} |
| 11344 | {#additonal_option|-rdynamic#} | 11344 | {#additonal_option|--export=add#} |
| 11345 | extern fn print(i32) void; | 11345 | extern fn print(i32) void; |
| 11346 | | 11346 | |
| 11347 | export fn add(a: i32, b: i32) void { | 11347 | export fn add(a: i32, b: i32) void { |