[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: Lua/C++ binding library showdown: who's the best?
- From: "Nick Trout" <nick@...>
- Date: Tue, 25 Oct 2005 12:00:14 -0700
> On Behalf Of Ashwin Hirschi
> Over the last 3 years I've created more than half a dozen bindings by
> hand, and I'm pretty sure I vastly prefer them over anything that
> have been generated automatically.
For small APIs and where you want to take advantage of Lua's syntax I'd
agree. However if you are wrapping a large, existing API, competent
automatic generation can save you a LOT of time. The recent addition of
SWIG (although I haven't had a chance to test it yet) looks promising as
you can generate bindings for all languages that SWIG works for, i.e. if
there is a SWIG binding for an API now, it will also work for Lua (and
there are quite a few SWIG binding for Python out there). Writing and
maintaining large bindings takes a lot of work.
The binding doesn't just have to be the end, you can add an adaptor
layer (either in C over the C API, or in Lua over on top of the C
binding) to Lua-ise the interface. E.g. the layer might take a table as
a constructor and construct your object using the C API then return it
to you. It's quicker to write this kind of code in Lua than C.