mirror of
https://git.code.sf.net/p/mingw-w64/mingw-w64
synced 2024-11-27 03:43:37 +08:00
crt: Add macro __LIBMSVCRT_OS__ for guarding msvcrt.dll
Currently macro __LIBMSVCRT__ is defined when building any libmsvcr*.a import library. But header file msvcrt.h contains inline function __mingw_get_msvcrt_handle() which should be used only from import library for runtime msvcrt.dll (and not for any other runtime msvcr*.dll) as code from that header file directly uses msvcrt.dll library. Protect header file msvcrt.h by a new macro __LIBMSVCRT_OS__ and fix error message as this header file is for libmsvcrt-os.a import library. libmsvcrt.a is import library for some msvcr*.dll runtime specified at MinGW-w64 compile time and does not have to be msvcrt.dll. Archive libmsvcrt_extra.a is linked only to the libmsvcrt-os.a (import library for msvcrt.dll) by msvcrt-os.mri script, so define this new macro __LIBMSVCRT_OS__ when building object files for archive libmsvcrt_extra.a. Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
parent
5ee8fd7d7c
commit
187e41c7f2
@ -910,7 +910,7 @@ lib32_libcrtdll_extra_a_CPPFLAGS = $(CPPFLAGS32) -D__LIBMSVCRT__ $(extra_include
|
||||
lib32_libmsvcrt_common_a_SOURCES = $(src_msvcrt_common)
|
||||
lib32_libmsvcrt_common_a_CPPFLAGS=$(CPPFLAGS32) -D__LIBMSVCRT__ $(extra_include) $(sysincludes)
|
||||
lib32_libmsvcrt_extra_a_SOURCES = $(src_msvcrt32)
|
||||
lib32_libmsvcrt_extra_a_CPPFLAGS=$(CPPFLAGS32) -D__LIBMSVCRT__ $(extra_include) $(sysincludes)
|
||||
lib32_libmsvcrt_extra_a_CPPFLAGS=$(CPPFLAGS32) -D__LIBMSVCRT__ -D__LIBMSVCRT_OS__ $(extra_include) $(sysincludes)
|
||||
lib32_libmsvcr120_app_extra_a_SOURCES = $(src_msvcr120_app)
|
||||
lib32_libmsvcr120_app_extra_a_CPPFLAGS=$(CPPFLAGS32) -D__LIBMSVCRT__ $(extra_include) $(sysincludes)
|
||||
lib32_libucrt_extra_a_SOURCES = $(src_ucrtbase)
|
||||
@ -1234,7 +1234,7 @@ noinst_LIBRARIES += lib64/libmsvcrt_common.a lib64/libmsvcrt_extra.a lib64/libms
|
||||
lib64_libmsvcrt_common_a_SOURCES = $(src_msvcrt_common)
|
||||
lib64_libmsvcrt_common_a_CPPFLAGS=$(CPPFLAGS64) -D__LIBMSVCRT__ $(extra_include) $(sysincludes)
|
||||
lib64_libmsvcrt_extra_a_SOURCES = $(src_msvcrt64)
|
||||
lib64_libmsvcrt_extra_a_CPPFLAGS=$(CPPFLAGS64) -D__LIBMSVCRT__ $(extra_include) $(sysincludes)
|
||||
lib64_libmsvcrt_extra_a_CPPFLAGS=$(CPPFLAGS64) -D__LIBMSVCRT__ -D__LIBMSVCRT_OS__ $(extra_include) $(sysincludes)
|
||||
lib64_libmsvcr80_extra_a_SOURCES = $(src_msvcr80_64)
|
||||
lib64_libmsvcr80_extra_a_CPPFLAGS=$(CPPFLAGS64) -D__LIBMSVCRT__ $(extra_include) $(sysincludes)
|
||||
lib64_libmsvcr120_app_extra_a_SOURCES = $(src_msvcr120_app)
|
||||
@ -1538,7 +1538,7 @@ noinst_LIBRARIES += libarm32/libmsvcrt_common.a libarm32/libmsvcrt_extra.a libar
|
||||
libarm32_libmsvcrt_common_a_SOURCES = $(src_msvcrt_common)
|
||||
libarm32_libmsvcrt_common_a_CPPFLAGS=$(CPPFLAGSARM32) -D__LIBMSVCRT__ $(extra_include) $(sysincludes)
|
||||
libarm32_libmsvcrt_extra_a_SOURCES = $(src_msvcrtarm32)
|
||||
libarm32_libmsvcrt_extra_a_CPPFLAGS=$(CPPFLAGSARM32) -D__LIBMSVCRT__ $(extra_include) $(sysincludes)
|
||||
libarm32_libmsvcrt_extra_a_CPPFLAGS=$(CPPFLAGSARM32) -D__LIBMSVCRT__ -D__LIBMSVCRT_OS__ $(extra_include) $(sysincludes)
|
||||
libarm32_libmsvcr120_app_extra_a_SOURCES = $(src_msvcr120_app)
|
||||
libarm32_libmsvcr120_app_extra_a_CPPFLAGS=$(CPPFLAGSARM32) -D__LIBMSVCRT__ $(extra_include) $(sysincludes)
|
||||
libarm32_libucrt_extra_a_SOURCES = $(src_ucrtbase)
|
||||
@ -1810,7 +1810,7 @@ noinst_LIBRARIES += libarm64/libmsvcrt_common.a libarm64/libmsvcrt_extra.a libar
|
||||
libarm64_libmsvcrt_common_a_SOURCES = $(src_msvcrt_common)
|
||||
libarm64_libmsvcrt_common_a_CPPFLAGS=$(CPPFLAGSARM64) -D__LIBMSVCRT__ $(extra_include) $(sysincludes)
|
||||
libarm64_libmsvcrt_extra_a_SOURCES = $(src_msvcrtarm64)
|
||||
libarm64_libmsvcrt_extra_a_CPPFLAGS=$(CPPFLAGSARM64) -D__LIBMSVCRT__ $(extra_include) $(sysincludes)
|
||||
libarm64_libmsvcrt_extra_a_CPPFLAGS=$(CPPFLAGSARM64) -D__LIBMSVCRT__ -D__LIBMSVCRT_OS__ $(extra_include) $(sysincludes)
|
||||
libarm64_libucrt_extra_a_SOURCES = $(src_ucrtbase)
|
||||
libarm64_libucrt_extra_a_CPPFLAGS=$(CPPFLAGSARM64) -D__LIBMSVCRT__ $(extra_include) $(sysincludes)
|
||||
libarm64_libucrtapp_extra_a_SOURCES = $(src_ucrtapp)
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <winbase.h>
|
||||
|
||||
#ifndef __LIBMSVCRT__
|
||||
#error "This file should only be used in libmsvcrt.a"
|
||||
#ifndef __LIBMSVCRT_OS__
|
||||
#error "This file should only be used in libmsvcrt-os.a"
|
||||
#endif
|
||||
|
||||
static inline HANDLE __mingw_get_msvcrt_handle(void)
|
||||
|
Loading…
Reference in New Issue
Block a user