The latest version mainly focuses on compatibility with C. Pointer handling has been reworked so that you can retrieve data through C pointers (and many-item pointers) despite the lack of a length.
Most C functions should be callable on the JavaScript side now. Want to use good old fopen()
and fwrite()
, you can! There’s support for variadic functions like snprintf()
too. Technically that was the hardest part to implement but a lot of things are possible thanks to the power of Zig. I created a little web demo that showcases the new capability. It’s really utterly pointless since no one would actually use snprintf()
in JavaScript. The feature is meant more as a demonstration of how you can program at a lower, closer to the metal, level in Zig than C.
The other major addition is support for iterators. When you return a struct that has a next method, you can now retrieve items it returns using JavaScript’s for (x of y)
syntax.
Unlike previous versions, this version was tested on non-x86 platforms. It works on ARM64 on both Linux and MacOS. Couldn’t get it to run on RISCV64 due to missing support in Zig (missing ucontext_t
). It should work on PowerPC but I couldn’t test it against real hardware.
Anyway, I hope there’re people out there who find my work useful.