Author: cfinck
Date: Tue Mar 17 23:17:02 2009
New Revision: 40077
URL:
http://svn.reactos.org/svn/reactos?rev=40077&view=rev
Log:
Sync CRT initialization code with mingw-w64 r690
- Fixed initialization for Console apps with Unicode entry point. Now stuff like
"cout" in <iostream> doesn't lead to instant crashes.
- Unified the name of the entry point for ANSI and Unicode. The difference is just in the
library now ("mingw_main" vs. "mingw_wmain")
RBuild was changed appropriately to support this
- No more ReactOS-specific changes inside the initialization code
Modified:
trunk/reactos/lib/3rdparty/mingw/crt0_w.c
trunk/reactos/lib/3rdparty/mingw/crtdll.c
trunk/reactos/lib/3rdparty/mingw/crtexe.c
trunk/reactos/lib/3rdparty/mingw/mingw_helpers.c
trunk/reactos/tools/rbuild/module.cpp
Modified: trunk/reactos/lib/3rdparty/mingw/crt0_w.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/crt0_w.…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/crt0_w.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/crt0_w.c [iso-8859-1] Tue Mar 17 23:17:02 2009
@@ -12,10 +12,5 @@
int wmain (int flags, wchar_t **cmdline, wchar_t **inst)
{
-#ifdef __GNUC__
- /* C++ initialization.
- gcc inserts this call automatically for a function called main , but not for wmain.
*/
- __main();
-#endif
return (int) wWinMain ((HINSTANCE) inst, NULL, (LPWSTR) cmdline,(DWORD) flags);
}
Modified: trunk/reactos/lib/3rdparty/mingw/crtdll.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/crtdll.…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/crtdll.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/crtdll.c [iso-8859-1] Tue Mar 17 23:17:02 2009
@@ -6,7 +6,9 @@
#ifdef CRTDLL
#undef CRTDLL
+#ifndef _DLL
#define _DLL
+#endif
#include <oscalls.h>
#include <internal.h>
Modified: trunk/reactos/lib/3rdparty/mingw/crtexe.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/crtexe.…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/crtexe.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/crtexe.c [iso-8859-1] Tue Mar 17 23:17:02 2009
@@ -5,7 +5,9 @@
*/
#undef CRTDLL
-//#define _DLL
+#ifndef _DLL
+#define _DLL
+#endif
#define SPECIAL_CRTEXE
@@ -69,6 +71,7 @@
static int argc;
#ifdef WPRFLAG
+extern void __main(void);
static wchar_t **argv;
static wchar_t **envp;
#else
@@ -144,22 +147,14 @@
static int __tmainCRTStartup (void);
-#ifdef WPRFLAG
-int wWinMainCRTStartup (void)
-#else
int WinMainCRTStartup (void)
-#endif
{
mingw_app_type = 1;
__security_init_cookie ();
return __tmainCRTStartup ();
}
-#ifdef WPRFLAG
-int wmainCRTStartup (void)
-#else
int mainCRTStartup (void)
-#endif
{
mingw_app_type = 0;
__security_init_cookie ();
@@ -236,8 +231,6 @@
if (mingw_app_type)
{
#ifdef WPRFLAG
- if (_wcmdln == NULL)
- return 255;
lpszCommandLine = (_TCHAR *) _wcmdln;
#else
lpszCommandLine = (char *) _acmdln;
@@ -259,6 +252,9 @@
lpszCommandLine++;
#ifdef WPRFLAG
+ /* C++ initialization.
+ gcc inserts this call automatically for a function called main, but not for wmain.
*/
+ __main ();
mainret = wmain (
(int) (StartupInfo.dwFlags & STARTF_USESHOWWINDOW ? StartupInfo.wShowWindow :
SW_SHOWDEFAULT),
(wchar_t **) lpszCommandLine, (wchar_t **) (HINSTANCE) &__ImageBase);
@@ -273,6 +269,9 @@
duplicate_ppstrings (argc, &argv);
#ifdef WPRFLAG
__winitenv = envp;
+ /* C++ initialization.
+ gcc inserts this call automatically for a function called main, but not for wmain.
*/
+ __main ();
mainret = wmain (argc, argv, envp);
#else
__initenv = envp;
Modified: trunk/reactos/lib/3rdparty/mingw/mingw_helpers.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/mingw_h…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/mingw_helpers.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/mingw_helpers.c [iso-8859-1] Tue Mar 17 23:17:02
2009
@@ -12,9 +12,6 @@
#include <tchar.h>
#include <sect_attribs.h>
#include <locale.h>
-#if 0
-#include "../revstamp.h"
-#endif
const PIMAGE_TLS_CALLBACK __dyn_tls_init_callback;
@@ -32,12 +29,3 @@
/* 0:console, 1:windows. */
int mingw_app_type = 0;
-
-#if 0
-const char *__mingw_get_crt_info (void)
-{
- return "MinGW-W64 Runtime " __MINGW64_VERSION " ("
- __MINGW64_VERSION_STATE " - "
- "rev. " __MINGW_W64_REV ") " __MINGW_W64_REV_STAMP;
-}
-#endif
Modified: trunk/reactos/tools/rbuild/module.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/module.cpp?re…
==============================================================================
--- trunk/reactos/tools/rbuild/module.cpp [iso-8859-1] (original)
+++ trunk/reactos/tools/rbuild/module.cpp [iso-8859-1] Tue Mar 17 23:17:02 2009
@@ -1090,16 +1090,10 @@
return "DllMain@12";
case Win32CUI:
case Test:
- if ( isUnicode )
- return "wmainCRTStartup";
- else
- return "mainCRTStartup";
+ return "mainCRTStartup";
case Win32SCR:
case Win32GUI:
- if ( isUnicode )
- return "wWinMainCRTStartup";
- else
- return "WinMainCRTStartup";
+ return "WinMainCRTStartup";
case BuildTool:
case StaticLibrary:
case HostStaticLibrary: