lua-users home
lua-l archive

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


On Tue, 2011-04-12 at 10:56 +0200, steve donovan wrote:
> On Tue, Apr 12, 2011 at 9:26 AM, Dirk Laurie <dpl@sun.ac.za> wrote:
> > Is there something special about Qt that makes this approach work,
> > or should there be a decent chance for other large packages?
> 
> It's a common enough strategy. Wolfgang Oertl's LuaGnome builds the
> bindings by converting the GTK+ headers to XML using gccxml.  The
> functions then get converted to a big lookup table and he then uses
> libffi for the actual dispatch. Some functions require special
> treatment, but most of it is automated.

This is what I wanted to do with LuaJIT FFI, because the generated
shared libraries are as large as the Qt libraries themselves.

However, the problem is that Qt is a C++ API, and uses different calling
conventions than C (thiscall), which is supported neither by libffi, nor
LuaJIT FFI. There is another problem - the C++ mangling scheme, which is
compiler-dependent, and very poorly documented.

The idea of generating a database with classes and types, and use a FFI
to do the right thing at runtime is very nice, but does not seem
possible right now...