Skip to content

Extend rust-development with FFI and cross-language integration section #64

@AlexMikhalev

Description

@AlexMikhalev

Parent Epic: #62

What

Add FFI and cross-language integration patterns to rust-development SKILL.md.

Sections to Add

  1. Safe C API Wrappers -- Opaque handle pattern, #[repr(C)] structs, extern "C" functions
  2. Panic Catching at FFI Boundary -- std::panic::catch_unwind at every extern entry point
  3. String Management Across Languages -- CString/CStr patterns, null-terminated strings, ownership transfer
  4. uniffi for Automatic Bindings -- Generating Kotlin/Swift/Python bindings from Rust
  5. WASM Interop Patterns -- wasm-bindgen, js-sys, shared memory, serde-wasm-bindgen

Source Reference

Section 10 (FFI and Cross-Language Integration) from RUST_SYSTEM_PROGRAMMING_BEST_PRACTICES.md

Disciplined Engineering Alignment

Phase Skill FFI Relevance
Research disciplined-research Map FFI boundary surface area; identify which language bindings needed; catalogue existing unsafe FFI
Design disciplined-design Define opaque handle API; specify ownership transfer rules; document WASM vs native FFI strategy
Implementation disciplined-implementation Each FFI function = one step with safety invariants documented; panic-catch wrappers first, then logic
Verification disciplined-verification Miri on unsafe FFI paths; property tests for string conversion roundtrips; fuzz parsers at boundary
Validation disciplined-validation Validate bindings from target language (Kotlin/Swift/JS); end-to-end cross-language integration test

The SKILL.md should note:

  • During research: audit all extern blocks and unsafe FFI for safety gaps
  • During design: specify ownership transfer semantics at every FFI boundary
  • During verification: Miri + fuzzing mandatory for any new FFI surface

Acceptance Criteria

  • SKILL.md updated with FFI section including code examples
  • WASM-specific patterns included (not just C FFI)
  • Unsafe code policy section cross-referenced
  • Disciplined workflow integration notes included

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions