arch-ffi

List common pitfalls in cross-platform native code using Foreign Function Interfaces.

6|1|Updated Mar 23, 2026
One-click install
npx skills add https://github.com/kubuszok/sge --skill arch-ffi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: arch-ffi
Source: https://github.com/kubuszok/sge/tree/main/.claude/skills/arch-ffi
Command: npx skills add https://github.com/kubuszok/sge --skill arch-ffi

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides a reference to the 14 most common pitfalls when dealing with Foreign Function Interfaces (FFI) in cross-platform native code, helping developers avoid common mistakes and debugging issues.

Core Features & Use Cases

  • FFI Pitfalls Reference: Offers a concise list of critical issues such as macOS main-thread (GLFW), Homebrew lib paths, Panama flags, memory segment lifetime, CFuncPtr closures, type mismatches, and Android constraints.
  • Use Case: When developers encounter issues with platform-specific native code or debugging FFI problems, this Skill serves as a quick reference to identify potential pitfalls.

Quick Start

Load the 14 FFI pitfalls reference for cross-platform native code debugging.

Frequently Asked Questions about arch-ffi

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What are the most common FFI pitfalls in cross-platform native code?

The most common FFI pitfalls involve macOS main-thread constraints, Homebrew library paths, Panama flags, memory segment lifetime, CFuncPtr closures, type mismatches, and Android constraints. This Skill provides a reference list of these 14 critical issues to help you identify and avoid them during native code debugging.

Why does my FFI code crash on macOS when calling native GUI libraries?

macOS FFI crashes often occur because native GUI libraries like GLFW require execution on the main thread. This Skill identifies this macOS main-thread issue as a critical pitfall alongside other platform-specific native code debugging problems.

How do I resolve Homebrew library path issues when debugging FFI native code?

To resolve Homebrew library path issues during FFI debugging, ensure your environment correctly points to the Homebrew installation directories. This Skill references incorrect Homebrew lib paths as a common pitfall in cross-platform native code.

Can I use this FFI pitfalls reference for Android native code constraints?

Yes, this FFI pitfalls reference covers Android constraints specific to cross-platform native code. It helps developers identify and debug platform-specific execution limitations when using Foreign Function Interfaces on Android.

What are the limitations of using CFuncPtr closures in FFI?

CFuncPtr closures in FFI face limitations related to memory segment lifetime and garbage collection timing. If the closure is collected before the native code finishes executing, it causes crashes. This Skill lists these closure issues as critical debugging pitfalls.