summaryrefslogtreecommitdiffstats
path: root/source/core/slang-platform.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/core/slang-platform.cpp')
-rw-r--r--source/core/slang-platform.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/source/core/slang-platform.cpp b/source/core/slang-platform.cpp
index 25e6bc6f0..75c1b96cd 100644
--- a/source/core/slang-platform.cpp
+++ b/source/core/slang-platform.cpp
@@ -122,7 +122,7 @@ SLANG_COMPILE_TIME_ASSERT(E_OUTOFMEMORY == SLANG_E_OUT_OF_MEMORY);
handleOut = nullptr;
if (!platformFileName || strlen(platformFileName) == 0)
{
- if (!GetModuleHandleExA(0, nullptr, (HMODULE*)&handleOut))
+ if (!GetModuleHandleExW(0, nullptr, (HMODULE*)&handleOut))
return SLANG_FAIL;
return SLANG_OK;
}
@@ -131,12 +131,14 @@ SLANG_COMPILE_TIME_ASSERT(E_OUTOFMEMORY == SLANG_E_OUT_OF_MEMORY);
// First attempt tries on the directories explicitly specified with AddDllDirectory(),
// If it failed to find one, we will search over all PATH.
// Windows API made two approaches mutually exclusive and we need to try two times.
- // https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexa
- HMODULE h = LoadLibraryExA(platformFileName, nullptr, LOAD_LIBRARY_SEARCH_USER_DIRS);
- // If LoadLibraryExA failed, try again with LoadLibraryA.
- // https://docs.microsoft.com/en-us/windows/desktop/api/libloaderapi/nf-libloaderapi-loadlibrarya
+ // https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexw
+ String platformFileNameStr(platformFileName);
+ HMODULE h =
+ LoadLibraryExW(platformFileNameStr.toWString(), nullptr, LOAD_LIBRARY_SEARCH_USER_DIRS);
+ // If LoadLibraryExW failed, try again with LoadLibraryW.
+ // https://docs.microsoft.com/en-us/windows/desktop/api/libloaderapi/nf-libloaderapi-loadlibraryw
if (!h)
- h = LoadLibraryA(platformFileName);
+ h = LoadLibraryW(platformFileNameStr.toWString());
// If still not found, return an error.
if (!h)
{
@@ -356,7 +358,8 @@ static const PlatformFlags s_familyFlags[int(PlatformFamily::CountOf)] = {
/* static */ SlangResult PlatformUtil::outputDebugMessage([[maybe_unused]] const char* text)
{
#ifdef _WIN32
- OutputDebugStringA(text);
+ String textStr(text);
+ OutputDebugStringW(textStr.toWString());
return SLANG_OK;
#else
return SLANG_E_NOT_AVAILABLE;