Windows uses UNICODE to indicate wide char usage, the CRT uses _UNICODE in <tchar.h>, and I think a few other places.
This code unifies the two so only have to -D one or the other, as long as <tchar.h> included first.
In <tchar.h>, line 12, Pelles C v7, snip marks optional :-D, tab stops at 4 :
#else /* _!WINCE */
// --- 8-< --- 8-< --- 8-< ---
#ifdef _TCHAR_DEFINED // Means winnt.h got included earlier
#ifdef UNICODE // Was that using UNI?
#ifndef _UNICODE // Yes, then should use it here
#define _UNICODE
#endif // ndef
#else // !UNICODE // No, so make sure is off for here
#ifdef _UNICODE
#undef _UNICODE
#endif // def
#endif // def UNICODE
#else // !TCHAR_DEFINED // No winnt.h, but check if forgot to define both
#ifndef _UNICODE // We don't have
#ifdef UNICODE // But have this, assume WAS wanted
#define _UNICODE
#endif // def UNI
#else // We do have
#ifndef UNICODE // But not this, set it in case will be including winnt.h after
#define UNICODE
#endif // ndef UNI
#endif // ndef _UNI // Now have both or neither
#endif // def _TCHAR // or set to match what was used with winnt.h
// --- 8-< --- 8-< --- 8-< ---
#define _T(x) __T(x)