From af83b1d8f861ec709bda71a3577a4c989f4ec016 Mon Sep 17 00:00:00 2001 From: streamcode9 Date: Sun, 21 Sep 2025 19:33:42 +0200 Subject: [PATCH] Expose greeting helpers for WebAssembly --- wasm/hello.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/wasm/hello.c b/wasm/hello.c index f3b4f7b..bd79652 100644 --- a/wasm/hello.c +++ b/wasm/hello.c @@ -1,7 +1,16 @@ -#include +#include +#include -int main(void) +static const char GREETING[] = "Hello from WebAssembly!"; + +EMSCRIPTEN_KEEPALIVE +const char *get_greeting(void) +{ + return GREETING; +} + +EMSCRIPTEN_KEEPALIVE +size_t get_greeting_length(void) { - printf("Hello, world!\n"); - return 0; + return sizeof(GREETING) - 1; }