lua-users home
lua-l archive

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


On 12/5/2011 11:08 AM, Dimiter 'malkia' Stanev wrote:
C is proven interface to work for system level work, because it's compatible across many compilers and run-time systems. C++ is nice that it embeds types and such, but it fails to encode them the same way on the binary level (would not even start mentioning the class layout and virtual inheritance low-level schemes).

That could help to a point, but sometimes your entire problem requires objects which can be "owned" by either C++ or Lua, at which point it's nice to wrap shared pointers in Lua. For my purposes it's fine that I wouldn't have binary compatibility; I like to statically link Lua in with the libraries anyway, so everything can be built by the same compiler.

I'd use LuaBind, but it generates *so* much bloat that I can't stomach it. The tolua++ code doesn't handle shared_ptr natively, as I've mentioned on the list before, and its internal code is ugly. None of the other C++ wrappers handle shared_ptr in the way that I want, so it looks like I'm going to have to join the ranks of people reinventing the wheel to do their own custom binding generator.

I have too much to bind to want to do it all by hand, so I'm looking at taking an approach like lqt or dub, where I take the output of a C++ parser and create my own flavor of bindings. No one does it "the right way" (IMO) except possibly LuaBind, and their approach is WAY too heavy.

Tim