lua-users home
lua-l archive

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


At 22:07 5/27/99 -0300, you wrote:
> >> having Lua in a DLL or having plugins in a DLL?
>
>   Having Lua in a DLL.  Specifically:  sometimes with wrapping something
>up into a DLL you have to write a few custom initializing/finalizing type
>things to get it all working right.  Or you have to write wrapper functions
>to expose certain variables and such.  I haven't yet found any such
>problems with Lua, but I'm still new to it, so was wondering if anyone else
>had encountered anything like that.

well, I think this probably would be a concern if you are using multiple
threads that access certain functions & variables, but if you have a single
thread (your main application) I don't think it should be a problem (I
haven't found any yet).

>   Does it work having _both_ Lua and library extensions in DLL's?  (not
>that I'm likely to do that, probably just Lua in DLL extensions static in
>host app, but I'm curious)

sure, there is a lua addon called loadlib that can load dll's from Lua. 

You could link a dll with the import lib of lua and then in the DllMain you
could set global lua functions,etc. This way a lua script can be used to
'configure' the extension to be loaded. I did some small tests and I have
got it working with a public available module player dll (MIDAS). I load
lmidas.dll from lua (lue glue for midas.dll) and lmidas.dll is linked with
the import dll of midas. After I load lmidas.dll from lua I have access to
several MIDAS functions that allow loading/unloading/playing/stopping of
modules from lua. Only problem I currently have is the things that could
happen if I wanted to unload lmidas.dll (the lua glue code for midas
wouldn't be available anymore,etc)

Jeroen