[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: dynamic loading of windows dll's in lua as plugins?
- From: Jeroen Janssen <japj@...>
- Date: Thu, 20 May 1999 10:29:44 +0200
At 09:18 5/19/99 -0300, you wrote:
>At 17:57 5/18/99 -0300, you wrote:
>>>From firstname.lastname@example.org Tue May 18 15:37:39 1999
>>>Ok, here I am.
>>>I put loadlib at http://www.tecgraf.puc-rio.br/~rborges/loadlib/.
>I downloaded it, it and looks like that's exactly what I need (also
>Now I can start working on the actual thing :)
Yesterday I managed to create the following on the win32 platform :
lua.dll, tolua.dll, lualib.dll, loadlib.dll and lmidas.dll and a test
executable based upon lua.c (the console lua app).
My test executable is dynamicly linked with lua.dll, tolua.dll, lualib.dll
and loadlib.dll and I can use the lua loadlib function to load the
lmidas.dll from lua. This lmidas.dll contains the lua "tolua" code for
midas11.dll (a soundsystem) publicly available from www.s2.org/midas. The
DllMain function of lmidas.dll calls the tolua_lmidas_open() function.
As a result of all this (and as I needed to able to do) I now can load a
dll from within lua, that dll will provide the lua "glue" code for another
dll (in this case midas11.dll) and I can call midas functions from within lua.
However, after thinking about some remarks made about dynamicly
loading/unloading libraries I send an email to the tolua author asking to
add support for a tolua_package_close() function that will remove the
package from lua. Currently only a tolua_package_open() function gets
generated and for the unloading proces of libraries it's usefull if the
code to remove the package from lua also gets generated by tolua.
I also am wondering if there is some kind of mechanism to allow an
(auto-generated)check? be performed on wether there are lua variables that
contain a type provided by the to-be-unloaded package. (this to garantee
that other (lua) code will not crash when trying to access an unloaded
function or type). any ideas?
The main reason (at the moment) for this consideration is to have a console
app available that can be used to dynamicly load, test & unload dynamic
libraries (and start the load,test,unload cycle again) instead of providing
only the loading of dynamic libraries wich implicit requires to exit the
running program and start a new program.