I wanted to write a DLL library that integrates into the Lua language for modding one game.
I ran into a problem when I connect the Lua library, everything is fine, but as soon as I start using functions from Lua, the GM 2.0 compiler gives an error 126. I don’t know what the problem is because I compiled the DLL as a 64 bit file and the Lua library is the same comes as a 64 bit file.
Here is the DLL code:
#include "pch.h"
#include <iostream>
#define GMDLL extern "C" __declspec(dllexport)
extern "C"
{
#include "lua/include/lua.h"
#include "lua/include/lualib.h"
#include "lua/include/lauxlib.h"
}
#pragma comment(lib, "lua/liblua54.a")
GMDLL double DLLTest()
{
lua_State* L = luaL_newstate();
lua_close(L);
std::cout << "success" << std::endl;
return 0;
}
Errors:
LoadLibraryW("PATH_TO_DLL") for function "DLLTest" failed with error code 126 ("The specified module could not be found.")
LoadLibraryW("PATH_TO_DLL") for function "?YYExtensionInitialise@@YAXPEBUYYRunnerInterface@@_K@Z" failed with error code 126 ("The specified module could not be found.")
LoadLibraryW("PATH_TO_DLL") for function "?YYExtensionInitialise@@YA_NPEBUYYRunnerInterface@@_K@Z" failed with error code 126 ("The specified module could not be found.")
LoadLibraryW("PATH_TO_DLL") for function "?YYExtensionInitialise@@YANPEBUYYRunnerInterface@@_K@Z" failed with error code 126 ("The specified module could not be found.")
In general, if your DLL depends on another DLL, you'll want to also add that to the extension so that it is exported next to yours.