Skip to content

[Draft] Optional C FFI ABI - #16

Draft
ShayBox wants to merge 2 commits into
masterfrom
c-ffi-abi-wip
Draft

[Draft] Optional C FFI ABI#16
ShayBox wants to merge 2 commits into
masterfrom
c-ffi-abi-wip

Conversation

@ShayBox

@ShayBox ShayBox commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Open discussion on the requested C FFI ABI, I'm not a big C user so I used Qwen3.6 27b to help, so this might be a complete dumpster fire. Let me know what you think, what should be changed, or if it should be deleted off the face of the earth. Feel free to nitpick or scream bloody murder.

Should I include builds of the library in the GitHub releases with the CLI binaries?

@SpookySkeletons

Copy link
Copy Markdown

Could we get an ABI versioning symbol here? If we need to change the interface and are using dlopen that would cause issues.

Comment thread src/ffi.rs Outdated
Comment thread src/ffi.rs Outdated
Comment thread src/ffi.rs
Comment thread src/ffi.rs
/// # Panics
/// Panics if the arena lock is poisoned during the scan write phase.
#[unsafe(no_mangle)]
pub unsafe extern "C" fn lighthouse_scan(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto, for setting count to 0 on error

@SpookySkeletons

Copy link
Copy Markdown

Could we use c_char for the BSID instead of the int8?

Comment thread src/ffi.rs
@SpookySkeletons

Copy link
Copy Markdown

iirc my AUR 1.4.0 folded STANDBY commands into OFF for V1 lighthouses, might be better to guard caller against bad commands by keeping the fold with a comment.

@ShayBox

ShayBox commented Aug 14, 2026

Copy link
Copy Markdown
Owner Author

iirc my AUR 1.4.0 folded STANDBY commands into OFF for V1 lighthouses, might be better to guard caller against bad commands by keeping the fold with a comment.

This version v1 guards against using the STANDBY command

if matches!(state, State::Standby) {
    return Err(Error::InvalidState(
        "V1 base stations do not support STANDBY, use OFF or ON".into(),
    ));
}

Did you still want STANDBY to fallback to OFF for v1 with warning message?

I made the suggested changes, let me know if there's anything else I should change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants