c++ - Lua DLL Library Dependencies -
i created lua module windows, dll, has number of dependencies. these dependencies required module dll function correctly, of these dependencies c++ runtime libraries (libstdc+-6.dll , libgcc_s_seh-1.dll among others). trying load module using package.loadlib
call:
init = assert(package.loadlib("c:\\path\\to\\my\\module.dll", "luaopen_mymodule")) init()
the dependencies , module dll located in folder main executable's dll. because of this, seems package.loadlib
cannot find dependencies of module. works fine when path these dependencies added path variable, not allowed modify path on machines lua module used, neither can link dependencies statically.
is there way specify search path dependencies lua? lua used on windows systems, solution may platform dependent.
if have no way statically include dependencies or modify path affect dll search, can try option: load dependencies directly using same package.loadlib
call before load module.dll
. used in situation when wanted make sure dll libraries depend on loaded correct location:
package.loadlib([[c:\path\to\whatever\libstdc++-6.dll]], "") init = assert(package.loadlib("c:\\path\\to\\my\\module.dll", "luaopen_mymodule")) init()
Comments
Post a Comment