diff options
| author | Henry Gressmann <mail@henrygressmann.de> | 2023-11-21 16:48:33 +0100 |
|---|---|---|
| committer | Henry Gressmann <mail@henrygressmann.de> | 2023-11-21 16:48:33 +0100 |
| commit | 1256c4248d2a3a9f73c2a14d997a337ba0eee2b4 (patch) | |
| tree | 85cf0b7a1bc33b9ffb40837295053285c14e8340 /crates/core/helloworld.wat | |
initial commit
Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
Diffstat (limited to 'crates/core/helloworld.wat')
| -rw-r--r-- | crates/core/helloworld.wat | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/crates/core/helloworld.wat b/crates/core/helloworld.wat new file mode 100644 index 0000000..b74c98f --- /dev/null +++ b/crates/core/helloworld.wat @@ -0,0 +1,15 @@ +(module + ;; Imports from JavaScript namespace + (import "console" "log" (func $log (param i32 i32))) ;; Import log function + (import "js" "mem" (memory 1)) ;; Import 1 page of memory (54kb) + + ;; Data section of our module + (data (i32.const 0) "Hello World from WebAssembly!") + + ;; Function declaration: Exported as helloWorld(), no arguments + (func (export "helloWorld") + i32.const 0 ;; pass offset 0 to log + i32.const 29 ;; pass length 29 to log (strlen of sample text) + call $log + ) +)
\ No newline at end of file |
