From 1256c4248d2a3a9f73c2a14d997a337ba0eee2b4 Mon Sep 17 00:00:00 2001 From: Henry Gressmann Date: Tue, 21 Nov 2023 16:48:33 +0100 Subject: initial commit Signed-off-by: Henry Gressmann --- crates/core/helloworld.wat | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 crates/core/helloworld.wat (limited to 'crates/core/helloworld.wat') 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 -- cgit v1.3.1