New method to unload DLLs
External strings created by DLLs may need the DLL code to be deallocated. This implies that a DLL can only be unloaded after all its strings were deallocated, which happen only after the run of all finalizers. To ensure that order, we create a 'library string' to represent each DLL and keep it locked. When this string is deallocated (after the deallocation of any string created by the DLL) it closes its corresponding DLL.
This commit is contained in:
@@ -300,6 +300,12 @@ else
|
||||
assert(_ENV.x == "lib2-v2" and _ENV.y == DC"lib2-v2")
|
||||
assert(lib2.id("x") == true) -- a different "id" implementation
|
||||
|
||||
for _, len in ipairs{0, 10, 39, 40, 41, 1000} do
|
||||
local str = string.rep("a", len)
|
||||
local str1 = lib2.newstr(str)
|
||||
assert(str == str1)
|
||||
end
|
||||
|
||||
-- test C submodules
|
||||
local fs, ext = require"lib1.sub"
|
||||
assert(_ENV.x == "lib1.sub" and _ENV.y == DC"lib1")
|
||||
@@ -447,7 +453,7 @@ do
|
||||
end
|
||||
|
||||
|
||||
-- test of large float/integer indices
|
||||
-- test of large float/integer indices
|
||||
|
||||
-- compute maximum integer where all bits fit in a float
|
||||
local maxint = math.maxinteger
|
||||
|
||||
Reference in New Issue
Block a user