Call _init and _fini

This commit is contained in:
Jeremy Soller
2018-09-15 11:14:05 -06:00
parent 882b86e282
commit 706a8de7a0
2 changed files with 13 additions and 2 deletions
+6
View File
@@ -218,12 +218,18 @@ pub extern "C" fn erand(xsubi: [c_ushort; 3]) -> c_double {
#[no_mangle]
pub unsafe extern "C" fn exit(status: c_int) {
extern "C" {
fn _fini();
}
for i in (0..ATEXIT_FUNCS.len()).rev() {
if let Some(func) = ATEXIT_FUNCS[i] {
(func)();
}
}
_fini();
Sys::exit(status);
}