Git Product home page Git Product logo

Comments (6)

AgentRev avatar AgentRev commented on July 19, 2024 1

The simplest option is probably for me to stick with system-lua54 then, and I will provide an offline package for Lua 5.4 to my very few users, who use MSYS2 solely for our app. MSYS2's package manager only provides the latest version, so this will ensure the app won't stop working when Lua 5.5 is eventually released.

from rlua.

jugglerchris avatar jugglerchris commented on July 19, 2024

Hi,
This is a feature, but I think it needs to be more obvious in the README/documentation, sorry for that!

In 0.19.x, by default, loading DLLs is disabled as it's a safety issue in the Rust sense. There's an unsafe constructor which lets you specify that loading DLLs is ok. Instead of:

Lua::new()  // initialize with relatively safe defaults

use:

Lua::unsafe_new_with_flags(
    StdLib::ALL_NO_DEBUG,  // Load all Lua standard libraries apart from debug
   InitFlags::DEFAULT - InitFlags::REMOVE_LOADLIB,  // Allow loading binary libraries
)

Other default flags are PCALL_WRAPPERS (prevent Lua scripts from catching Rust panics) and LOAD_WRAPPERS (prevent loading Lua bytecode).

I will leave this issue open until the documentation has been improved.

As to the segfault, that's concerning. When you say "running the script", does that mean something that uses moonfltk? Perhaps the builtin Lua is compiled with some flags different from the system one which make it not binary compatible with it somehow.

from rlua.

AgentRev avatar AgentRev commented on July 19, 2024

I replaced all instances of Lua::new with Lua::unsafe_new_with_flags as you suggested, and I can now successfully use v0.19.4. Thanks. With builtin-lua54, everything works, however if I uninstall my system Lua, I get this error:

Lua error loading file: runtime error: error loading mo
dule 'moonfltk' from file '.\moonfltk.dll':
        The specified module could not be found.

    stack traceback:
        [C]: in ?
        [C]: in ?
        [C]: in function 'require'
        [string "?"]:4: in main chunk

Everything works fine again if I reinstall Lua. So, it seems moonfltk doesn't want to use the builtin Lua for some reason. Not that big of a deal, tho.

The segfault only happened with builtin v0.18 and below, I have not seen it so far with v0.19.

from rlua.

jugglerchris avatar jugglerchris commented on July 19, 2024

Oh. That sounds to me like moonfltk.dll is linked to a lua.dll - so even if you're using the builtin Lua it'll still link to that. The builtin one should be statically linked with the executable using rlua, so it could be that in this case you end up with two Lua interpreters linked in, which sounds like it could be related to your segfaults on 0.18.

In principle I presume it'd be possible for the builtin Lua to be turned into a DLL instead of a static library, which might work better in this case.

from rlua.

jugglerchris avatar jugglerchris commented on July 19, 2024

I think I've since found out a way to use the builtin Lua - the executable needs to export symbols. See #273 (comment) .

from rlua.

jugglerchris avatar jugglerchris commented on July 19, 2024

As the changes needed are in applications, I think this issue can be closed.

from rlua.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.