FFI Bindings Fetcher
Overview
Nethercore ZX FFI bindings are auto-generated at build time and hosted publicly on GitHub. Always fetch the complete bindings file - never copy individual functions inline.
Bindings URLs
| Language | GitHub URL |
|---|---|
| Rust | https://raw.githubusercontent.com/nethercore-systems/nethercore/main/include/zx.rs |
| C | https://raw.githubusercontent.com/nethercore-systems/nethercore/main/include/zx.h |
| Zig | https://raw.githubusercontent.com/nethercore-systems/nethercore/main/include/zx.zig |
Fetch Commands
Rust Projects
# Fetch to src/zx.rs
curl -o src/zx.rs https://raw.githubusercontent.com/nethercore-systems/nethercore/main/include/zx.rs
Usage in code:
// src/lib.rs
mod zx;
use zx::*;
// src/player.rs (or any other module)
use crate::zx::*;
C Projects
# Fetch to project root
curl -o zx.h https://raw.githubusercontent.com/nethercore-systems/nethercore/main/include/zx.h
Usage in code:
#include "zx.h"
Zig Projects
# Fetch to src/zx.zig
curl -o src/zx.zig https://raw.githubusercontent.com/nethercore-systems/nethercore/main/include/zx.zig
Usage in code:
const zx = @import("zx.zig");
Fetching via WebFetch
When using Claude Code's WebFetch tool to retrieve bindings:
Prompt: "Return the complete file contents exactly as-is. This is FFI bindings code."
Save the fetched content to the appropriate location:
- Rust:
src/zx.rs - C:
zx.h(project root) - Zig:
src/zx.zig
When to Update Bindings
Update bindings when:
- Starting a new project
- After a Nethercore console update
- When encountering FFI function signature errors
- When needing newly added FFI functions
Critical Rules
- Never edit bindings files - They are auto-generated and will be overwritten
- Never copy functions inline - Always use the complete bindings file
- Use module imports - Access FFI through proper module system
- Keep lib.rs minimal - Only mod declarations and entry points (~50 lines)
Project File Limits
When generating game code, follow these limits:
| File | Max Lines | Purpose |
|---|---|---|
| lib.rs/main.zig/game.c | 50 | Entry points + mod declarations only |
| System files | 300 | Individual game systems |
| Feature directories | 300/file | Complex features split into modules |
Bindings Contents
The bindings files contain (~1700 lines for Rust):
- FFI function declarations
- Type definitions (handles, enums, structs)
- Helper functions and macros
- Complete documentation comments
All 250+ FFI functions are included - no need to add anything manually.