In libmsvcrt-os, `__mingw_mbrtowc_cp()` and `__mingw_wcrtomb_cp()` depend on
this function, so it has to be there, otherwise it would cause linker errors.
For UCRT we do the same for consistency reasons.

This closes https://github.com/mingw-w64/mingw-w64/issues/163.

Signed-off-by: LIU Hao <[email protected]>
---
 mingw-w64-crt/Makefile.am | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 4cfbe5342..57d16a83a 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -171,6 +171,7 @@ src_msvcrt_common=\
   include/msvcrt.h \
   include/msvcrt_or_emu_glue.h \
   include/mingw-wchar.h \
+  misc/__mingw_isleadbyte_cp.c \
   misc/__mingw_mbrtowc_cp.c \
   misc/__mingw_wcrtomb_cp.c \
   misc/_onexit.c \
@@ -431,6 +432,7 @@ src_ucrtbase=\
   ctype/_iscsym_l.c \
   ctype/_iscsymf_l.c \
   ctype/towctrans.c \
+  misc/__mingw_isleadbyte_cp.c \
   misc/ucrt__getmainargs.c \
   misc/ucrt__wgetmainargs.c \
   misc/ucrt_amsg_exit.c \
@@ -1291,7 +1293,7 @@ src_libmingwex=\
misc/wmemchr.c misc/wmemcmp.c misc/wmemcpy.c misc/wmemmove.c misc/wmempcpy.c \
   misc/wmemset.c         misc/mingw-access.c \
   misc/ftw32.c           misc/ftw32i64.c            misc/ftw64.c            
misc/ftw64i32.c \
-  misc/__mingw_filename_cp.c misc/__mingw_isleadbyte_cp.c \
+  misc/__mingw_filename_cp.c  \
   \
   ssp/chk_fail.c         ssp/gets_chk.c             ssp/memcpy_chk.c        
ssp/memmove_chk.c \
   ssp/mempcpy_chk.c \
From 73813da0e9ceea70e9fb3ea950abcc3d6385e58b Mon Sep 17 00:00:00 2001
From: LIU Hao <[email protected]>
Date: Mon, 2 Mar 2026 15:24:12 +0800
Subject: [PATCH] crt: Move `__mingw_isleadbyte_cp()` from libmingwex into
 libmsvcrt

In libmsvcrt-os, `__mingw_mbrtowc_cp()` and `__mingw_wcrtomb_cp()` depend on
this function, so it has to be there, otherwise it would cause linker errors.
For UCRT we do the same for consistency reasons.

This closes https://github.com/mingw-w64/mingw-w64/issues/163.

Signed-off-by: LIU Hao <[email protected]>
---
 mingw-w64-crt/Makefile.am | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 4cfbe5342..57d16a83a 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -171,6 +171,7 @@ src_msvcrt_common=\
   include/msvcrt.h \
   include/msvcrt_or_emu_glue.h \
   include/mingw-wchar.h \
+  misc/__mingw_isleadbyte_cp.c \
   misc/__mingw_mbrtowc_cp.c \
   misc/__mingw_wcrtomb_cp.c \
   misc/_onexit.c \
@@ -431,6 +432,7 @@ src_ucrtbase=\
   ctype/_iscsym_l.c \
   ctype/_iscsymf_l.c \
   ctype/towctrans.c \
+  misc/__mingw_isleadbyte_cp.c \
   misc/ucrt__getmainargs.c \
   misc/ucrt__wgetmainargs.c \
   misc/ucrt_amsg_exit.c \
@@ -1291,7 +1293,7 @@ src_libmingwex=\
   misc/wmemchr.c         misc/wmemcmp.c             misc/wmemcpy.c          
misc/wmemmove.c              misc/wmempcpy.c        \
   misc/wmemset.c         misc/mingw-access.c \
   misc/ftw32.c           misc/ftw32i64.c            misc/ftw64.c            
misc/ftw64i32.c \
-  misc/__mingw_filename_cp.c misc/__mingw_isleadbyte_cp.c \
+  misc/__mingw_filename_cp.c  \
   \
   ssp/chk_fail.c         ssp/gets_chk.c             ssp/memcpy_chk.c        
ssp/memmove_chk.c \
   ssp/mempcpy_chk.c \

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

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

Reply via email to