1
Fork 0

Add windows-targets crate to std's sysroot

This commit is contained in:
Chris Denton 2024-08-09 01:32:13 +00:00
parent c7b0d4e81f
commit acb024110f
No known key found for this signature in database
GPG key ID: 713472F2F45627DE
9 changed files with 26 additions and 7 deletions

View file

@ -4,7 +4,7 @@ use crate::alloc::{GlobalAlloc, Layout, System};
use crate::ffi::c_void;
use crate::ptr;
use crate::sync::atomic::{AtomicPtr, Ordering};
use crate::sys::c::{self, windows_targets};
use crate::sys::c;
use crate::sys::common::alloc::{realloc_fallback, MIN_ALIGN};
#[cfg(test)]

View file

@ -8,8 +8,6 @@
use core::ffi::{c_uint, c_ulong, c_ushort, c_void, CStr};
use core::{mem, ptr};
pub(super) mod windows_targets;
mod windows_sys;
pub use windows_sys::*;

View file

@ -3317,4 +3317,3 @@ pub struct WSADATA {
#[cfg(target_arch = "arm")]
pub enum CONTEXT {}
// ignore-tidy-filelength
use super::windows_targets;

View file

@ -1,37 +0,0 @@
//! Provides the `link!` macro used by the generated windows bindings.
//!
//! This is a simple wrapper around an `extern` block with a `#[link]` attribute.
//! It's very roughly equivalent to the windows-targets crate.
#[cfg(feature = "windows_raw_dylib")]
pub macro link {
($library:literal $abi:literal $($link_name:literal)? $(#[$doc:meta])? fn $($function:tt)*) => (
#[cfg_attr(not(target_arch = "x86"), link(name = $library, kind = "raw-dylib", modifiers = "+verbatim"))]
#[cfg_attr(target_arch = "x86", link(name = $library, kind = "raw-dylib", modifiers = "+verbatim", import_name_type = "undecorated"))]
extern $abi {
$(#[link_name=$link_name])?
pub fn $($function)*;
}
)
}
#[cfg(not(feature = "windows_raw_dylib"))]
pub macro link {
($library:literal $abi:literal $($link_name:literal)? $(#[$doc:meta])? fn $($function:tt)*) => (
// Note: the windows-targets crate uses a pre-built Windows.lib import library which we don't
// have in this repo. So instead we always link kernel32.lib and add the rest of the import
// libraries below by using an empty extern block. This works because extern blocks are not
// connected to the library given in the #[link] attribute.
#[link(name = "kernel32")]
extern $abi {
$(#[link_name=$link_name])?
pub fn $($function)*;
}
)
}
#[cfg(not(feature = "windows_raw_dylib"))]
#[link(name = "advapi32")]
#[link(name = "ntdll")]
#[link(name = "userenv")]
#[link(name = "ws2_32")]
extern "C" {}