lua-users home
lua-l archive

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


I actually put my win32 handles in a table (called _liblst). The win32 library
handles are helpful to have around for various other functions like resource
loads from libraries.
> Leaving libraries open doesn't seem to be a good programming practice.
Pathological practice.

On Fri, 3 Sep 2004 02:31:39 +0200 (CEST), Ignacio Castaño
<castanyo@yahoo.es> wrote:
> 
> It would be nice to put the handles in a special table, something like:
> __lib, so that libraries could be unloaded manually or when the app closes.
> The same thing applies with dlfcn, but using dlclose instead of FreeLibrary.
> Leaving libraries open doesn't seem to be a good programming practice.
> 
> --
> Ignacio Castaño
> castanyo@yahoo.es
> 
> --- David Burgess <dburgess@gmail.com> escribió:
> > Would it be possible to add a GC method to the Win32 code
> > in loadlib.c for library handles?
> >
> > e,g,
> >
> > static int loadlib_gc(lua_State *L)
> > {
> >     HMODULE h = (HMODULE)(lua_unboxpointer(L,1));
> >     if (h)  FreeLibrary(h);
> >     return 0;
> > }
> >
> > In practice this method only gets called when lua_close() is called.
> >
> 
>                 
> ______________________________________________
> Renovamos el Correo Yahoo!: ¡100 MB GRATIS!
> Nuevos servicios, más seguridad
> http://correo.yahoo.es
> 


-- 
db