[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Calling arbitrary functions in Windows DLLs from Lua
- From: Duck <duck@...>
- Date: Fri, 7 Dec 2007 11:20:45 +1100 (EST)
I need to module to let my Lua scripts call
arbitrary functions in Windows DLLs.
Before I roll my own, has anyone written one already?
This might do what you want:
http://www.nongnu.org/cinvoke/lua.html
"C/Invoke is a library for connecting to C libraries at runtime."
Sample Win32 code from the tarball:
require("cinvoke_lua")
user32 = clibrary.new("user32.dll", "stdcall")
MessageBox = user32:get_function(Cint, "MessageBoxA", Cptr,
Cstring, Cstring, Cint32)
MessageBox(0, "Hello From Lua",
"C/Invoke Message Box", 0)
But be careful out there...no Lua runtime to manage your resources and to
protect you from Crash City :-)