libvlc-sys: map FILE to libc's opaque type
libvlc only ever takes a FILE by pointer on the log callback, but bindgen emitted glibc's concrete _IO_FILE along with a layout assert baking in the host's field offsets. That assert fails on MSVC and forces new bindings generation specific for it. Blocklisting the type and re-exporting libc's FILE, which is opaque works around the issue.master
parent
58165af5b8
commit
7f8a2dd64d
|
|
@ -1,5 +1,6 @@
|
||||||
/* automatically generated by rust-bindgen 0.72.1 */
|
/* automatically generated by rust-bindgen 0.72.1 */
|
||||||
|
|
||||||
|
pub use libc::FILE;
|
||||||
pub use crate::valist::VaList;
|
pub use crate::valist::VaList;
|
||||||
|
|
||||||
pub const VLC_VLC_H: u32 = 1;
|
pub const VLC_VLC_H: u32 = 1;
|
||||||
|
|
@ -19,108 +20,6 @@ pub const LIBVLC_VLM_H: u32 = 1;
|
||||||
pub const LIBVLC_DEPRECATED_H: u32 = 1;
|
pub const LIBVLC_DEPRECATED_H: u32 = 1;
|
||||||
pub type __off_t = libc::c_long;
|
pub type __off_t = libc::c_long;
|
||||||
pub type __off64_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];
|
|
||||||
};
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
pub struct libvlc_instance_t {
|
pub struct libvlc_instance_t {
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,12 @@ fn generate_bindings() {
|
||||||
// Required by the Windows `legacy_stdio_definitions` link workaround
|
// Required by the Windows `legacy_stdio_definitions` link workaround
|
||||||
// (see libvlc-sys/build.rs).
|
// (see libvlc-sys/build.rs).
|
||||||
.allowlist_function("vsnprintf")
|
.allowlist_function("vsnprintf")
|
||||||
|
// libvlc only uses FILE behind a pointer. Map it
|
||||||
|
// to libc's opaque, per-platform FILE rather than emitting glibc's
|
||||||
|
// plain _IO_FILE, whose baked-in layout breaks non-Linux builds.
|
||||||
|
.blocklist_type("_IO_.*")
|
||||||
|
.blocklist_type("FILE")
|
||||||
|
.raw_line("pub use libc::FILE;")
|
||||||
// Block the whole va_list family and rewrite the parameters bindings to our own `VaList`,
|
// Block the whole va_list family and rewrite the parameters bindings to our own `VaList`,
|
||||||
// which is ABI-correct on every target.
|
// which is ABI-correct on every target.
|
||||||
.blocklist_type(".*va_list.*")
|
.blocklist_type(".*va_list.*")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue