Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add windows_sys type definitions for ARM32 manually #112527

Merged
merged 2 commits into from
Jun 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions library/std/src/sys/windows/c/windows_sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4275,3 +4275,23 @@ impl ::core::clone::Clone for XSAVE_FORMAT {
*self
}
}
// Begin of ARM32 shim
// The raw content of this file should be processed by `generate-windows-sys`
// to be merged with the generated binding. It is not supposed to be used as
// a normal Rust module.
cfg_if::cfg_if! {
if #[cfg(target_arch = "arm")] {
#[repr(C)]
pub struct WSADATA {
pub wVersion: u16,
pub wHighVersion: u16,
pub szDescription: [u8; 257],
pub szSystemStatus: [u8; 129],
pub iMaxSockets: u16,
pub iMaxUdpDg: u16,
pub lpVendorInfo: PSTR,
}
pub enum CONTEXT {}
}
}
// End of ARM32 shim
20 changes: 20 additions & 0 deletions src/tools/generate-windows-sys/src/arm_shim.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Begin of ARM32 shim
// The raw content of this file should be processed by `generate-windows-sys`
// to be merged with the generated binding. It is not supposed to be used as
// a normal Rust module.
cfg_if::cfg_if! {
if #[cfg(target_arch = "arm")] {
ChrisDenton marked this conversation as resolved.
Show resolved Hide resolved
#[repr(C)]
pub struct WSADATA {
pub wVersion: u16,
pub wHighVersion: u16,
pub szDescription: [u8; 257],
pub szSystemStatus: [u8; 129],
pub iMaxSockets: u16,
pub iMaxUdpDg: u16,
pub lpVendorInfo: PSTR,
}
pub enum CONTEXT {}
}
}
// End of ARM32 shim
4 changes: 4 additions & 0 deletions src/tools/generate-windows-sys/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ const PRELUDE: &str = r#"// This file is autogenerated.
// ignore-tidy-filelength
"#;

/// This is a shim for the ARM (32-bit) architecture, which is no longer supported by windows-rs.
const ARM_SHIM: &str = include_str!("arm_shim.rs");

fn main() -> io::Result<()> {
let mut path: PathBuf =
std::env::args_os().nth(1).expect("a path to the rust repository is required").into();
Expand All @@ -32,6 +35,7 @@ fn main() -> io::Result<()> {
let mut f = std::fs::File::create(&path)?;
f.write_all(PRELUDE.as_bytes())?;
f.write_all(bindings.as_bytes())?;
f.write_all(ARM_SHIM.as_bytes())?;

Ok(())
}