mlua-rs / mlua

High level Lua 5.4/5.3/5.2/5.1 (including LuaJIT) and Roblox Luau bindings to Rust with async/await support
Other
1.75k stars 139 forks source link

Can Lua symbols be exported on Windows? #451

Closed CppCXY closed 2 months ago

CppCXY commented 2 months ago

If I want to debug Lua scripts on Windows, at least, the process needs to export Lua symbols. Is there a way to do this?

khvzak commented 2 months ago

the process needs to export Lua symbols.

could you provide more information?

CppCXY commented 2 months ago

the process needs to export Lua symbols.

could you provide more information?

If I want to debug mlua's Lua scripts, mlua must export symbols that can be dynamically loaded by external DLLs.

khvzak commented 2 months ago

mlua must export symbols that can be dynamically loaded by external DLLs.

mlua is just a library. Should your app export symbols instead?

I'm not familiar (never developed) with windows. On macos and linux you can export symbols by creating .cargo/config.toml with the content:

[target.<your arch>]
rustflags = ["-C", "link-args=-rdynamic"]

I'm not sure will this approach work on windows or not. When last time I checked windows even does not support dynamic symbols lookup (eg passing -undefined=dynamic_lookup for modules) and require having Lua VM as dll rather than statically linked to the app.

CppCXY commented 2 months ago

Thanks