diff --git a/SystemTools.cxx b/SystemTools.cxx
index 3b651856eaa082bf06c65a6365dba3651417f183..100a49ce89257dd476baac570cbd8e45aebe0c21 100644
--- a/SystemTools.cxx
+++ b/SystemTools.cxx
@@ -1277,7 +1277,12 @@ int SystemTools::Stat(const std::string& path, SystemTools::Stat_t* buf)
   // Ideally we should use ConvertToWindowsExtendedPath to support
   // long paths, but _wstat64 rejects paths with '?' in them, thinking
   // they are wildcards.
-  return _wstat64(Encoding::ToWide(path).c_str(), buf);
+  std::wstring const& wpath = Encoding::ToWide(path);
+#if defined(__BORLANDC__)
+  return _wstati64(wpath.c_str(), buf);
+#else
+  return _wstat64(wpath.c_str(), buf);
+#endif
 #else
   return stat(path.c_str(), buf);
 #endif
diff --git a/SystemTools.hxx.in b/SystemTools.hxx.in
index bfd979d2a5c43adafaa882c7050d76e368dc41d0..53abce7a0d12b47270f732ac396bbb803eae533f 100644
--- a/SystemTools.hxx.in
+++ b/SystemTools.hxx.in
@@ -331,7 +331,11 @@ public:
  * Cross platform wrapper for stat struct
  */
 #if defined(_WIN32) && !defined(__CYGWIN__)
+#if defined(__BORLANDC__)
+  typedef struct stati64 Stat_t;
+#else
   typedef struct _stat64 Stat_t;
+#endif
 #else
   typedef struct stat Stat_t;
 #endif