lua-users home
lua-l archive

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

Asko Kauppi wrote:
> Edgar Toernig wrote:
> >
> > Btw, what happens under Windows when an application tries
> > to load a dll multiple times?  Is it allowed?  How many
> > FreeLibrary-calls are needed?  Does each instance gets
> > its own data/bss segment?
> As far as I know:
> Multiple DLL usage within the same process goes to same DLL instance.   
> Needs as many frees as there have been loads.
> Other processes will see their own instance (code pages etc. shared of  
> course), unless the DLL uses inter-process data sharing.

Thank you.  One last clarification: what happens with the data
section of the dll (i.e. global vars).  Do all instances of the
dll within the single process get the same data segment (and thus
share the data segment) or does each instance gets a private data

> What's the real usage/need scenario for the unloadlib?

What's the usage of GCing stuff that was loaded with 'loadfile'?
Why should 'loadlib' leak memory?  Whether code is implemented
in Lua or in a dll should be an implementation detail the user
shouldn't care about.  The interfaces are already pretty similar
(input a file name, output a function).  Maybe someday loadlib
gets incorporated into loadfile the same way as precompiled Lua
scripts.  The user wouldn't even know what kind of code he's
loading, a Lua source, a precompiled script or a shared library.
Shouldn't then the GC behaviour be the same too?

Ciao, ET.

> dllproc/base/freelibrary.asp
> dllproc/base/process_and_thread_functions.asp

These links don't seem to work... both give the same "Welcome" page.