Hi,
I understood I can define external javascript objects that can be used in the zig program. I found that the browser console can be defined in the WASM loader as:
var importObject = {
env: {
consoleLog: (arg) => console.log(arg), // Useful for debugging on zig's side
memory: memory,
},
};
WebAssembly.instantiateStreaming(fetch("bootloader.wasm"), importObject)
Then in the zig code I was able to define:
extern fn consoleLog(arg: u32) void;
But writing only a integer is not that useful... How can I define consoleLog argument to accept a string so I guess an array of u8 of undefined size?
I tried multiple things but nothing the compiler accepted π
Thanks!