#define except(x) catch(...)
 #endif // Metrowerks
 
+#if defined(__WATCOMC__)
+    typedef short mode_t;
+#endif
+
 // where should i put this? we need to make sure of this as it breaks
 // the <iostream> code.
 #if !wxUSE_IOSTREAMH && defined(__WXDEBUG__)
 
 // Microsoft compiler loves underscores, feed them to it
 #if defined( __VISUALC__ ) \
     || ( defined(__MINGW32__) && !defined(__WINE__) && wxCHECK_W32API_VERSION( 0, 5 ) ) \
-    || ( defined(__MWERKS__) && defined(__WXMSW__) )
+    || ( defined(__MWERKS__) && defined(__WXMSW__) ) \
+    || ( defined(__WATCOMC__) && defined(__WXMSW__) )
     // functions
-#ifdef __BORLANDC__
+#if defined(__BORLANDC__) || defined(__WATCOMC__)
     #define   _tell        tell
 #endif
     #define   wxClose      _close
     #endif
 
     // types
+#if defined(__WATCOMC__)&& wxUSE_UNICODE
+    #define   wxStructStat struct _wstat
+#else
     #define   wxStructStat struct _stat
+#endif
 
     // constants (unless already defined by the user code)
-    #if !defined(O_RDONLY) && !defined(__BORLANDC__)
+    #if !defined(O_RDONLY) && !defined(__BORLANDC__) && !defined(__WATCOMC__)
         #define   O_RDONLY    _O_RDONLY
         #define   O_WRONLY    _O_WRONLY
         #define   O_RDWR      _O_RDWR
         #define   O_BINARY    _O_BINARY
     #endif
 
-    #ifndef __BORLANDC__
+    #if !defined(__BORLANDC__) && !defined(__WATCOMC__)
         #define   S_IFMT      _S_IFMT
         #define   S_IFDIR     _S_IFDIR
         #define   S_IFREG     _S_IFREG
 
                    (long)rc, wxSysErrorMsg(rc))
 #else // !VC++
     #define wxLogApiError(api, rc)                                            \
-        wxLogDebug(wxT("In file %s at line %d: '%s' failed with "             \
-                       "error 0x%08lx (%s)."),                                \
+        wxLogDebug(wxT("In file %s at line %d: '%s' failed with ")            \
+                   wxT("error 0x%08lx (%s)."),                                \
                    __TFILE__, __LINE__, api,                                  \
                    (long)rc, wxSysErrorMsg(rc))
 #endif // VC++/!VC++