| 204 | namespace us { |
| 205 | |
| 206 | std::string GetLastErrorStr() |
| 207 | { |
| 208 | #ifdef US_PLATFORM_POSIX |
| 209 | return std::string(strerror(errno)); |
| 210 | #else |
| 211 | // Retrieve the system error message for the last-error code |
| 212 | LPVOID lpMsgBuf; |
| 213 | DWORD dw = GetLastError(); |
| 214 | |
| 215 | FormatMessage( |
| 216 | FORMAT_MESSAGE_ALLOCATE_BUFFER | |
| 217 | FORMAT_MESSAGE_FROM_SYSTEM | |
| 218 | FORMAT_MESSAGE_IGNORE_INSERTS, |
| 219 | nullptr, |
| 220 | dw, |
| 221 | MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), |
| 222 | (LPTSTR) &lpMsgBuf, |
| 223 | 0, nullptr ); |
| 224 | |
| 225 | std::string errMsg((LPCTSTR)lpMsgBuf); |
| 226 | |
| 227 | LocalFree(lpMsgBuf); |
| 228 | |
| 229 | return errMsg; |
| 230 | #endif |
| 231 | } |
| 232 | |
| 233 | MITKCPPMICROSERVICES_EXPORT ::std::string GetDemangledName(const ::std::type_info& typeInfo) |
| 234 | { |