-# if wxUSE_WCHAR_T
-# ifdef HAVE_WCSTR_H
-# include <wcstr.h>
-# else
- // VZ: do we really have to include this?
-# include <stdlib.h>
-
- // include wchar.h to get wcslen() declaration used by wx/buffer.h
-# if defined(HAVE_WCHAR_H)
-# include <wchar.h>
-# endif
-# endif
-# endif
+# if wxUSE_WCHAR_T
+# ifdef HAVE_WCHAR_H
+ // include wchar.h to get wcslen() declaration used by wx/buffer.h
+# include <wchar.h>
+# elif defined(HAVE_WCSTR_H)
+ // old compilers have wcslen() here
+# include <wcstr.h>
+# elif defined(__FreeBSD__) || defined(__DARWIN__) || defined(__EMX__)
+ // include stdlib.h for wchar_t, wcslen is provided in wxchar.cpp
+# include <stdlib.h>
+ size_t WXDLLEXPORT wcslen(const wchar_t *s);
+# endif // HAVE_WCHAR_H
+# endif // wxUSE_WCHAR_T