Skip to content

Commit

Permalink
Add comments to windows_targets.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisDenton committed Jul 4, 2024
1 parent 34860a5 commit 14f4ed2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions library/std/src/sys/pal/windows/c/windows_targets.rs
Original file line number Diff line number Diff line change
@@ -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])?
Expand Down

0 comments on commit 14f4ed2

Please sign in to comment.