@@ -20,12 +20,14 @@ use core::ops::{BitOr, Shl};
2020mod impls;
2121
2222#[ cfg_attr( all( feature = "mem" , not( feature = "mangled-names" ) ) , no_mangle) ]
23+ #[ cfg_attr( not( all( target_os = "windows" , target_env = "gnu" ) ) , linkage = "weak" ) ]
2324pub unsafe extern "C" fn memcpy ( dest : * mut u8 , src : * const u8 , n : usize ) -> * mut u8 {
2425 impls:: copy_forward ( dest, src, n) ;
2526 dest
2627}
2728
2829#[ cfg_attr( all( feature = "mem" , not( feature = "mangled-names" ) ) , no_mangle) ]
30+ #[ cfg_attr( not( all( target_os = "windows" , target_env = "gnu" ) ) , linkage = "weak" ) ]
2931pub unsafe extern "C" fn memmove ( dest : * mut u8 , src : * const u8 , n : usize ) -> * mut u8 {
3032 let delta = ( dest as usize ) . wrapping_sub ( src as usize ) ;
3133 if delta >= n {
@@ -39,12 +41,14 @@ pub unsafe extern "C" fn memmove(dest: *mut u8, src: *const u8, n: usize) -> *mu
3941}
4042
4143#[ cfg_attr( all( feature = "mem" , not( feature = "mangled-names" ) ) , no_mangle) ]
44+ #[ cfg_attr( not( all( target_os = "windows" , target_env = "gnu" ) ) , linkage = "weak" ) ]
4245pub unsafe extern "C" fn memset ( s : * mut u8 , c : c_int , n : usize ) -> * mut u8 {
4346 impls:: set_bytes ( s, c as u8 , n) ;
4447 s
4548}
4649
4750#[ cfg_attr( all( feature = "mem" , not( feature = "mangled-names" ) ) , no_mangle) ]
51+ #[ cfg_attr( not( all( target_os = "windows" , target_env = "gnu" ) ) , linkage = "weak" ) ]
4852pub unsafe extern "C" fn memcmp ( s1 : * const u8 , s2 : * const u8 , n : usize ) -> i32 {
4953 let mut i = 0 ;
5054 while i < n {
@@ -59,6 +63,7 @@ pub unsafe extern "C" fn memcmp(s1: *const u8, s2: *const u8, n: usize) -> i32 {
5963}
6064
6165#[ cfg_attr( all( feature = "mem" , not( feature = "mangled-names" ) ) , no_mangle) ]
66+ #[ cfg_attr( not( all( target_os = "windows" , target_env = "gnu" ) ) , linkage = "weak" ) ]
6267pub unsafe extern "C" fn bcmp ( s1 : * const u8 , s2 : * const u8 , n : usize ) -> i32 {
6368 memcmp ( s1, s2, n)
6469}
0 commit comments