summaryrefslogtreecommitdiff
path: root/CCache/util.c
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2008-12-19 21:41:05 +0000
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2008-12-19 21:41:05 +0000
commitab29ac767a5938de30c33b769a77e0c002dc15aa (patch)
treef4d8b2264212fafe8b32b2bdd8667e6bb33b54f9 /CCache/util.c
parentf66e1f3a099cb3bee33137342d62e13a4b218702 (diff)
downloadswig-ab29ac767a5938de30c33b769a77e0c002dc15aa.tar.gz
win32 fixes to pass the ccache test-suite
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10987 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'CCache/util.c')
-rw-r--r--CCache/util.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/CCache/util.c b/CCache/util.c
index cdb654d5d..fdd832446 100644
--- a/CCache/util.c
+++ b/CCache/util.c
@@ -845,3 +845,23 @@ int x_utimes(const char *filename)
#endif
}
+#ifdef _WIN32
+/* perror for Win32 API calls, using GetLastError() instead of errno */
+void perror_win32(LPTSTR pszFunction)
+{
+ LPTSTR pszMessage;
+ DWORD dwLastError = GetLastError();
+
+ FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ dwLastError,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPTSTR)&pszMessage,
+ 0, NULL );
+
+ fprintf(stderr, "%s: %s\n", pszFunction, pszMessage);
+ LocalFree(pszMessage);
+}
+#endif