|
|
|
|
|
by stratts
368 days ago
|
|
Package management in Zig is more manual than Rust, involving fetching the package URL using the CLI, then importing the module in your build script. This has its upsides - you can depend on arbitrary archives, so lots of Zig packages of C libraries are just a build script with a dependency on a unmodified tarball release. But obviously it's a little trickier for beginners. SDL3 has both a native Zig wrapper: https://github.com/Gota7/zig-sdl3 And a more basic repackaging on the C library/API: https://github.com/castholm/SDL For QuickJS, the only option is the C API: https://github.com/allyourcodebase/quickjs-ng Zig makes it really easy to use C packages directly like this, though Zig's types are much more strict so you'll inevitably be doing a lot of casting when interacting with the API |
|
Even this is pretty usable, handling value conversions and such thanks to comptime. (Take a look at the tests here: https://github.com/eknkc/zquickjs/blob/master/src/root.zig)