Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Commit 49afdef

Browse files
authored
Merge pull request #430 from systemcrash/patch-1
Update README.md
2 parents 326317e + b826c09 commit 49afdef

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

templates/hello_world_c/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This project prints `"Hello World"` using the well known C `printf` function. Th
1515

1616
2. Open the `out/main.wasm` file and notice that there's quite a bit of code. This is somewhat surprising given that our program is so small. The vast majority of this code implements the `printf` function.
1717

18-
3. Notice the imports section, these are SysCalls. To get this WebAssembly module running you'll have to implement these functions first. However, note that these import names don't actually tell you what SysCalls are used, they are merely function stubs (one for each number of parameters).
18+
3. Notice the imports section, these are SysCalls. To get this WebAssembly module running you'll have to implement these functions first. However, note that these import names don't actually tell you what SysCalls are used; they are merely function stubs (one for each number of the parameters).
1919

2020
```
2121
(import "env" "__syscall0" (func $env.__syscall0 (type $t2)))
@@ -28,14 +28,14 @@ This project prints `"Hello World"` using the well known C `printf` function. Th
2828

2929
5. Take a look at `src/main.js`, this file emulates these basic SysCalls in JavaScript.
3030

31-
6. `brk()` can be stubbed to return `0`, which is the success error code. `brk()` is used to allocate more memory to a process. WebAssembly does handles memory differently, so there's no need to do special here.
31+
6. `brk()` can be stubbed to return `0`, which is the success error code. `brk()` is used to allocate more memory to a process. WebAssembly handles memory differently, so there's no need to be special here.
3232

3333
7. `mmap2()` is used to request more memory within the process. In our example, it's implemented as a call to the WebAssembly `memory.grow()` function.
3434

35-
8. `writev()` is used to write data to files. Its signature is `writev(int fd, const struct iovec *iov, int iovcnt)`. We can ignore the `fd` file descriptor parameter, and focus on the `iov` structure. The problem here is that on the JavaScript side we have a hard time pulling the `struct iovec` abart. We could figure it out, but a neat hack is to call back into the WebAssembly module and have some C code unpack it for us.
35+
8. `writev()` is used to write data to files. Its signature is `writev(int fd, const struct iovec *iov, int iovcnt)`. We can ignore the `fd` file descriptor parameter, and focus on the `iov` structure. The problem here is that on the JavaScript side we have a hard time pulling the `struct iovec` apart. We could figure it out, but a neat hack is to call back into the WebAssembly module and have some C code unpack it for us.
3636

3737
9. Click Run
3838

3939
```
4040
Hello World
41-
```
41+
```

0 commit comments

Comments
 (0)