about summary refs log tree commit diff
path: root/library/std/src/sys
diff options
context:
space:
mode:
authorChris Denton <chris@chrisdenton.dev>2024-07-04 13:27:24 +0000
committerChris Denton <chris@chrisdenton.dev>2024-07-04 13:27:24 +0000
commit14f4ed2ba3a86bbb2bca77690d036316c3d21fc8 (patch)
tree119123816e2ab6ae63a367c2010eba5736135a77 /library/std/src/sys
parent34860a56f09baf9bc02cde287f4baff921b9a748 (diff)
downloadrust-14f4ed2ba3a86bbb2bca77690d036316c3d21fc8.tar.gz
rust-14f4ed2ba3a86bbb2bca77690d036316c3d21fc8.zip
Add comments to windows_targets.rs
Diffstat (limited to 'library/std/src/sys')
-rw-r--r--library/std/src/sys/pal/windows/c/windows_targets.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/library/std/src/sys/pal/windows/c/windows_targets.rs b/library/std/src/sys/pal/windows/c/windows_targets.rs
index cc3cc6e8611..56c563462d3 100644
--- a/library/std/src/sys/pal/windows/c/windows_targets.rs
+++ b/library/std/src/sys/pal/windows/c/windows_targets.rs
@@ -1,5 +1,14 @@
+//! 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.
+
 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])?