On Tuesday 18 October 2022 12:01:34 LIU Hao wrote: > 在 2022/10/13 00:50, Pali Rohár 写道: > > Hello! More mingw-w64 header files contain '#ifdef _MSVCRT_' code. > > But _MSVCRT_ is not defined neither by gcc nor mingw-w64 runtime. > > So it is a dead code? Or is there any purpose for having those ifdefs? > > Note that gcc defines macro __MSVCRT__ with double underscores. > > > > > > ReactOS defines it via command line [1]. I am not clear about it, maybe you > can check an old version of Microsoft Visual Studio. > > [1] > https://github.com/reactos/reactos/blob/7100a24fc314f4fe0ae58520f405d2fb4f88f3e2/sdk/lib/crt/crt.cmake#L36
For example in mingw-w64-headers/crt/ctype.h is code: #ifdef _MSVCRT_ #define __pctype_func() (_pctype) #else #ifdef _UCRT _CRTIMP unsigned short* __pctype_func(void); #else #define __pctype_func() (* __MINGW_IMP_SYMBOL(_pctype)) #endif #endif So is not the first '#define __pctype_func()' useless? Because static linking of CRT is not supported in mingw-w64 and _CRTIMP for second implementation is filled based on the fact if compiling mingw-w64 itself or compiling project. And same patterns are also in other files... _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
