diff --git a/src/n8/ast/expression/VariableDeclarationExpression.cpp b/src/n8/ast/expression/VariableDeclarationExpression.cpp index 19444d1..a4bea5e 100644 --- a/src/n8/ast/expression/VariableDeclarationExpression.cpp +++ b/src/n8/ast/expression/VariableDeclarationExpression.cpp @@ -88,15 +88,24 @@ NativeFunction VariableDeclarationExpression::loadNativeFunction( #if defined(_WIN32) || defined(_WIN64) || defined(WIN32) || defined(WIN64) std::filesystem::path path(library); - std::filesystem::path searchFolder(path - .parent_path() - .string() + const char* parentPath = path.parent_path().string(); + int size = MultiByteToWideChar( + CP_UTF8, 0, + parentPath, -1, + nullptr, 0 + ); + + wchar_t* wfolderPath = new wchar_t[(size_t) size]; + MultiByteToWideChar( + CP_UTF8, 0, + parentPath, -1, + wfolderPath, + size ); - std::wstring searchPath = searchFolder.wstring(); handle = LoadLibraryA(library.c_str()); SetDllDirectoryW(searchPath.c_str()); - std::cout << "Loading DLLs from: " << searchPath.c_str() << std::endl; + std::cout << "Loading DLLs from: " << searchFolder.wstring() << std::endl; #elif defined(__APPLE__) handle = dlopen(library.c_str(), RTLD_LAZY);