Skip to content

Commit c420ce1

Browse files
refactor(lang/c): Revise and expand on C/C++ language support section (#298)
* Revise and expand on C/C++ language support section I tried to define some undefined terms, and verified the commands and their output. * Update component-model/src/language-support/c.md Co-authored-by: Victor Adossi <[email protected]> * Update component-model/src/language-support/c.md Co-authored-by: Victor Adossi <[email protected]> * Update component-model/src/language-support/c.md Co-authored-by: Victor Adossi <[email protected]> * Update component-model/src/language-support/c.md Co-authored-by: Victor Adossi <[email protected]> * Update component-model/src/language-support/c.md Co-authored-by: Victor Adossi <[email protected]> * Update component-model/src/language-support/c.md Co-authored-by: Victor Adossi <[email protected]> * Update component-model/src/language-support/c.md Co-authored-by: Victor Adossi <[email protected]> * Fix markup in NOTE * Fix backtick spacing * Update component-model/src/language-support/c.md Co-authored-by: Victor Adossi <[email protected]> * Update component-model/src/language-support/c.md Co-authored-by: Victor Adossi <[email protected]> * Update component-model/src/language-support/c.md Co-authored-by: Victor Adossi <[email protected]> * Update component-model/src/language-support/c.md Co-authored-by: Victor Adossi <[email protected]> * Update component-model/src/language-support/c.md Co-authored-by: Victor Adossi <[email protected]> * Update component-model/src/language-support/c.md Co-authored-by: Victor Adossi <[email protected]> * Update component-model/src/language-support/c.md Co-authored-by: Victor Adossi <[email protected]> * Update component-model/src/language-support/c.md Co-authored-by: Victor Adossi <[email protected]> * Update component-model/src/language-support/c.md Co-authored-by: Victor Adossi <[email protected]> * Update component-model/src/language-support/c.md Co-authored-by: Victor Adossi <[email protected]> * Update component-model/src/language-support/c.md Co-authored-by: Victor Adossi <[email protected]> * Update component-model/src/language-support/c.md Co-authored-by: Victor Adossi <[email protected]> * Update component-model/src/language-support/c.md Co-authored-by: Victor Adossi <[email protected]> * Update component-model/src/language-support/c.md Co-authored-by: Victor Adossi <[email protected]> * Update component-model/src/language-support/c.md Co-authored-by: Victor Adossi <[email protected]> * Update component-model/src/language-support/c.md Co-authored-by: Victor Adossi <[email protected]> * Update component-model/src/language-support/c.md Co-authored-by: Victor Adossi <[email protected]> * Update component-model/src/language-support/c.md Co-authored-by: Victor Adossi <[email protected]> * Update component-model/src/language-support/c.md Co-authored-by: Victor Adossi <[email protected]> * Indent note about PATH * Minor fixes * Add comment in component_with_printf example * Fix broken 'Add WASI to Linker' link * Address review feedback --------- Co-authored-by: Victor Adossi <[email protected]>
1 parent 42d27ba commit c420ce1

File tree

3 files changed

+250
-82
lines changed

3 files changed

+250
-82
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include "adder.h"
2+
3+
uint32_t exports_docs_adder_add_add(uint32_t x, uint32_t y)
4+
{
5+
return x + y;
6+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#include "adder.h"
2+
#include <stdio.h>
3+
4+
uint32_t exports_docs_adder_add_add(uint32_t x, uint32_t y)
5+
{
6+
uint32_t result = x + y;
7+
// On traditional platforms, printf() prints to stdout, but on Wasm platforms,
8+
// stdout and the idea of printing to an output stream is
9+
// introduced and managed by WASI.
10+
//
11+
// When building this code with wasi-libc (as a part of wasi-sdk), the printf call
12+
// below is implemented with code that uses `wasi:cli/stdout` and `wasi:io/streams`.
13+
printf("%d", result);
14+
return result;
15+
}

0 commit comments

Comments
 (0)