From 85a3c1699c9587a9e952b4ab75b1c6c310ebebea Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 9 Jul 2025 14:40:36 -0300 Subject: 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. --- testes/attrib.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'testes/attrib.lua') 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 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 -- cgit v1.2.3-55-g6feb