Skip to content

Commit

Permalink
Fix attempt for Windows parameters for GetProcAddress().
Browse files Browse the repository at this point in the history
  • Loading branch information
nthnn committed Dec 23, 2024
1 parent a97e09d commit b9f6901
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/n8/ast/expression/VariableDeclarationExpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,14 @@ NativeFunction VariableDeclarationExpression::loadNativeFunction(

#elif defined(_WIN32) || defined(_WIN64) || defined(WIN32) || defined(WIN64)

auto func = std::bit_cast<NativeFunction>(GetProcAddress(
(HMODULE) handle,
name.c_str()
));
union FunctionCaster {
FARPROC proc;
NativeFunction func;
};

FunctionCaster caster;
caster.proc = GetProcAddress(static_cast<HMODULE>(handle), name.c_str());
auto func = caster.func;

#endif

Expand Down

0 comments on commit b9f6901

Please sign in to comment.