Skip to content

Commit 625bcc4

Browse files
Rollup merge of rust-lang#127320 - ChrisDenton:win-sys, r=Mark-Simulacrum
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.
2 parents f8caf5f + 515bd30 commit 625bcc4

File tree

5 files changed

+162
-851
lines changed

5 files changed

+162
-851
lines changed

std/src/sys/pal/windows/c.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ use crate::os::raw::{c_char, c_long, c_longlong, c_uint, c_ulong, c_ushort, c_vo
1313
use crate::os::windows::io::{AsRawHandle, BorrowedHandle};
1414
use crate::ptr;
1515

16+
mod windows_targets;
17+
1618
mod windows_sys;
1719
pub use windows_sys::*;
1820

@@ -504,11 +506,8 @@ if #[cfg(not(target_vendor = "uwp"))] {
504506
#[cfg(target_arch = "arm")]
505507
pub enum CONTEXT {}
506508
}}
507-
508-
#[link(name = "ws2_32")]
509-
extern "system" {
510-
pub fn WSAStartup(wversionrequested: u16, lpwsadata: *mut WSADATA) -> i32;
511-
}
509+
// WSAStartup is only redefined here so that we can override WSADATA for Arm32
510+
windows_targets::link!("ws2_32.dll" "system" fn WSAStartup(wversionrequested: u16, lpwsadata: *mut WSADATA) -> i32);
512511
#[cfg(target_arch = "arm")]
513512
#[repr(C)]
514513
pub struct WSADATA {

std/src/sys/pal/windows/c/bindings.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--out windows_sys.rs
2-
--config flatten std
2+
--config flatten sys
33
--filter
44
!Windows.Win32.Foundation.INVALID_HANDLE_VALUE
55
Windows.Wdk.Storage.FileSystem.FILE_COMPLETE_IF_OPLOCKED

0 commit comments

Comments
 (0)