@@ -108,15 +108,14 @@ if #[cfg(not(target_vendor = "uwp"))] {
108
108
}
109
109
}
110
110
111
- // Use raw-dylib to import ProcessPrng as we can't rely on there being an import library.
112
- #[ cfg( not( target_vendor = "win7" ) ) ]
113
- #[ cfg_attr(
114
- target_arch = "x86" ,
115
- link( name = "bcryptprimitives" , kind = "raw-dylib" , import_name_type = "undecorated" )
116
- ) ]
117
- #[ cfg_attr( not( target_arch = "x86" ) , link( name = "bcryptprimitives" , kind = "raw-dylib" ) ) ]
118
- extern "system" {
119
- pub fn ProcessPrng ( pbdata : * mut u8 , cbdata : usize ) -> BOOL ;
111
+ // When not using raw-dylib, there isn't a reliable import library for ProcessPrng
112
+ // so we lazily load it instead.
113
+ #[ cfg( all( feature = "windows_use_import_libs" , not( target_vendor = "win7" ) ) ) ]
114
+ compat_fn_with_fallback ! {
115
+ pub static BCRYPTPRIMITIVES : & CStr = c"bcryptprimitives" ;
116
+ pub fn ProcessPrng ( pbdata: * mut u8 , cbdata: usize ) -> BOOL {
117
+ panic!( "ProcessPrng is not available" ) ;
118
+ }
120
119
}
121
120
122
121
// Functions that aren't available on every version of Windows that we support,
@@ -150,31 +149,6 @@ compat_fn_with_fallback! {
150
149
}
151
150
}
152
151
153
- #[ cfg( not( target_vendor = "win7" ) ) ]
154
- // Use raw-dylib to import synchronization functions to workaround issues with the older mingw import library.
155
- #[ cfg_attr(
156
- target_arch = "x86" ,
157
- link(
158
- name = "api-ms-win-core-synch-l1-2-0" ,
159
- kind = "raw-dylib" ,
160
- import_name_type = "undecorated"
161
- )
162
- ) ]
163
- #[ cfg_attr(
164
- not( target_arch = "x86" ) ,
165
- link( name = "api-ms-win-core-synch-l1-2-0" , kind = "raw-dylib" )
166
- ) ]
167
- extern "system" {
168
- pub fn WaitOnAddress (
169
- address : * const c_void ,
170
- compareaddress : * const c_void ,
171
- addresssize : usize ,
172
- dwmilliseconds : u32 ,
173
- ) -> BOOL ;
174
- pub fn WakeByAddressSingle ( address : * const c_void ) ;
175
- pub fn WakeByAddressAll ( address : * const c_void ) ;
176
- }
177
-
178
152
#[ cfg( target_vendor = "win7" ) ]
179
153
compat_fn_optional ! {
180
154
crate :: sys:: compat:: load_synch_functions( ) ;
0 commit comments