Function symbols _fputc_nolock and _putc_nolock are not available in any
msvcrt DLL library (versioned or system os). They are available only in
UCRT. For all msvcrt builds move current macro from header file to own
mingw-w64 function. This will unify declaration in header file between
msvcrt and UCRT builds.
---
mingw-w64-crt/Makefile.am | 1 +
mingw-w64-crt/stdio/_fputc_nolock.c | 7 +++++++
mingw-w64-crt/stdio/_putc_nolock.c | 4 +---
mingw-w64-headers/crt/stdio.h | 6 +-----
4 files changed, 10 insertions(+), 8 deletions(-)
create mode 100644 mingw-w64-crt/stdio/_fputc_nolock.c
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 3ff209f68245..f5303f10170d 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -183,6 +183,7 @@ src_msvcrt_common=\
misc/wcrtomb.c \
misc/wcsrtombs.c \
stdio/_fgetc_nolock.c \
+ stdio/_fputc_nolock.c \
stdio/_getwc_nolock.c \
stdio/_putc_nolock.c \
stdio/_putwc_nolock.c \
diff --git a/mingw-w64-crt/stdio/_fputc_nolock.c
b/mingw-w64-crt/stdio/_fputc_nolock.c
new file mode 100644
index 000000000000..038f61671b19
--- /dev/null
+++ b/mingw-w64-crt/stdio/_fputc_nolock.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+int __cdecl _fputc_nolock(int c, FILE *stream)
+{
+ return _putc_nolock(c, stream);
+}
+int __cdecl (*__MINGW_IMP_SYMBOL(_fputc_nolock))(int, FILE *) = _fputc_nolock;
diff --git a/mingw-w64-crt/stdio/_putc_nolock.c
b/mingw-w64-crt/stdio/_putc_nolock.c
index 9ad79d9dfdcb..4f20d150a18d 100644
--- a/mingw-w64-crt/stdio/_putc_nolock.c
+++ b/mingw-w64-crt/stdio/_putc_nolock.c
@@ -1,9 +1,7 @@
#include <stdio.h>
-#undef _putc_nolock
-int __cdecl _putc_nolock(int c, FILE *stream);
int __cdecl _putc_nolock(int c, FILE *stream)
{
- return _fputc_nolock(c, stream);
+ return --stream->_cnt >= 0 ? 0xff & (*stream->_ptr++ = (char)c) :
_flsbuf(c, stream);
}
int __cdecl (*__MINGW_IMP_SYMBOL(_putc_nolock))(int, FILE *) = _putc_nolock;
diff --git a/mingw-w64-headers/crt/stdio.h b/mingw-w64-headers/crt/stdio.h
index e46905243c49..0428e44eee55 100644
--- a/mingw-w64-headers/crt/stdio.h
+++ b/mingw-w64-headers/crt/stdio.h
@@ -1203,12 +1203,8 @@ int vsnwprintf (wchar_t *__stream, size_t __n, const
wchar_t *__format, __builti
#define _STDIO_DEFINED
#endif
-#ifdef _UCRT
- _CRTIMP int __cdecl _fputc_nolock(int _Char, FILE *_File);
-#else
-#define _fputc_nolock(_c,_stream) (--(_stream)->_cnt >= 0 ? 0xff &
(*(_stream)->_ptr++ = (char)(_c)) : _flsbuf((_c),(_stream)))
-#endif
_CRTIMP int __cdecl _fgetc_nolock(FILE *_File);
+ _CRTIMP int __cdecl _fputc_nolock(int _Char, FILE *_File);
_CRTIMP int __cdecl _getc_nolock(FILE *_File);
_CRTIMP int __cdecl _putc_nolock(int _Char, FILE *_File);
#define _getchar_nolock() _getc_nolock(stdin)
--
2.20.1
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public