Skip to content

Commit 14f4ed2

Browse files
committed
Add comments to windows_targets.rs
1 parent 34860a5 commit 14f4ed2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

library/std/src/sys/pal/windows/c/windows_targets.rs

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1+
//! Provides the `link!` macro used by the generated windows bindings.
2+
//!
3+
//! This is a simple wrapper around an `extern` block with a `#[link]` attribute.
4+
//! It's very roughly equivalent to the windows-targets crate.
5+
16
pub macro link {
27
($library:literal $abi:literal $($link_name:literal)? $(#[$doc:meta])? fn $($function:tt)*) => (
8+
// Note: the windows-targets crate uses a pre-built Windows.lib import library which we don't
9+
// have in this repo. So instead we always link kernel32.lib and add the rest of the import
10+
// libraries below by using an empty extern block. This works because extern blocks are not
11+
// connected to the library given in the #[link] attribute.
312
#[link(name = "kernel32")]
413
extern $abi {
514
$(#[link_name=$link_name])?

0 commit comments

Comments
 (0)