C Interop

Guide for Zig and C interoperability. Use when importing C headers with @cImport, exporting Zig functions to C, mapping C types, using translate-c, or linking C libraries.

vinnie357 27b8e96 2 files · 3.2 KB Updated

File contents

Zig C Interop

Importing C libraries, exporting Zig to C, type mappings, and translate-c.

For type mappings, linking patterns, and string interop examples, see references/c-interop.md.

Anti-fabrication

This skill follows core:anti-fabrication. Verified against zig 0.16.0 (locally installed, claude-skills-204): references/c-interop.md's type mappings and linking snippets compile as documented — no corrections needed here. A related claim, that @cImport emits a deprecation warning, was found wrong and corrected, but that claim lived in the troubleshooting skill's compiler-error catalog, not in this file. Re-verify against a locally installed zig build-exe with a real C header before asserting a type mapping this skill doesn't cover — Zig is pre-1.0 and translate-c behavior has changed across minor releases.

vinnie357/claude-skills/tree/main/plugins/languages/zig/skills/c-interop commit 27b8e961db

Frequently asked questions

npx skillmds add vinnie357/c-interop