@@ -30,12 +30,6 @@ use core::mem;
3030use core:: ptr;
3131use core:: slice;
3232
33- // This is used when we're double-checking function signatures against windows-sys.
34- #[ inline( always) ]
35- fn assert_equal_types < T > ( a : T , _b : T ) -> T {
36- a
37- }
38-
3933// This macro is used to define a `Dbghelp` structure which internally contains
4034// all the function pointers that we might load.
4135macro_rules! dbghelp {
@@ -85,14 +79,20 @@ macro_rules! dbghelp {
8579 // either read the cached function pointer or load it and return the
8680 // loaded value. Loads are asserted to succeed.
8781 $( pub fn $name( & mut self ) -> Option <$name> {
82+ // Assert that windows_sys::$name is declared to have the same
83+ // argument types and return type as our declaration, although
84+ // it might be either extern "C" or extern "system".
85+ #[ cfg( windows_raw_dylib) ]
86+ let _: unsafe extern "C" fn ( $( $argty) ,* ) -> $ret = super :: windows_sys:: $name;
87+ #[ cfg( not( windows_raw_dylib) ) ]
88+ let _: unsafe extern "system" fn ( $( $argty) ,* ) -> $ret = super :: windows_sys:: $name;
89+
8890 unsafe {
8991 if self . $name == 0 {
9092 let name = concat!( stringify!( $name) , "\0 " ) ;
9193 self . $name = self . symbol( name. as_bytes( ) ) ?;
9294 }
93- let ret = mem:: transmute:: <usize , $name>( self . $name) ;
94- assert_equal_types( ret, super :: windows_sys:: $name) ;
95- Some ( ret)
95+ Some ( mem:: transmute:: <usize , $name>( self . $name) )
9696 }
9797 } ) *
9898
0 commit comments