From d277f5e846033d983a961851bf123287b5fa1f94 Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 1 Apr 2024 16:22:36 +0200 Subject: [PATCH] Add Foreign Functions --- src/guide/functions.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/guide/functions.md b/src/guide/functions.md index a83a5092..4f6b58db 100644 --- a/src/guide/functions.md +++ b/src/guide/functions.md @@ -230,3 +230,13 @@ counter() // 3 ``` The `makeCounter` function returns a counter function which will print sequential numbers when called. + +## Foreign Functions + +A foreign function declaration can be used to import functions from the webassembly host. + +```grain +foreign wasm alert: WasmI32 => Void from "host" + +alert(42) +```