]> git.saurik.com Git - apple/libc.git/blob - stdlib/FreeBSD/atexit.c.patch
04ddfe731eb82c63de0318ea53c6c60b7b77ae20
[apple/libc.git] / stdlib / FreeBSD / atexit.c.patch
1 --- atexit.c.orig Thu Mar 11 13:16:53 2004
2 +++ atexit.c Mon Mar 15 12:47:39 2004
3 @@ -45,6 +45,9 @@
4 #include <stdlib.h>
5 #include <unistd.h>
6 #include <pthread.h>
7 +#if defined(__DYNAMIC__)
8 +#include <mach-o/dyld.h>
9 +#endif /* defined(__DYNAMIC__) */
10 #include "atexit.h"
11 #include "un-namespace.h"
12
13 @@ -125,7 +128,11 @@
14 fn.fn_type = ATEXIT_FN_STD;
15 fn.fn_ptr.std_func = func;;
16 fn.fn_arg = NULL;
17 +#if defined(__DYNAMIC__)
18 + fn.fn_dso = (void *)_dyld_get_image_header_containing_address((unsigned long) func);
19 +#else /* ! defined(__DYNAMIC__) */
20 fn.fn_dso = NULL;
21 +#endif /* defined(__DYNAMIC__) */
22
23 error = atexit_register(&fn);
24 return (error);