lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Sun, May 16, 2021, 3:44 AM Stefan Ginsberg <stefan.ginsberg@gmail.com> wrote:
So this allows for mixing statically linked instances with each other, as well as mixing shared linking with static linking?

But why use static linking at all if shared linking (.dll/.so) is an option?
How common are such setups that you would need mixing to begin with?
I am assuming shared linking means one library instance (for most cases).

Depends on your use case. If you're just working with the standalone interpreter and multiple extension modules, odds are pretty high everything is calling into the same shared library. However, you can't necessarily guarantee this. 

But Lua is designed for embedding, and an application developer embedding it may choose to statically link Lua because they don't want to expose the library in their application; they just want to offer scripting capabilities within the application. However, if require() is made available (not removed for sandboxing) and not modified, a skilled user could require an extension module that uses a shared library. 5.4 allows that extension to interoperate with the statically linked library within the application. 

(Admittedly, this is unlikely since the ability to require an extension module breaks any and all attempts at sandboxing that the app developer might try. But not every application cares about sandboxing.)