1
// Copyright 2013 Dolphin Emulator Project
2
// Licensed under GPLv2
3
// Refer to the license.txt file included.
7
// Neither Android nor OS X support TLS
8
#if defined(__APPLE__) || (ANDROID && __clang__)
12
// Generic function to get last error message.
13
// Call directly after the command or use the error num.
14
// This function might change the error code.
15
const char* GetLastErrorMsg()
17
static const size_t buff_size = 255;
20
static __declspec(thread) char err_str[buff_size] = {};
22
FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(),
23
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
24
err_str, buff_size, NULL);
26
static __thread char err_str[buff_size] = {};
28
// Thread safe (XSI-compliant)
29
strerror_r(errno, err_str, buff_size);