Fix Windows cargo check

merge-requests/25/head
Martin Finkel 2026-08-31 16:48:42 +02:00
parent 90729e2bd4
commit 8af183919b
3 changed files with 16 additions and 106 deletions

View File

@ -17,110 +17,7 @@ pub const LIBVLC_EVENTS_H: u32 = 1;
pub const LIBVLC_DIALOG_H: u32 = 1;
pub const LIBVLC_VLM_H: u32 = 1;
pub const LIBVLC_DEPRECATED_H: u32 = 1;
pub type __off_t = libc::c_long;
pub type __off64_t = libc::c_long;
pub type FILE = _IO_FILE;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _IO_marker {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _IO_codecvt {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _IO_wide_data {
_unused: [u8; 0],
}
pub type _IO_lock_t = libc::c_void;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _IO_FILE {
pub _flags: libc::c_int,
pub _IO_read_ptr: *mut libc::c_char,
pub _IO_read_end: *mut libc::c_char,
pub _IO_read_base: *mut libc::c_char,
pub _IO_write_base: *mut libc::c_char,
pub _IO_write_ptr: *mut libc::c_char,
pub _IO_write_end: *mut libc::c_char,
pub _IO_buf_base: *mut libc::c_char,
pub _IO_buf_end: *mut libc::c_char,
pub _IO_save_base: *mut libc::c_char,
pub _IO_backup_base: *mut libc::c_char,
pub _IO_save_end: *mut libc::c_char,
pub _markers: *mut _IO_marker,
pub _chain: *mut _IO_FILE,
pub _fileno: libc::c_int,
pub _flags2: libc::c_int,
pub _old_offset: __off_t,
pub _cur_column: libc::c_ushort,
pub _vtable_offset: libc::c_schar,
pub _shortbuf: [libc::c_char; 1usize],
pub _lock: *mut _IO_lock_t,
pub _offset: __off64_t,
pub _codecvt: *mut _IO_codecvt,
pub _wide_data: *mut _IO_wide_data,
pub _freeres_list: *mut _IO_FILE,
pub _freeres_buf: *mut libc::c_void,
pub __pad5: usize,
pub _mode: libc::c_int,
pub _unused2: [libc::c_char; 20usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of _IO_FILE"][::core::mem::size_of::<_IO_FILE>() - 216usize];
["Alignment of _IO_FILE"][::core::mem::align_of::<_IO_FILE>() - 8usize];
["Offset of field: _IO_FILE::_flags"][::core::mem::offset_of!(_IO_FILE, _flags) - 0usize];
["Offset of field: _IO_FILE::_IO_read_ptr"]
[::core::mem::offset_of!(_IO_FILE, _IO_read_ptr) - 8usize];
["Offset of field: _IO_FILE::_IO_read_end"]
[::core::mem::offset_of!(_IO_FILE, _IO_read_end) - 16usize];
["Offset of field: _IO_FILE::_IO_read_base"]
[::core::mem::offset_of!(_IO_FILE, _IO_read_base) - 24usize];
["Offset of field: _IO_FILE::_IO_write_base"]
[::core::mem::offset_of!(_IO_FILE, _IO_write_base) - 32usize];
["Offset of field: _IO_FILE::_IO_write_ptr"]
[::core::mem::offset_of!(_IO_FILE, _IO_write_ptr) - 40usize];
["Offset of field: _IO_FILE::_IO_write_end"]
[::core::mem::offset_of!(_IO_FILE, _IO_write_end) - 48usize];
["Offset of field: _IO_FILE::_IO_buf_base"]
[::core::mem::offset_of!(_IO_FILE, _IO_buf_base) - 56usize];
["Offset of field: _IO_FILE::_IO_buf_end"]
[::core::mem::offset_of!(_IO_FILE, _IO_buf_end) - 64usize];
["Offset of field: _IO_FILE::_IO_save_base"]
[::core::mem::offset_of!(_IO_FILE, _IO_save_base) - 72usize];
["Offset of field: _IO_FILE::_IO_backup_base"]
[::core::mem::offset_of!(_IO_FILE, _IO_backup_base) - 80usize];
["Offset of field: _IO_FILE::_IO_save_end"]
[::core::mem::offset_of!(_IO_FILE, _IO_save_end) - 88usize];
["Offset of field: _IO_FILE::_markers"][::core::mem::offset_of!(_IO_FILE, _markers) - 96usize];
["Offset of field: _IO_FILE::_chain"][::core::mem::offset_of!(_IO_FILE, _chain) - 104usize];
["Offset of field: _IO_FILE::_fileno"][::core::mem::offset_of!(_IO_FILE, _fileno) - 112usize];
["Offset of field: _IO_FILE::_flags2"][::core::mem::offset_of!(_IO_FILE, _flags2) - 116usize];
["Offset of field: _IO_FILE::_old_offset"]
[::core::mem::offset_of!(_IO_FILE, _old_offset) - 120usize];
["Offset of field: _IO_FILE::_cur_column"]
[::core::mem::offset_of!(_IO_FILE, _cur_column) - 128usize];
["Offset of field: _IO_FILE::_vtable_offset"]
[::core::mem::offset_of!(_IO_FILE, _vtable_offset) - 130usize];
["Offset of field: _IO_FILE::_shortbuf"]
[::core::mem::offset_of!(_IO_FILE, _shortbuf) - 131usize];
["Offset of field: _IO_FILE::_lock"][::core::mem::offset_of!(_IO_FILE, _lock) - 136usize];
["Offset of field: _IO_FILE::_offset"][::core::mem::offset_of!(_IO_FILE, _offset) - 144usize];
["Offset of field: _IO_FILE::_codecvt"][::core::mem::offset_of!(_IO_FILE, _codecvt) - 152usize];
["Offset of field: _IO_FILE::_wide_data"]
[::core::mem::offset_of!(_IO_FILE, _wide_data) - 160usize];
["Offset of field: _IO_FILE::_freeres_list"]
[::core::mem::offset_of!(_IO_FILE, _freeres_list) - 168usize];
["Offset of field: _IO_FILE::_freeres_buf"]
[::core::mem::offset_of!(_IO_FILE, _freeres_buf) - 176usize];
["Offset of field: _IO_FILE::__pad5"][::core::mem::offset_of!(_IO_FILE, __pad5) - 184usize];
["Offset of field: _IO_FILE::_mode"][::core::mem::offset_of!(_IO_FILE, _mode) - 192usize];
["Offset of field: _IO_FILE::_unused2"][::core::mem::offset_of!(_IO_FILE, _unused2) - 196usize];
};
pub type FILE = libc::FILE;
unsafe extern "C" {
pub fn vsnprintf(
__s: *mut libc::c_char,

View File

@ -3,6 +3,13 @@
/// Minimum supported libvlc version.
const MIN_LIBVLC_VERSION: &str = "3.0.0";
// `vswhom-sys` compiles a C++ helper that calls the Windows Registry API, but
// does not declare its Advapi32 dependency. Declare it here so this build
// script can itself be linked before it runs.
#[cfg(target_os = "windows")]
#[link(name = "advapi32")]
unsafe extern "C" {}
/// Locate libvlc via pkg-config.
fn probe_libvlc() -> Result<pkg_config::Library, pkg_config::Error> {
pkg_config::Config::new()
@ -125,11 +132,11 @@ mod windows {
fn main() {
// On success pkg-config has already emitted the link directives; only the
// failure path needs handling.
if let Err(err) = probe_libvlc() {
if let Err(_err) = probe_libvlc() {
#[cfg(target_os = "windows")]
windows::link_vlc();
#[cfg(not(target_os = "windows"))]
panic!("libvlc (>= {}) not found: {:?}", MIN_LIBVLC_VERSION, err);
panic!("libvlc (>= {}) not found: {:?}", MIN_LIBVLC_VERSION, _err);
}
}

View File

@ -46,6 +46,12 @@ fn generate_bindings() {
// Required by the Windows `legacy_stdio_definitions` link workaround
// (see libvlc-sys/build.rs).
.allowlist_function("vsnprintf")
// `FILE` is platform-specific. The bindings only use it behind a
// pointer, so use libc's target-appropriate opaque definition instead
// of embedding the host platform's C library internals.
.blocklist_type("FILE")
.blocklist_type("_IO_.*")
.raw_line("pub type FILE = libc::FILE;")
// Block the whole va_list family and rewrite the parameters bindings to our own `VaList`,
// which is ABI-correct on every target.
.blocklist_type(".*va_list.*")