mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
docs: update WebAssembly freestanding example
This commit is contained in:
parent
938f9dea37
commit
5b2ee5eacc
1 changed files with 4 additions and 4 deletions
|
|
@ -11336,12 +11336,12 @@ all your base are belong to us{#end_shell_samp#}
|
|||
{#header_open|WebAssembly#}
|
||||
<p>Zig supports building for WebAssembly out of the box.</p>
|
||||
{#header_open|Freestanding#}
|
||||
<p>For host environments like the web browser and nodejs, build as a dynamic library using the freestanding
|
||||
<p>For host environments like the web browser and nodejs, build as an executable using the freestanding
|
||||
OS target. Here's an example of running Zig code compiled to WebAssembly with nodejs.</p>
|
||||
{#code_begin|lib|math#}
|
||||
{#code_begin|exe|math#}
|
||||
{#target_wasm#}
|
||||
{#link_mode_dynamic#}
|
||||
{#additonal_option|-rdynamic#}
|
||||
{#additonal_option|-fno-entry#}
|
||||
{#additonal_option|--export=add#}
|
||||
extern fn print(i32) void;
|
||||
|
||||
export fn add(a: i32, b: i32) void {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue