Zig NEWS

Discussion on: How to escape Python and write more Zig

Collapse
 
guidorice profile image
guidorice

Nice post! I just confirmed this works on macos-arm64 as well. Couple of additional notes:

If you want to use zig's build system (e.g. project created with zig init-lib), then just change line 18 of build.zig to be a shared lib:

// const lib = b.addStaticLibrary(.{
const lib = b.addSharedLibrary(.{
Enter fullscreen mode Exit fullscreen mode

Then on the python side the file extension would be in a subfolder (again this is on macos).

simple = cffi.dlopen(os.path.abspath("zig-out/lib/projectname.dylib"))
Enter fullscreen mode Exit fullscreen mode