lua-users home
lua-l archive

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


This is looking very promising, especially since it comes with source that hands
out the three needed functions:

HMEMORYMODULE MemoryLoadLibrary(const void *);
FARPROC MemoryGetProcAddress(HMEMORYMODULE, const char *);
void MemoryFreeLibrary(HMEMORYMODULE);

Though I still wonder how dependencies are resolved (i.e. if DLL A needs also
DLL B). But since it comes with source that can be adjusted (looking right now
at it, I see that it falls back to "LoadLibrary" for such modules, but that
could be forwarded to a different function).

In theory, it should be possible to create a Lua module that replaces the
function "require" and allows calling custom DLL loader functions that could
then retrieve binary DLL data from various places using Lua code - right? If
that's the case, I guess it is doable with a reasonable amount of work.

Anyone else who would be interested in such a Lua module?

Eike

> Take a look at:
> 
> http://www.joachim-bauch.de/tutorials/load_dll_memory.html
> 
> --
> e.v.e
> 
> 
> 
> On Tue, Dec 9, 2008 at 1:35 AM, Eike Decker <eike@cube3d.de> wrote:
> > Hi
> >
> > I want to bundle multiple Lua libraries in a single file (i.e. a ZIP
> file).
> > Loading Lua files is not the problem but loading DLLs seems to be
> difficult...
> > I tried looking how to load DLLs from memory or how to create a VFS but
> this
> > seems to go nowhere.
> > There exist applications (http://www.molebox.com/) that can include DLLs
> into a
> > single exe and it is said that these applications load the DLLs from memory
> and
> > not from the file system - so there seems to exist a solution... but I
> haven't
> > been able to find it till now, or the solution must be quite complex.
> > The alternative would be to leave the DLLs out and distribute the DLLs
> alongside
> > with the exe - but I would prefer a solution to include all libraries into
> a
> > single archive - without extracting these dlls to a temporary file.
> > Of course I could also link the exe statically with the libraries, but I
> would
> > prefer not to do this and could instead simply wrap the DLLs as they
> come...
> >
> > Probably not worth the extra work for the minor advantage of having a
> purely
> > psychologically cleaner looking distribution, yet I am interested if and
> how
> > this could be done - otherwise I'll simply put these DLLs alongside with
> the
> > files. Any pointers would be welcome.
> >
> > Thanks
> > Eike
> >
> >
>