at master 783 B view raw
1use crate::{platform::types::*, raw_cell::RawCell}; 2 3// TODO: Implement cxa_finalize and uncomment this 4 5#[derive(Clone, Copy)] 6struct CxaAtExitFunc { 7 //func: extern "C" fn(*mut c_void), 8 //arg: *mut c_void, 9 //dso: *mut c_void, 10} 11 12static CXA_ATEXIT_FUNCS: RawCell<[Option<CxaAtExitFunc>; 32]> = RawCell::new([None; 32]); 13 14#[unsafe(no_mangle)] 15pub unsafe extern "C" fn __cxa_atexit( 16 func_opt: Option<extern "C" fn(*mut c_void)>, 17 arg: *mut c_void, 18 dso: *mut c_void, 19) -> c_int { 20 for i in 0..CXA_ATEXIT_FUNCS.unsafe_ref().len() { 21 if CXA_ATEXIT_FUNCS.unsafe_ref()[i].is_none() { 22 CXA_ATEXIT_FUNCS.unsafe_mut()[i] = 23 func_opt.map(|func| CxaAtExitFunc {} /*{ func, arg, dso }*/); 24 return 0; 25 } 26 } 27 28 -1 29}