aboutsummaryrefslogtreecommitdiff
path: root/testes/attrib.lua
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-07-09 14:40:36 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-07-09 14:40:36 -0300
commit85a3c1699c9587a9e952b4ab75b1c6c310ebebea (patch)
tree67e17e9e8f74259a56690456e705a4158e5cc33e /testes/attrib.lua
parentf65d1f9e02d891733d4ff1cf8d4bc91291e0098e (diff)
downloadlua-85a3c1699c9587a9e952b4ab75b1c6c310ebebea.tar.gz
lua-85a3c1699c9587a9e952b4ab75b1c6c310ebebea.tar.bz2
lua-85a3c1699c9587a9e952b4ab75b1c6c310ebebea.zip
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.
Diffstat (limited to 'testes/attrib.lua')
-rw-r--r--testes/attrib.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/testes/attrib.lua b/testes/attrib.lua
index d8b6e0f3..8a3462ea 100644
--- a/testes/attrib.lua
+++ b/testes/attrib.lua
@@ -300,6 +300,12 @@ else
300 assert(_ENV.x == "lib2-v2" and _ENV.y == DC"lib2-v2") 300 assert(_ENV.x == "lib2-v2" and _ENV.y == DC"lib2-v2")
301 assert(lib2.id("x") == true) -- a different "id" implementation 301 assert(lib2.id("x") == true) -- a different "id" implementation
302 302
303 for _, len in ipairs{0, 10, 39, 40, 41, 1000} do
304 local str = string.rep("a", len)
305 local str1 = lib2.newstr(str)
306 assert(str == str1)
307 end
308
303 -- test C submodules 309 -- test C submodules
304 local fs, ext = require"lib1.sub" 310 local fs, ext = require"lib1.sub"
305 assert(_ENV.x == "lib1.sub" and _ENV.y == DC"lib1") 311 assert(_ENV.x == "lib1.sub" and _ENV.y == DC"lib1")
@@ -447,7 +453,7 @@ do
447end 453end
448 454
449 455
450-- test of large float/integer indices 456-- test of large float/integer indices
451 457
452-- compute maximum integer where all bits fit in a float 458-- compute maximum integer where all bits fit in a float
453local maxint = math.maxinteger 459local maxint = math.maxinteger