Skip to content

Commit 417c6e4

Browse files
authored
Support non-Latin file path
1 parent 8f2b1d3 commit 417c6e4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/PottoModuleEntryManager.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#if defined(_WIN32)
22
#include <Windows.h>
33
#define PTModHandle HMODULE
4-
#define PTLoadModule ::LoadLibraryA
4+
#define PTLoadModule ::LoadLibraryW
55
#define PTGetProcAddr ::GetProcAddress
66
#define PTFreeModule ::FreeLibrary
77
#else
@@ -12,6 +12,8 @@
1212
#define PTFreeModule ::dlclose
1313
#endif
1414

15+
#include <filesystem>
16+
1517
#include "PottoModuleEntryManager.h"
1618

1719
namespace Potto {
@@ -28,7 +30,8 @@ POTTO_ERROR Potto::PottoModuleEntryManager::LoadModule(const std::string& module
2830
// Find or load the module
2931
std::lock_guard<std::mutex> lock(m_mtxForLoadModule);
3032
#if defined(_WIN32)
31-
hMod = PTLoadModule(moduleName.c_str());
33+
std::filesystem::path moduleNamePath = std::filesystem::u8path(moduleName);
34+
hMod = PTLoadModule(moduleNamePath.wstring().c_str());
3235
#else
3336
hMod = PTLoadModule(moduleName.c_str(), RTLD_LAZY);
3437
#endif

0 commit comments

Comments
 (0)