mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-08 02:48:04 +02:00
23 lines
633 B
Plaintext
23 lines
633 B
Plaintext
(module
|
|
(import "linking2" "double" (func $double (param i32) (result i32)))
|
|
(import "linking2" "log" (func $log (param i32 i32)))
|
|
(import "linking2" "memory" (memory 1))
|
|
(import "linking2" "memory_offset" (global $offset i32))
|
|
|
|
(func (export "run")
|
|
;; Call into the other module to double our number, and we could print it
|
|
;; here but for now we just drop it
|
|
i32.const 2
|
|
call $double
|
|
drop
|
|
|
|
;; Our `data` segment initialized our imported memory, so let's print the
|
|
;; string there now.
|
|
global.get $offset
|
|
i32.const 14
|
|
call $log
|
|
)
|
|
|
|
(data (global.get $offset) "Hello, world!\n")
|
|
)
|