diff options
Diffstat (limited to 'examples/wasm')
| -rw-r--r-- | examples/wasm/helloworld.wasm | bin | 0 -> 115 bytes | |||
| -rw-r--r-- | examples/wasm/helloworld.wat | 15 |
2 files changed, 15 insertions, 0 deletions
diff --git a/examples/wasm/helloworld.wasm b/examples/wasm/helloworld.wasm Binary files differnew file mode 100644 index 0000000..a5c95d0 --- /dev/null +++ b/examples/wasm/helloworld.wasm diff --git a/examples/wasm/helloworld.wat b/examples/wasm/helloworld.wat new file mode 100644 index 0000000..b74c98f --- /dev/null +++ b/examples/wasm/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 |
