lua-users home
lua-l archive

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

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:

"C/Invoke is a library for connecting to C libraries at runtime."

Sample Win32 code from the tarball:


  user32 ="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 Lua runtime to manage your resources and to protect you from Crash City :-)