On Monday 20 October 2025 14:25:21 Martin Storsjö wrote:
> On Sun, 21 Sep 2025, Pali Rohár wrote:
> 
> > ---
> > mingw-w64-headers/crt/stdio.h | 1 +
> > 1 file changed, 1 insertion(+)
> > 
> > diff --git a/mingw-w64-headers/crt/stdio.h b/mingw-w64-headers/crt/stdio.h
> > index 1d9603b81d48..5c88f6c74db3 100644
> > --- a/mingw-w64-headers/crt/stdio.h
> > +++ b/mingw-w64-headers/crt/stdio.h
> > @@ -159,6 +159,7 @@ _CRTIMP FILE *__cdecl __acrt_iob_func(unsigned index);
> > #ifdef _POSIX_
> > #define _IOAPPEND 0x0200
> > #endif
> > +#define _IOCOMMIT 0x4000
> > #endif
> > 
> 
> Where is such a flag defined? I don't see it defined in public UCRT/WinSDK
> headers anywhere.
> 
> // Martin

The autocommit feature is not so good documented. The global variable
_commode (access by __p__commode() function) sets whether the autocommit
feature on FILE* stream is activated or not. If is set to 0 then it is
not activated (default by mingw-w64-crt/crt/xncommod.c). When set to
0x4000 then it is activated. The msvc provides COMMODE.OBJ file which is
supposed to be linked to application and just provides __commode symbol
with 0x4000 value, which activates the autocommit feature globally.

https://learn.microsoft.com/ka-ge/cpp/c-runtime-library/stream-i-o?view=msvc-160
https://learn.microsoft.com/en-us/cpp/c-runtime-library/commit-to-disk-constants?view=msvc-170
https://learn.microsoft.com/en-us/cpp/c-runtime-library/p-commode?view=msvc-170

I took this name from wine without prefixes and verified on runtime with
msvc that the value is properly set to 0x4000 when autocommit is enabled.

https://gitlab.winehq.org/wine/wine/-/blob/master/dlls/msvcrt/file.c


_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to