lua-users home
lua-l archive

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


Is there any way the library could ever be unloaded, before the Lua state is destroyed?
If not, the registry is certainly a good solution.

If there is some way to "unrequire" (http://lua-users.org/lists/lua-l/2012-12/msg00883.html ... does not seem to work),
and dlclose/FreeLibrary (ll_unloadlib) is called before the luaclose_lib call, a call into an unloaded lib will crash the entire application when the Lua state is destroyed.

On Mon, Aug 24, 2020 at 8:54 PM Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
> Some solutions I could imagine:
> - Add some "key=lwuserdada, value=userdata with __gc metatable" to the
> library table ... tested, works ... but seems like an inelegant workaround
> and "what is this undocumented userdata in your libary"

I would suggest this approach, but adding this entry into the registry
instead of in the library.

-- Roberto