On Saturday 13 December 2025 20:38:36 Martin Storsjö wrote: > On Sat, 13 Dec 2025, Luca Bacci wrote: > > > diff --git a/mingw-w64-crt/crt/crtexe.c b/mingw-w64-crt/crt/crtexe.c > > index 94bad6aa..d7497ef0 100644 > > --- a/mingw-w64-crt/crt/crtexe.c > > +++ b/mingw-w64-crt/crt/crtexe.c > > @@ -199,6 +199,17 @@ __tmainCRTStartup (void) > > if (__globallocalestatus == -1) > > _configthreadlocale (-1); > > > > +#if !defined (_UCRT) > > This doesn't work the way you want; as much as possible of the base files > from mingw-w64-crt are agnostic of the choice of default CRT. In particular, > all the files in mingw-w64-crt are built with "-D__MSVCRT_VERSION__=0x600". > Only the files that go into the individual CRT import libraries can assume > things about which CRT they're used with. > > One way of working around this would be to add a call to a function, which > in the libmsvcr*.a libraries does what you want, but in libucrt*.a would be > a dummy no-op function. > > Pali may have other suggestions or opinions about how to deal with this. > > // Martin
Yes, ifdef for _UCRT in mingw-w64-crt/* directory does not work, it is never defined. I would suggest to call setvbuf() unconditionally. That is simple solution and would work with any CRT library. I looked at second change https://sourceforge.net/p/mingw-w64/mailman/message/59272390/ and seems that this one is not correct too. It is calling code outside of __native_startup_state guards. Anyway, for such changes it would be very useful to have an automated test. So we can see what is happening without the change and with the change. Lot of different tests are in the mingw-w64-crt/testcases/ dir. For example test t_assert.c is spawning new process and using pipe on stderr and is checking that stderr was properly transferred. _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
