From 1c00ad29b8186d3462261dfbddaa30f89591edc0 Mon Sep 17 00:00:00 2001 From: Danny Smith Date: Sun, 20 Oct 2002 04:30:28 +0000 Subject: 2002-10-19 Danny Smith * crt1.c: Define new macro __IN_MINGW_RUNTIME before including stdlib.h. Comment on reason. Define WIN32_MEAN_AND_LEAN before including windows.h * include/stdlib.h (_fmode): Protect declaration as dllimported variable with __IN_MINGW_RUNTIME. 2002-10-19 Igor Pechtchanski * crt1.c: Include stdlib.h. --- winsup/mingw/ChangeLog | 12 ++++++++++++ winsup/mingw/crt1.c | 15 ++++++++++++--- winsup/mingw/include/stdlib.h | 4 ++-- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog index 33f053b..5441ced 100644 --- a/winsup/mingw/ChangeLog +++ b/winsup/mingw/ChangeLog @@ -1,5 +1,17 @@ 2002-10-19 Danny Smith + * crt1.c: Define new macro __IN_MINGW_RUNTIME before including + stdlib.h. + Define WIN32_MEAN_AND_LEAN before including windows.h + * include/stdlib.h (_fmode): Protect declaration as dllimported + variable with __IN_MINGW_RUNTIME. + +2002-10-19 Igor Pechtchanski + + * crt1.c: Include stdlib.h. + +2002-10-19 Danny Smith + * Makefile.in (CRT0S): Add txtmode.o binmode.o. (MINGW_OBJS): Add txtmode.o. (SRCDIST_FILES): Add txtmode.c binmode.c. diff --git a/winsup/mingw/crt1.c b/winsup/mingw/crt1.c index 40c8d46..ef4623f 100644 --- a/winsup/mingw/crt1.c +++ b/winsup/mingw/crt1.c @@ -26,10 +26,17 @@ * */ +/* Hide the declaration of _fmode with dllimport attribute in stdlib.h. + This is not necessary with Mumit Khan's patches to gcc's winnt.c, + but those patches are still unofficial. */ + +#define __IN_MINGW_RUNTIME +#include #include #include #include #include +#define WIN32_LEAN_AND_MEAN #include #include @@ -55,8 +62,9 @@ __MINGW_IMPORT void __set_app_type(int); /* Global _fmode for this .exe, not the one in msvcrt.dll, The default is set in txtmode.o in libmingw32.a */ -#undef _fmode -extern int _fmode; +/* Override the dllimport'd declarations in stdlib.h */ +#undef _fmode +extern int _fmode; extern int* __p__fmode(void); /* To access the dll _fmode */ /* @@ -68,7 +76,7 @@ extern int _CRT_fmode; static void _mingw32_init_fmode () { - /* Don't set the file mode if the user hasn't set any value for it. */ + /* Don't set the std file mode if the user hasn't set any value for it. */ if (_CRT_fmode) { _fmode = _CRT_fmode; @@ -239,6 +247,7 @@ WinMainCRTStartup () __set_app_type (__GUI_APP); #endif __mingw_CRTStartup (); +return 0; } /* diff --git a/winsup/mingw/include/stdlib.h b/winsup/mingw/include/stdlib.h index 468bac1..30ff29c 100644 --- a/winsup/mingw/include/stdlib.h +++ b/winsup/mingw/include/stdlib.h @@ -284,7 +284,7 @@ wchar_t** __p__wpgmptr(void); * This variable determines the default file mode. * TODO: Which flags work? */ -#ifndef __DECLSPEC_SUPPORTED +#if !defined (__DECLSPEC_SUPPORTED) || defined (__IN_MINGW_RUNTIME) #ifdef __MSVCRT__ extern int* _imp___fmode; @@ -404,7 +404,7 @@ extern __inline__ void _Exit(int status) { _exit(status); } #endif /* _onexit is MS extension. Use atexit for portability. */ -typedef int (* _onexit_t)(void); +typedef int (* _onexit_t)(void); _onexit_t _onexit( _onexit_t ); int _putenv (const char*); -- cgit v1.1