// Windows (VC++) has broad TCHAR support
#if defined(__VISUALC__) && defined(__WIN32__)
+#define HAVE_WCSLEN 1
+
#include <tchar.h>
#if wxUSE_UNICODE // temporary - preserve binary compatibility
typedef _TCHAR wxChar;
#if defined(__VISUALC__) && (__VISUALC__ < 900)
#define wxUSE_WCHAR_T 0 // wchar_t is not available for MSVC++ 1.5
#elif defined(__UNIX__)
- #if defined(HAVE_WCSTR_H) || defined(HAVE_WCHAR_H)
+ #if defined(HAVE_WCSTR_H) || defined(HAVE_WCHAR_H) || defined(__FreeBSD__)
#define wxUSE_WCHAR_T 1
#else
#define wxUSE_WCHAR_T 0
#endif//wxUSE_UNICODE
#if wxUSE_WCHAR_T
-#ifdef HAVE_WCSTR_H
-#include <wcstr.h>
-#else
-#include <wchar.h>
-#endif
+ #ifdef HAVE_WCSTR_H
+ #include <wcstr.h>
+ #else
+ #ifndef __FreeBSD__
+ #include <wchar.h>
+ #else
+ #include <stdlib.h>
+ #define wxNEED_WCSLEN
+ #endif
+ #endif
#endif
// check whether we are doing Unicode
#define wxUChar unsigned char
#endif
+#ifdef __FreeBSD__
+ #undef _T
+#endif
#define _T(x) x
// ctype.h functions
#define wxWC2WX wxWC2MB
#define wxWX2WC wxMB2WC
#endif
+#else
+// No wxUSE_WCHAR_T: we have to do something (JACS)
+#define wxMB2WC wxStrncpy
+#define wxWC2MB wxStrncpy
+#define wxMB2WX wxStrncpy
+#define wxWX2MB wxStrncpy
+#define wxWC2WX wxWC2MB
+#define wxWX2WC wxMB2WC
#endif
+
bool WXDLLEXPORT wxOKlibc(); // for internal use
// if libc versions are not available, use replacements defined in wxchar.cpp