Skip to content

Refactor: Extract C ABI exports into a dedicated boxlite-c-abi crate #225

@qidi1

Description

@qidi1

The current architecture tightly couples the C ABI exports (extern "C") within the sdks/c crate, which also serves as the C SDK distribution (containing CMake configs, headers, and tests). This creates unnecessary friction when other language bindings (like Go) simply need to link against the core C ABI.

Goal:

Decouple the C ABI implementation into a standalone crate to facilitate easier integration for future language bindings and reduce code duplication.

Proposed Plan:

  1. Create a Dedicated FFI Crate (sdks/ffi)

    • This crate will be a pure Rust library (cdylib / staticlib).
    • It will house all extern "C" function exports currently in sdks/c/src/ffi.rs.
    • It will be responsible for generating the raw dynamic/static library artifacts (libboxlite) and the C header (boxlite.h).
  2. Refactor sdks/c as a Consumer

    • Transform sdks/c into a consumer-facing SDK package.
    • It will primarily contain curated C headers, CMake build scripts, pkg-config files, and C-language examples/tests.
    • It will link against the artifacts produced by sdks/boxlite-c-abi.

Reasoning:

By isolating the C ABI implementation into its own module (boxlite-c-abi), we create a clean, reusable foundation for any language that can interface with C (FFI). This eliminates the need for each SDK (like Go) to maintain its own redundant Rust bridge layer or depend on the full C SDK build system, streamlining the addition of future language support and preventing duplicated effort.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions