xref: /wasmtime-44.0.1/examples/linking1.wat (revision e245e6dd)
1(module
2  (import "linking2" "double" (func $double (param i32) (result i32)))
3  (import "linking2" "log" (func $log (param i32 i32)))
4  (import "linking2" "memory" (memory 1))
5  (import "linking2" "memory_offset" (global $offset i32))
6
7  (func (export "run")
8    ;; Call into the other module to double our number, and we could print it
9    ;; here but for now we just drop it
10    i32.const 2
11    call $double
12    drop
13
14    ;; Our `data` segment initialized our imported memory, so let's print the
15    ;; string there now.
16    global.get $offset
17    i32.const 14
18    call $log
19  )
20
21  (data (global.get $offset) "Hello, world!\n")
22)
23
24