Skip to content

Commit

Permalink
Rollup merge of rust-lang#127320 - ChrisDenton:win-sys, r=Mark-Simula…
Browse files Browse the repository at this point in the history
…crum

Update windows-bindgen to 0.58.0

This also switches from the bespoke `std` generated bindings to the normal `sys` ones everyone else uses.

This has almost no difference except that the  `sys` bindings use the `windows_targets::links!` macro for FFI imports, which we implement manually. This does cause the diff to look much larger than it really is but the bulk of the changes are mostly contained to the generated code.
  • Loading branch information
GuillaumeGomez authored Jul 5, 2024
2 parents f8caf5f + 515bd30 commit 625bcc4
Show file tree
Hide file tree
Showing 5 changed files with 162 additions and 851 deletions.
9 changes: 4 additions & 5 deletions std/src/sys/pal/windows/c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ use crate::os::raw::{c_char, c_long, c_longlong, c_uint, c_ulong, c_ushort, c_vo
use crate::os::windows::io::{AsRawHandle, BorrowedHandle};
use crate::ptr;

mod windows_targets;

mod windows_sys;
pub use windows_sys::*;

Expand Down Expand Up @@ -504,11 +506,8 @@ if #[cfg(not(target_vendor = "uwp"))] {
#[cfg(target_arch = "arm")]
pub enum CONTEXT {}
}}

#[link(name = "ws2_32")]
extern "system" {
pub fn WSAStartup(wversionrequested: u16, lpwsadata: *mut WSADATA) -> i32;
}
// WSAStartup is only redefined here so that we can override WSADATA for Arm32
windows_targets::link!("ws2_32.dll" "system" fn WSAStartup(wversionrequested: u16, lpwsadata: *mut WSADATA) -> i32);
#[cfg(target_arch = "arm")]
#[repr(C)]
pub struct WSADATA {
Expand Down
2 changes: 1 addition & 1 deletion std/src/sys/pal/windows/c/bindings.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--out windows_sys.rs
--config flatten std
--config flatten sys
--filter
!Windows.Win32.Foundation.INVALID_HANDLE_VALUE
Windows.Wdk.Storage.FileSystem.FILE_COMPLETE_IF_OPLOCKED
Expand Down
Loading

0 comments on commit 625bcc4

Please sign in to comment.