diff options
| author | Chris Denton <christophersdenton@gmail.com> | 2021-04-30 16:24:49 +0100 |
|---|---|---|
| committer | Chris Denton <christophersdenton@gmail.com> | 2021-05-06 02:41:51 +0100 |
| commit | 25712afd94404a6204845f9fbb38dcbf1ba4b882 (patch) | |
| tree | 834bbb5e4d645d4a864c422fd7aecd434c470e6d | |
| parent | bacf770f2983a52f31e3537db5f0fe1ef2eaa874 (diff) | |
| download | rust-25712afd94404a6204845f9fbb38dcbf1ba4b882.tar.gz rust-25712afd94404a6204845f9fbb38dcbf1ba4b882.zip | |
Add `#[link]` attributes to dll imports
This avoids using jmp stubs when calling functions exported from a dll.
| -rw-r--r-- | library/std/src/sys/windows/c.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/library/std/src/sys/windows/c.rs b/library/std/src/sys/windows/c.rs index 7ea6048e94a..57885c9bcf9 100644 --- a/library/std/src/sys/windows/c.rs +++ b/library/std/src/sys/windows/c.rs @@ -688,6 +688,7 @@ if #[cfg(not(target_vendor = "uwp"))] { pub const TOKEN_READ: DWORD = 0x20008; + #[link(name="kernel32")] extern "system" { #[link_name = "SystemFunction036"] pub fn RtlGenRandom(RandomBuffer: *mut u8, RandomBufferLength: ULONG) -> BOOLEAN; @@ -744,6 +745,7 @@ if #[cfg(target_vendor = "uwp")] { pub Directory: BOOLEAN, } + #[link(name="kernel32")] extern "system" { pub fn GetFileInformationByHandleEx(hFile: HANDLE, fileInfoClass: FILE_INFO_BY_HANDLE_CLASS, @@ -756,6 +758,7 @@ if #[cfg(target_vendor = "uwp")] { } // Shared between Desktop & UWP +#[link(name = "kernel32")] extern "system" { pub fn WSAStartup(wVersionRequested: WORD, lpWSAData: LPWSADATA) -> c_int; pub fn WSACleanup() -> c_int; |
