Calling C Functions and Linking
Bind to libc and external libraries.
Importing Is Not Linking
@cImport gives you the declarations, but the actual machine code still lives in a C library you must link against.
Link Against libc
Most C calls need the C standard library. Tell the build to link libc so functions like printf resolve at link time.
exe.linkLibC();All lessons in this course
- Import C Headers with @cImport
- Calling C Functions and Linking
- C Pointers, Strings, and Types
- zig translate-c to Read C as Zig