This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Cygwin: newlib and disabled multibyte support


Hi,

building newlib under cygwin with disabled multibyte results in an error
in file libc/stdlib/mbtowc_r.c:

int (*__mbtowc) (struct _reent *, wchar_t *, const char *, size_t,
		 const char *, mbstate_t *)
#ifdef __CYGWIN__
   /* Cygwin starts up in UTF-8 mode. */
   = __utf8_mbtowc;
#else
   = __ascii_mbtowc;
#endif

Error message: undefined __utf8_mbtowc

This is cause in local.h __utf8_mbtowc is only defined when multibyte
support is enabled.

Same situation for file libc\stdlib\mbtowc_r.c.

I patched the files:

--- .\newlib-1.20.0\newlib\libc\stdlib\mbtowc_r.c	2010-01-17
11:39:06.000000000 +0200
+++ .\gcc-4.5.4\newlib\libc\stdlib\mbtowc_r.c	2012-08-03
11:23:46.000000000 +0200
@@ -6,13 +6,13 @@
 #include <string.h>
 #include <errno.h>
 #include "local.h"
 
 int (*__mbtowc) (struct _reent *, wchar_t *, const char *, size_t,
 		 const char *, mbstate_t *)
-#ifdef __CYGWIN__
+#if defined __CYGWIN__ && _MB_CAPABLE
    /* Cygwin starts up in UTF-8 mode. */
    = __utf8_mbtowc;
 #else
    = __ascii_mbtowc;
 #endif



--- .\newlib-1.20.0\newlib\libc\stdlib\wctomb_r.c	2010-01-17
11:39:06.000000000 +0200
+++ .\gcc-4.5.4\newlib\libc\stdlib\wctomb_r.c	2012-08-03
11:41:44.000000000 +0200
@@ -5,13 +5,13 @@
 #include <locale.h>
 #include "mbctype.h"
 #include "local.h"
 
 int (*__wctomb) (struct _reent *, char *, wchar_t, const char *charset,
 		 mbstate_t *)
-#ifdef __CYGWIN__
+#if defined __CYGWIN__ && _MB_CAPABLE
    /* Cygwin starts up in UTF-8 mode. */
     = __utf8_wctomb;
 #else
     = __ascii_wctomb;
 #endif



Best regards
  Martin



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]