lua-users home
lua-l archive

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

On Wed, Dec 30, 2009 at 1:52 AM, Jack Surfer <> wrote:
> What would be even more interesting would be IMHO to build a script to
> generate those bindings from windows header files...

There are a _lot_ of Windows API functions, with many structures and
constants. Thousands of functions could be awkward.  But you could
make a suitable database of function/structure signatures, and bind
the functions only when they are used. That could be very efficient.

> Do you guys have insights about this or already done similar things? Maybe
> links or directions for me?

Have a look at how LuaGnome does its bindings. It converts the GTK
headers into XML using gccxml, which is easier to parse. But this tool
could be a bitch to get going on Windows. Nothing wrong with direct
header parsing (lpeg or a lexical scanner) but there is a lot of
preprocessor stuff going on first (i.e. parse the headers after
putting them through cpp)  And watch out for the ansi/widechar
function pairs (GetWindowTextA, GetWindowTextW)

steve d.