We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fe85591 commit c599a4cCopy full SHA for c599a4c
library/std/src/sys/windows/compat.rs
@@ -92,11 +92,10 @@ macro_rules! compat_fn {
92
let symbol_name: *const u8 = concat!(stringify!($symbol), "\0").as_ptr();
93
let module_handle = $crate::sys::c::GetModuleHandleA(module_name as *const i8);
94
if !module_handle.is_null() {
95
- match $crate::sys::c::GetProcAddress(module_handle, symbol_name as *const i8).addr() {
96
- 0 => {}
97
- n => {
98
- return Some(mem::transmute::<usize, F>(n));
99
- }
+ let ptr = $crate::sys::c::GetProcAddress(module_handle, symbol_name as *const i8);
+ if !ptr.is_null() {
+ // Transmute to the right function pointer type.
+ return Some(mem::transmute(ptr));
100
}
101
102
return None;
0 commit comments