From a5cd9aeb89b9c685036ba270053cc4a7031aa4d1 Mon Sep 17 00:00:00 2001 From: Nathanne Isip Date: Fri, 13 Dec 2024 20:35:17 +0800 Subject: [PATCH] Fixed implementation of VariableDeclarationExpression::loadNativeFunction() for Windows target. --- src/n8/ast/expression/VariableDeclarationExpression.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/n8/ast/expression/VariableDeclarationExpression.cpp b/src/n8/ast/expression/VariableDeclarationExpression.cpp index a4bea5e..a0147a4 100644 --- a/src/n8/ast/expression/VariableDeclarationExpression.cpp +++ b/src/n8/ast/expression/VariableDeclarationExpression.cpp @@ -88,7 +88,10 @@ NativeFunction VariableDeclarationExpression::loadNativeFunction( #if defined(_WIN32) || defined(_WIN64) || defined(WIN32) || defined(WIN64) std::filesystem::path path(library); - const char* parentPath = path.parent_path().string(); + const char* parentPath = path + .parent_path() + .string() + .c_str(); int size = MultiByteToWideChar( CP_UTF8, 0, parentPath, -1, @@ -104,8 +107,8 @@ NativeFunction VariableDeclarationExpression::loadNativeFunction( ); handle = LoadLibraryA(library.c_str()); - SetDllDirectoryW(searchPath.c_str()); - std::cout << "Loading DLLs from: " << searchFolder.wstring() << std::endl; + SetDllDirectoryW(wfolderPath); + std::cout << "Loading DLLs from: " << wfolderPath << std::endl; #elif defined(__APPLE__) handle = dlopen(library.c_str(), RTLD_LAZY);