Oleg Yukhnevich
02/25/2023, 11:18 AMSvyatoslav Kuzmich [JB]
03/03/2023, 9:34 AMOleg Yukhnevich
03/03/2023, 9:46 AMSvyatoslav Kuzmich [JB]
03/03/2023, 10:00 AM// stdlib
// Can only be implemented by empty top-level objects with special annotations
interface WasmMemory32
interface WasmMemory64
fun <reified T : WasmMemory32> loadInt(ptr: Pointer32): Int
fun <reified T : WasmMemory64> storeInt(ptr: Pointer64, value: Int)
// app
@WasmImport("otherModule", "memory")
object MyImportedMemory32 : WasmMemory32
@WasmMemoryLimits(minPages = 10, maxPages = 20)
object MyMemory64 : WasmMemory64
fun copyIntBetweenMemories(into: Pointer32, from: Pointer64) {
storeInt<MyImportedMemory32>(
into,
loadInt<MyMemory64>(from)
)
}
Oleg Yukhnevich
03/03/2023, 10:32 AMSvyatoslav Kuzmich [JB]
03/03/2023, 10:36 AMOleg Yukhnevich
03/03/2023, 10:39 AM