Skip to content

Commit

Permalink
examples/wasm2cstruct/README.md: mention runwasi_cstruct
Browse files Browse the repository at this point in the history
  • Loading branch information
yamt committed Aug 3, 2024
1 parent 41e3192 commit 6960756
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion examples/wasm2cstruct/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ which provides a structure which represents the loaded module.
(`struct module`)

```shell
% wasm2cstruct g_wasm_module foo.wasm | clang-format > foo.c
% wasm2cstruct g_wasm_module foo.wasm | clang-format > module.c
```

Note: the first argument is the C symbol to use.

Note: `clang-format` here is just for possible human-readers of the module.

The generated C source file contains a single exported symbol for the
`struct module`.

Expand All @@ -22,6 +24,11 @@ extern struct module g_wasm_module;
instance_create(..., &g_wasm_module, ...);
```
See [runwasi_cstruct] for a complete example to consume
the generated C source file.
[runwasi_cstruct]: ../runwasi_cstruct
* This effectively preloads a module at the build-time of the embedder.
* The generated structure and its all dependencies are `const` qualified.
Expand Down

0 comments on commit 6960756

Please sign in to comment.