[win] Fix GetModuleHandle build with clang-cl
This fixes the following warning:
[352/1440] compile ../../src/base/thread_utils.cc
FAILED: obj/src/base/base.thread_utils.obj
../../buildtools/win/clang/bin\clang-cl.exe /nologo /showIncludes /FC -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_DEPRECATE -DNOMINMAX -D_HAS_EXCEPTIONS=0 -DWIN32_LEAN_AND_MEAN -DNDEBUG -DPERFETTO_IMPLEMENTATION -I../.. -I../../src/profiling/memory/include -I../../include -Igen/build_config -Igen -fstrict-aliasing -Wformat -Wno-deprecated /bigobj /Gy /FS /utf-8 /Zc:__cplusplus /WX -fcolor-diagnostics /W2 /wd4244 /wd4267 -Wno-float-equal -Wno-unused-macros -Wno-old-style-cast -Weverything -Wno-c++98-compat-pedantic -Wno-c++98-compat -Wno-disabled-macro-expansion -Wno-documentation-unknown-command -Wno-gnu-include-next -Wno-gnu-statement-expression -Wno-gnu-zero-variadic-macro-arguments -Wno-padded -Wno-poison-system-directories -Wno-reserved-id-macro -Wno-reserved-identifier -Wno-shadow-uncaptured-local -Wno-unknown-sanitizers -Wno-unknown-warning-option -Wno-unsafe-buffer-usage /O2 /Zc:inline /GR- /std:c++17 /c ../../src/base/thread_utils.cc /Foobj/src/base/base.thread_utils.obj /Fd"obj/src/base/base_c.pdb"
../../src/base/thread_utils.cc(60,29): error: cannot initialize a parameter of type 'LPCSTR' (aka 'const char *') with an lvalue of type 'const wchar_t[13]'
::GetModuleHandle(L"Kernel32.dll"), "SetThreadDescription"));
^~~~~~~~~~~~~~~
C:\b\s\w\ir\cache\windows_sdk\win_sdk\Include\10.0.18362.0\um\libloaderapi.h(261,21): note: passing argument to parameter 'lpModuleName' here
_In_opt_ LPCSTR lpModuleName
^
../../src/base/thread_utils.cc(76,29): error: cannot initialize a parameter of type 'LPCSTR' (aka 'const char *') with an lvalue of type 'const wchar_t[13]'
::GetModuleHandle(L"Kernel32.dll"), "GetThreadDescription"));
^~~~~~~~~~~~~~~
C:\b\s\w\ir\cache\windows_sdk\win_sdk\Include\10.0.18362.0\um\libloaderapi.h(261,21): note: passing argument to parameter 'lpModuleName' here
_In_opt_ LPCSTR lpModuleName
^
2 errors generated.
Change-Id: Ie2561ea2cd0c4574567627e7b5d79a56bdc4b540
diff --git a/src/base/thread_utils.cc b/src/base/thread_utils.cc
index f0c4e35..f25eafe 100644
--- a/src/base/thread_utils.cc
+++ b/src/base/thread_utils.cc
@@ -57,7 +57,7 @@
// The SetThreadDescription API works even if no debugger is attached.
static auto set_thread_description_func =
reinterpret_cast<SetThreadDescription>(::GetProcAddress(
- ::GetModuleHandle(L"Kernel32.dll"), "SetThreadDescription"));
+ ::GetModuleHandleA("Kernel32.dll"), "SetThreadDescription"));
if (!set_thread_description_func) {
return false;
}
@@ -73,7 +73,7 @@
bool GetThreadName(std::string& out_result) {
static auto get_thread_description_func =
reinterpret_cast<GetThreadDescription>(::GetProcAddress(
- ::GetModuleHandle(L"Kernel32.dll"), "GetThreadDescription"));
+ ::GetModuleHandleA("Kernel32.dll"), "GetThreadDescription"));
if (!get_thread_description_func) {
return false;
}