Skip to content

Commit f7f25b0

Browse files
committed
Add windows_sys typedef for Win ARM32
1 parent cb882fa commit f7f25b0

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

library/std/src/sys/windows/c/windows_sys.rs

+17
Original file line numberDiff line numberDiff line change
@@ -4275,3 +4275,20 @@ impl ::core::clone::Clone for XSAVE_FORMAT {
42754275
*self
42764276
}
42774277
}
4278+
// Begin of ARM32 shim
4279+
cfg_if::cfg_if! {
4280+
if #[cfg(target_arch = "arm")] {
4281+
#[repr(C)]
4282+
pub struct WSADATA {
4283+
pub wVersion: u16,
4284+
pub wHighVersion: u16,
4285+
pub szDescription: [u8; 257],
4286+
pub szSystemStatus: [u8; 129],
4287+
pub iMaxSockets: u16,
4288+
pub iMaxUdpDg: u16,
4289+
pub lpVendorInfo: PSTR,
4290+
}
4291+
pub enum CONTEXT {}
4292+
}
4293+
}
4294+
// End of ARM32 shim
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Begin of ARM32 shim
2+
cfg_if::cfg_if! {
3+
if #[cfg(target_arch = "arm")] {
4+
#[repr(C)]
5+
pub struct WSADATA {
6+
pub wVersion: u16,
7+
pub wHighVersion: u16,
8+
pub szDescription: [u8; 257],
9+
pub szSystemStatus: [u8; 129],
10+
pub iMaxSockets: u16,
11+
pub iMaxUdpDg: u16,
12+
pub lpVendorInfo: PSTR,
13+
}
14+
pub enum CONTEXT {}
15+
}
16+
}
17+
// End of ARM32 shim

src/tools/generate-windows-sys/src/main.rs

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ const PRELUDE: &str = r#"// This file is autogenerated.
1111
// ignore-tidy-filelength
1212
"#;
1313

14+
/// This is a shim for the ARM (32-bit) architecture, which is no longer supported by windows-rs.
15+
const ARM_SHIM: &str = include_str!("arm_shim.rs");
16+
1417
fn main() -> io::Result<()> {
1518
let mut path: PathBuf =
1619
std::env::args_os().nth(1).expect("a path to the rust repository is required").into();
@@ -32,6 +35,7 @@ fn main() -> io::Result<()> {
3235
let mut f = std::fs::File::create(&path)?;
3336
f.write_all(PRELUDE.as_bytes())?;
3437
f.write_all(bindings.as_bytes())?;
38+
f.write_all(ARM_SHIM.as_bytes())?;
3539

3640
Ok(())
3741
}

0 commit comments

Comments
 (0)