Hello all!
I created an example of passing Strings and references to structs from Zig(guest) to Java(host) in WASM. All the examples I found were using null-terminated strings. This code uses a trick to return two values(pointer and length) to use regular strings.
The most important part was to allocate struct in the heap, so the lifetime is not bound to function. I love how explicit it is in Zig.
const parsed = allocator.create(std.json.Parsed(BookQuote))
Here is the video:
And the source code repository on GitHub: