-
Notifications
You must be signed in to change notification settings - Fork 93
Refactor: Extract C ABI exports into a dedicated boxlite-c-abi crate #225
Description
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:
-
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 insdks/c/src/ffi.rs. - It will be responsible for generating the raw dynamic/static library artifacts (
libboxlite) and the C header (boxlite.h).
- This crate will be a pure Rust library (
-
Refactor
sdks/cas a Consumer- Transform
sdks/cinto 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.
- Transform
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.