3 * This file has no copyright assigned and is placed in the Public Domain.
4 * This file is a part of the mingw-runtime package.
5 * No warranty is given; refer to the file DISCLAIMER within the package.
7 * A separate version of __main, __do_global_ctors and __do_global_dtors for
8 * Mingw32 for use with Cygwin32 b19. Hopefully this object file will only
9 * be linked if the libgcc.a doesn't include __main, __do_global_dtors and
14 /* Needed for the atexit prototype. */
17 typedef void (*func_ptr) (void);
18 extern func_ptr __CTOR_LIST__[];
19 extern func_ptr __DTOR_LIST__[];
22 __do_global_dtors (void)
24 static func_ptr *p = __DTOR_LIST__ + 1;
27 * Call each destructor in the destructor list until a null pointer
38 __do_global_ctors (void)
40 unsigned long nptrs = (unsigned long) __CTOR_LIST__[0];
44 * If the first entry in the constructor list is -1 then the list
45 * is terminated with a null entry. Otherwise the first entry was
46 * the number of pointers in the list.
50 for (nptrs = 0; __CTOR_LIST__[nptrs + 1] != 0; nptrs++)
55 * Go through the list backwards calling constructors.
57 for (i = nptrs; i >= 1; i--)
63 * Register the destructors for processing on exit.
65 atexit (__do_global_dtors);
68 static int initialized = 0;