Recent cygwin update is missing tchar header file
Corinna Vinschen
corinna-cygwin@cygwin.com
Tue Jun 16 09:34:00 GMT 2015
On Jun 16 06:24, JonY wrote:
> On 6/16/2015 00:41, Corinna Vinschen wrote:
> > Hi Jon,
> >
> > any idea what happened to tchar.h in the latest w32api update?
> >
>
> tchar.h seems to be part of the CRT headers rather than the w32api
> headers. I'll see getting it installed regardless.
Hmm, that may not be as easy as it sounds.
I checked the w32api-headers 3.3 0 version and there was no tchar.h in
it either, so this isn't new. I assume the last time the package has
been built successfully was against w32api headers from Mingw.org.
tchar.h in Mingw-w64 pulls a rat tail of other headers in:
$ grep '#include' tchar.h
#include <crtdefs.h>
#include <wchar.h>
#include <string.h>
#include <mbstring.h>
#include <sec_api/tchar_s.h>
AFAICS, oledlg.h pulls in tchar.h
solely to get the definition of the macro _TEXT.
So we are better off to define our own tchar.h, or, even better, to
tweak tchar.h for Cygwin upstream. If we exclude everything except for
the definitions of _T, _TEXT, _TEOF, and the types like _TCHAR etc., we
should be good.
Something like this (untested):
diff --git a/mingw-w64-headers/crt/tchar.h b/mingw-w64-headers/crt/tchar.h
index 3567085..c82634a 100644
--- a/mingw-w64-headers/crt/tchar.h
+++ b/mingw-w64-headers/crt/tchar.h
@@ -16,6 +16,8 @@
extern "C" {
#endif
+#ifndef __CYGWIN__
+
#define _ftcscat _tcscat
#define _ftcschr _tcschr
#define _ftcscpy _tcscpy
@@ -79,6 +81,8 @@ extern "C" {
#define _WConst_return _CONST_RETURN
+#endif /* __CYGWIN__ */
+
#ifdef _UNICODE
#ifdef __cplusplus
@@ -91,12 +95,16 @@ extern "C" {
extern "C" {
#endif
+#ifndef __CYGWIN__
+
#ifndef _WCTYPE_T_DEFINED
#define _WCTYPE_T_DEFINED
typedef unsigned short wint_t;
typedef unsigned short wctype_t;
#endif
+#endif /* __CYGWIN__ */
+
#ifndef __TCHAR_DEFINED
#define __TCHAR_DEFINED
typedef wchar_t _TCHAR;
@@ -118,6 +126,8 @@ extern "C" {
#define __T(x) L##x
+#ifndef __CYGWIN__
+
#define _tmain wmain
#define _tWinMain wWinMain
#define _tenviron _wenviron
@@ -470,6 +480,8 @@ extern "C" {
#define _ttelldir _wtelldir
#define _tseekdir _wseekdir
+#endif /* __CYGWIN__ */
+
#else
#ifdef __cplusplus
@@ -486,6 +498,8 @@ extern "C" {
#define __T(x) x
+#ifndef __CYGWIN__
+
#define _tmain main
#define _tWinMain WinMain
#ifdef _POSIX_
@@ -733,12 +747,16 @@ extern "C" {
#define _tsetlocale setlocale
+#endif /* __CYGWIN__ */
+
#ifdef _MBCS
#ifdef __cplusplus
}
#endif
+#ifndef __CYGWIN__
+
#include <mbstring.h>
#ifdef __cplusplus
@@ -939,6 +957,9 @@ extern "C" {
#define _istlead _ismbblead
#define _istleadbyte isleadbyte
#define _istleadbyte_l _isleadbyte_l
+
+#endif /* __CYGWIN__ */
+
#else
#ifndef __TCHAR_DEFINED
@@ -958,6 +979,8 @@ extern "C" {
#endif
#endif
+#ifndef __CYGWIN__
+
#define _tcschr strchr
#define _tcscspn strcspn
#define _tcsncat strncat
@@ -1096,6 +1119,8 @@ extern "C" {
#endif
#endif
+#endif /* __CYGWIN__ */
+
#define _T(x) __T(x)
#define _TEXT(x) __T(x)
@@ -1103,5 +1128,7 @@ extern "C" {
}
#endif
+#ifndef __CYGWIN__
#include <sec_api/tchar_s.h>
+#endif /* __CYGWIN__ */
#endif
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20150616/f5ee2db8/attachment.sig>
More information about the Cygwin
mailing list