Skip to content

Commit

Permalink
Fixed implementation of VariableDeclarationExpression::loadNativeFunc…
Browse files Browse the repository at this point in the history
…tion() for Windows target.
  • Loading branch information
nthnn committed Dec 13, 2024
1 parent 21fc476 commit be92798
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/n8/ast/expression/VariableDeclarationExpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include <n8/core/SymbolTable.hpp>
#include <n8/util/PathHelper.hpp>

#include <filesystem>

#if defined(__unix__) || defined(__linux__) || defined(__APPLE__)
# include <dlfcn.h>
#elif defined(_WIN32) || defined(_WIN64) || defined(WIN32) || defined(WIN64)
Expand Down Expand Up @@ -56,7 +58,8 @@ DynamicObject VariableDeclarationExpression::visit(SymbolTable& symbols) {

return {};
}

#include <iostream>
#include <locale>
NativeFunction VariableDeclarationExpression::loadNativeFunction(
std::string& libName,
std::string& funcName,
Expand Down Expand Up @@ -84,7 +87,13 @@ NativeFunction VariableDeclarationExpression::loadNativeFunction(
#endif
else {
#if defined(_WIN32) || defined(_WIN64) || defined(WIN32) || defined(WIN64)

std::filesystem::path path(library);
std::cout << "Loading DLLs from: " << path.parent_path().string().c_str() << std::endl;

AddDllDirectory(path.parent_path().wstring().c_str());
handle = LoadLibraryA(library.c_str());

#elif defined(__APPLE__)
handle = dlopen(library.c_str(), RTLD_LAZY);
#elif defined(__unix__) || defined(__linux__)
Expand Down

0 comments on commit be92798

Please sign in to comment.