mirror of
https://github.com/reactos/reactos.git
synced 2025-07-28 11:31:54 +00:00
Update crt headers and mingw lib from mingw64. Update crt a bit. 4 msvcrt time tests fixed.
svn path=/trunk/; revision=38052
This commit is contained in:
parent
d7b72f79a2
commit
76a198afb9
148 changed files with 10859 additions and 6196 deletions
38
reactos/lib/3rdparty/mingw/gccmain.c
vendored
38
reactos/lib/3rdparty/mingw/gccmain.c
vendored
|
@ -10,29 +10,35 @@
|
|||
* __do_global_ctors.
|
||||
*
|
||||
*/
|
||||
|
||||
/* Needed for the atexit prototype. */
|
||||
#include <windows.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <setjmp.h>
|
||||
|
||||
typedef void (*func_ptr) (void);
|
||||
extern func_ptr __CTOR_LIST__[];
|
||||
extern func_ptr __DTOR_LIST__[];
|
||||
|
||||
static HMODULE hMsvcrt = NULL;
|
||||
|
||||
typedef void __cdecl flongjmp(jmp_buf _Buf,int _Value);
|
||||
|
||||
flongjmp *fctMsvcrtLongJmp = NULL;
|
||||
|
||||
void
|
||||
__do_global_dtors (void)
|
||||
{
|
||||
static func_ptr *p = __DTOR_LIST__ + 1;
|
||||
|
||||
/*
|
||||
* Call each destructor in the destructor list until a null pointer
|
||||
* is encountered.
|
||||
*/
|
||||
while (*p)
|
||||
{
|
||||
(*(p)) ();
|
||||
p++;
|
||||
}
|
||||
if (hMsvcrt)
|
||||
{
|
||||
FreeLibrary (hMsvcrt);
|
||||
hMsvcrt = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -41,27 +47,21 @@ __do_global_ctors (void)
|
|||
unsigned long nptrs = (unsigned long) (ptrdiff_t) __CTOR_LIST__[0];
|
||||
unsigned long i;
|
||||
|
||||
/*
|
||||
* If the first entry in the constructor list is -1 then the list
|
||||
* is terminated with a null entry. Otherwise the first entry was
|
||||
* the number of pointers in the list.
|
||||
*/
|
||||
if (!hMsvcrt) {
|
||||
hMsvcrt = LoadLibrary ("msvcrt.dll");
|
||||
fctMsvcrtLongJmp = (flongjmp *) GetProcAddress( hMsvcrt, "longjmp");
|
||||
}
|
||||
|
||||
if (nptrs == (unsigned long) -1)
|
||||
{
|
||||
for (nptrs = 0; __CTOR_LIST__[nptrs + 1] != 0; nptrs++);
|
||||
}
|
||||
|
||||
/*
|
||||
* Go through the list backwards calling constructors.
|
||||
*/
|
||||
for (i = nptrs; i >= 1; i--)
|
||||
{
|
||||
__CTOR_LIST__[i] ();
|
||||
}
|
||||
|
||||
/*
|
||||
* Register the destructors for processing on exit.
|
||||
*/
|
||||
atexit (__do_global_dtors);
|
||||
}
|
||||
|
||||
|
@ -76,5 +76,3 @@ __main (void)
|
|||
__do_global_ctors ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue