I created a lua module for windows, a DLL, which has a number of dependencies. These dependencies are required for the module DLL to function correctly, most of these dependencies are C++ runtime libraries (libstdc+-6.dll and libgcc_s_seh-1.dll among others). I am trying to load the module using the package.loadlib
call:
init = assert(package.loadlib("C:\\Path\\To\\My\\Module.DLL", "luaopen_MyModule"))
init()
The dependencies and module DLL are located in another folder than the main executable's DLL. Because of this, it seems like package.loadlib
cannot find the dependencies of the module. It works fine when the path to these dependencies is added to the PATH variable, but I am not allowed to modify PATH on the machines where the lua module will be used, neither can I link to the dependencies statically.
Is there any way to specify a search path for the dependencies from lua? The lua will only be used on Windows systems, so the solution may be platform dependent.