[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Loadlib work 5,1
- From: Roberto Ierusalimschy <roberto@...>
- Date: Fri, 03 Sep 2004 09:45:04 -0300
> so that libraries could be unloaded manually or when the app closes.
To unload libraries manually seems quite dangerous. It is hard to know
(manually) for sure that there are no more functions that use the
library. One option is to add the handle as an upvalue in all functions
from that library. So, when the last function is collected, the handle
would be collected, too. (I think ET mentioned something like that
sometime ago.) This works, but it adds some overhead on C functions.
And is the unloading of dynamic libraries during run-time really
To unload the library when the app closes is much easier. We can simply
put the handle in the registry (with an appropriate GC metamethod).