Reid Spencer | 0b22ba4 | 2004-09-15 05:48:11 +0000 | [diff] [blame^] | 1 | //===- Win32/Win32.h - Common Win32 Include File ----------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file was developed by Reid Spencer and is distributed under the |
| 6 | // University of Illinois Open Source License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file defines things specific to Unix implementations. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | //=== WARNING: Implementation here must contain only generic UNIX code that |
| 16 | //=== is guaranteed to work on all UNIX variants. |
| 17 | //===----------------------------------------------------------------------===// |
| 18 | |
| 19 | #include "llvm/Config/config.h" // Get autoconf configuration settings |
| 20 | #include "windows.h" |
| 21 | #include <cassert> |
| 22 | #include <string> |
| 23 | |
| 24 | inline void ThrowError(const std::string& msg) { |
| 25 | char *buffer = NULL; |
| 26 | FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, |
| 27 | NULL, GetLastError(), 0, (LPSTR)&buffer, 1, NULL); |
| 28 | std::string s(msg); |
| 29 | s += buffer; |
| 30 | LocalFree(buffer); |
| 31 | throw s; |
| 32 | } |
| 33 | |