Jacek Caban : winegcc: Default to ucrtbase.

Alexandre Julliard julliard at winehq.org
Mon May 18 15:00:15 CDT 2020


Module: wine
Branch: master
Commit: 14d97456a95948616e3343f02859b017cca15135
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=14d97456a95948616e3343f02859b017cca15135

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon May 18 16:58:53 2020 +0200

winegcc: Default to ucrtbase.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 include/msvcrt/corecrt.h | 8 ++++++++
 tools/makedep.c          | 3 +++
 tools/winegcc/winegcc.c  | 2 +-
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/include/msvcrt/corecrt.h b/include/msvcrt/corecrt.h
index bc93de023f..c98b72f7d3 100644
--- a/include/msvcrt/corecrt.h
+++ b/include/msvcrt/corecrt.h
@@ -33,6 +33,14 @@
 #define _WIN64
 #endif
 
+#ifndef _MSVCR_VER
+# define _MSVCR_VER 140
+#endif
+
+#if !defined(_UCRT) && _MSVCR_VER >= 140
+# define _UCRT
+#endif
+
 #if !defined(_MSC_VER) && !defined(__int64)
 # if defined(_WIN64) && !defined(__MINGW64__)
 #   define __int64 long
diff --git a/tools/makedep.c b/tools/makedep.c
index 653c5488e1..536d2263e3 100644
--- a/tools/makedep.c
+++ b/tools/makedep.c
@@ -4337,11 +4337,13 @@ static void load_sources( struct makefile *make )
 
     if (make->use_msvcrt)
     {
+        unsigned int msvcrt_version = 0;
         for (i = 0; i < make->imports.count; i++)
         {
             if (strncmp( make->imports.str[i], "msvcr", 5 ) && strncmp( make->imports.str[i], "ucrt", 4 )) continue;
             if (crt_dll) fatal_error( "More than one crt DLL imported: %s %s\n", crt_dll, make->imports.str[i] );
             crt_dll = make->imports.str[i];
+            sscanf( crt_dll, "msvcr%u", &msvcrt_version );
         }
         if (!crt_dll && !strarray_exists( &make->extradllflags, "-nodefaultlibs" ))
         {
@@ -4349,6 +4351,7 @@ static void load_sources( struct makefile *make )
             strarray_add( &make->imports, crt_dll );
         }
         if (crt_dll && !strncmp( crt_dll, "ucrt", 4 )) strarray_add( &make->define_args, "-D_UCRT" );
+        else strarray_add( &make->define_args, strmake( "-D_MSVCR_VER=%u", msvcrt_version ));
     }
 
     LIST_FOR_EACH_ENTRY( file, &make->includes, struct incl_file, entry ) parse_file( make, file, 0 );
diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c
index c966c08665..143910ae63 100644
--- a/tools/winegcc/winegcc.c
+++ b/tools/winegcc/winegcc.c
@@ -1208,7 +1208,7 @@ static void build(struct options* opts)
         add_library(opts, lib_dirs, files, "winecrt0");
         if (opts->use_msvcrt)
         {
-            if (!crt_lib) add_library(opts, lib_dirs, files, "msvcrt");
+            if (!crt_lib) add_library(opts, lib_dirs, files, "ucrtbase");
             else strarray_add(files, strmake("-a%s", crt_lib));
         }
         if (opts->win16_app) add_library(opts, lib_dirs, files, "kernel");




More information about the wine-cvs mailing list