Skip to content

Commit 25712af

Browse files
committed
Add #[link] attributes to dll imports
This avoids using jmp stubs when calling functions exported from a dll.
1 parent bacf770 commit 25712af

File tree

1 file changed

+3
-0
lines changed
  • library/std/src/sys/windows

1 file changed

+3
-0
lines changed

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

+3
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,7 @@ if #[cfg(not(target_vendor = "uwp"))] {
688688

689689
pub const TOKEN_READ: DWORD = 0x20008;
690690

691+
#[link(name="kernel32")]
691692
extern "system" {
692693
#[link_name = "SystemFunction036"]
693694
pub fn RtlGenRandom(RandomBuffer: *mut u8, RandomBufferLength: ULONG) -> BOOLEAN;
@@ -744,6 +745,7 @@ if #[cfg(target_vendor = "uwp")] {
744745
pub Directory: BOOLEAN,
745746
}
746747

748+
#[link(name="kernel32")]
747749
extern "system" {
748750
pub fn GetFileInformationByHandleEx(hFile: HANDLE,
749751
fileInfoClass: FILE_INFO_BY_HANDLE_CLASS,
@@ -756,6 +758,7 @@ if #[cfg(target_vendor = "uwp")] {
756758
}
757759

758760
// Shared between Desktop & UWP
761+
#[link(name = "kernel32")]
759762
extern "system" {
760763
pub fn WSAStartup(wVersionRequested: WORD, lpWSAData: LPWSADATA) -> c_int;
761764
pub fn WSACleanup() -> c_int;

0 commit comments

Comments
 (0)