Refactor: Extract FFI code to dedicated crate#226
Refactor: Extract FFI code to dedicated crate#226DorianZheng merged 1 commit intoboxlite-ai:mainfrom
Conversation
4b47ede to
53aa766
Compare
Signed-off-by: 季扎 <[email protected]>
53aa766 to
52ae09b
Compare
|
@DorianZheng Please have a look. Reason: What I tried: Question: |
| state.set_status(BoxStatus::Stopped); | ||
| state.set_pid(None); | ||
|
|
||
| // Only transition to Stopped if we were Running (or other active state). |
|
@qidi1 Thank you very much
Hi @qidi1. I will review and merge this PR after review, and it's better to have a Mock method to run the UT in a separate PR. What do you think? |
|
Regenerate C header when shared FFI sources change — /Users/zhengzhiquan/Workspace/boxlite/sdks/c/build.rs:24-25 After this refactor, cbindgen pulls public types from boxlite-ffi (parse_deps = true), but the build script only reruns when sdks/c/src or cbindgen.toml change. If only sdks/boxlite-ffi changes, |
I will add in other PR |
Great! I will just merge this PR and please file another PR for mock for UT |
Close #225
This PR extracts the FFI logic from the C SDK into a dedicated
boxlite-fficrate.Changes
sdks/c/src/ffi.rstosdks/boxlite-ffi/src/ops.rs.error.rs,json.rs, andstring.rsinboxlite-ffi.sdks/cto depend on the new shared crate.Motivation
This refactoring allows reusing the core FFI implementation across multiple language bindings (C, Go, Node.js, Python), significantly reducing code duplication and simplifying maintenance. It is a necessary step for cleaner SDK architecture.
This work also prepares the codebase for the Go SDK implementation. As noted in #202, the Go SDK development will be completed after this PR is merged.