Skip to content

std::ffi::VaList does not match esp_idf_sys::va_list #239

@jothan

Description

@jothan

I tried this code:

extern "C" {
    fn vsnprintf(s: *mut c_char, n: usize, format: *const c_char, ap: VaList) -> c_int;
}

Calling the above function with this signature crashes.

Instead, replacing VaList with VaListImpl works.

extern "C" {
    fn vsnprintf(s: *mut c_char, n: usize, format: *const c_char, ap: VaListImpl) -> c_int;
}

The underlying issue seems that VaList should contain 3 u32 fields instead of being single pointer sized.

Details in PR #238

Meta

rustc --version --verbose:

rustc 1.81.0-nightly (02368e90f 2024-09-03) (1.81.0.0)
binary: rustc
commit-hash: 02368e90f28c216258b47072a65cb6b4991fc0ed
commit-date: 2024-09-03
host: x86_64-unknown-linux-gnu
release: 1.81.0-nightly
LLVM version: 17.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions