Build C static library

Hello!

Is there an option to build C ABI compatible static library for further linking in C project?

Hello @ssilnicki-dev

Yes, zig init generates demo code for a working executable and working a static library callable from C.

Add the export keyword before fn to export a function using each platforms C ABI.
In your build.zig call addStaticLibrary to produce a static library .a/.lib file.

2 Likes