# support \`\-\-target-arch wasm32\` \(\#1094\) · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/d464b2532200de3778ac7362e701791a11150d55)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: d464b2532200de3778ac7362e701791a11150d55

Requested commit: d464b2532200de3778ac7362e701791a11150d55

Commit: d464b2532200de3778ac7362e701791a11150d55

Tree: 0b78986c512fac465bd2f045ef72ff745af93354

Author: Ben Noordhuis

Committer: Andrew Kelley

## Message

```
support `--target-arch wasm32` (#1094)

Add wasm32 support to the build-obj, build-exe and build-lib commands
of the stage 1 compiler.  Wasm64 should work transparently once it's
supported in upstream LLVM.

To export a function:

    // lib.zig - for exposition, not necessary for this example
    pub use @import("add.zig");

    // add.zig
    export fn add(a: i32, b: i32) i32 {
        return a + b;
    }

To import a function:

    // cube.zig
    extern fn square(x: i32) i32;

    export fn cube(x: i32) i32 {
        return x * square(x);
    }
```

## Parents

- [7a9635555b5ddc681134ebe0e0e9f4f373ac5025](https://git.cafe/gitcafe/zig/commit/7a9635555b5ddc681134ebe0e0e9f4f373ac5025?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/d464b2532200de3778ac7362e701791a11150d55?format=markdown)
