On Mon, 3 Jun 2024, Pali Rohár wrote:
Global variable _sys_nerr is present in every CRT library except UCRT.
Function __sys_nerr() is present since msvcr80.dll and returns pointer to
the global variable _sys_nerr. This function is not present in any
msvcrt.dll library version, but is present in UCRT library.
Same applies for global array _sys_errlist[] and function __sys_errlist()
which returns pointer to the first member of __sys_errlist[] array.
For all pre-msvcr80 CRT import libraries provides mingw-w64 functions
__sys_errlist() and __sys_nerr(). And change stdlib.h header file to
define _sys_nerr and _sys_errlist via __sys_errlist() and __sys_nerr()
functions. With this change, definitions will be compatible for all CRT
versions (crtdll, msvcrt, msvcr80+, UCRT).
---
mingw-w64-crt/Makefile.am | 14 ++++++++++++++
mingw-w64-crt/misc/__sys_errlist.c | 16 ++++++++++++++++
mingw-w64-crt/misc/__sys_nerr.c | 16 ++++++++++++++++
mingw-w64-headers/crt/stdlib.h | 10 ----------
4 files changed, 46 insertions(+), 10 deletions(-)
create mode 100644 mingw-w64-crt/misc/__sys_errlist.c
create mode 100644 mingw-w64-crt/misc/__sys_nerr.c
This patchset of 10 patches looks reasonable to me. I'll give it a bit of
build testing in a day or two, and push it if it passes my testing.
// Martin
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public