mlua icon indicating copy to clipboard operation
mlua copied to clipboard

lua how to requre dll

Open leiguoqiang opened this issue 3 years ago • 2 comments

I want to integrate idea debugging tools in Lua, but MLUa does not seem to support loading external DLLS for use, here is the sample code: package.cpath = package.cpath .. ';C:/Users/UserData/AppData/Roaming/JetBrains/IntelliJIdea2021.2/plugins/EmmyLua/classes/debugger/emmy/windows/x64/?.dll' local dbg = require('emmy_core') dbg.tcpConnect('localhost', 9966)//emmy_core crash

leiguoqiang avatar May 09 '22 10:05 leiguoqiang

From the doc you need to use Lua::new_unsafe to load DLLs

khvzak avatar May 09 '22 21:05 khvzak

From the doc you need to use Lua::new_unsafe to load DLLs

Even though use Lua::new_unsafe, it's still not possible to use loaded DLLS in Lua. Integrating Lua debugging tools (such as EmmyLua) is what most projects need to do.It would be nice to provide a working example.Here is my simple sample code

TestLua.zip LuaTestFiles.zip

leiguoqiang avatar May 10 '22 09:05 leiguoqiang

What is the error that you receive? Are you sure that the c library you load is compatible with the version of lua that you let mlua run? Did you enable the debug module on mlua's side? (At least, I would imagine a debugger needs access to that)

There are also debuggers written entirely in lua, do those work?

lenscas avatar May 03 '23 07:05 lenscas