lua-users home
lua-l archive

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

> "unrequire" successfully removes the Lua visible references to a C shared library, but it doesn't actually unload it from the memory. From what I can tell, ll_unloadlib() is only called when the userdata with the shared library handle is GC'ed ( which usually is when the Lua state is closed, since the userdata is in the registry )

You're right. You need to remove that userdata in the registry and then
collect garbage, perhaps twice, since the userdata has a finalizer.
To get the registry, call debug.getregistry(). Then search for a key
of the form "LOADLIB: "..x where x contains the name of your module.