lua-users home
lua-l archive

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


I have a C++ SDK that I would like to call from Lua.

Here some basic info about the SDK :

1) It is mature, meaning that it's classes and signatures will not change.
In fact, we're freezing the SDK for the entire duration of the project.

2) It's methods do not support the Lua calling convention [int *fn(lua_State
*L)] but I could put a thin Wrapper on top of the SDK that supported the
calling convention, the methods of which would delegate to the actual SDK
methods (i.e. a proxy).  The Wrapper would then be registered with Lua.

3) The SDK method signatures require atomic types (bools, ints and C-strings
mostly), and return the same.  Meaning:  We must be able to pass the SDK
methods atomic parameters, and return these also!!!!

***** Note: We wish to use LUA 5, i.e. the latest version.

To make matters even simpler, we intend to call only a few methods in some
of the base classes of the SDK.  By this I mean to say, the number of total
required SDK methods needed to be accessable from Lua will be small ( < 20).

I have been studying all available documentation:
- The Programming in Lua book
- The Wiki tutorials

I've looked at the following notes and papers:
- Luabind
- toLua
- toLua++
- Luna
- Technical Note 5  - A Template class for binding C++ to Lua (uses Luna)
- Tutorial  "Binding Code To Lua"
- Tutorial  "Simple Cpp Binding"
- Tutorial  "Simpler Cpp Binding"
- Tutorial  "Do it yourself Cpp Binding"

Here is my question:  There seem to be several similiar but competing
techniques.  Some generate code, some not.  Given my preconditions as stated
above (stable, unchanging SDK; not too many methods need to be referenced;
necessity of passing (ints, bools, strings) to the called SDK methods, and
returning these to Lua), can anyone make a recommendation as to what would
be the best approach to use?

I cannot say if we need to go in the other direction also, i.e. C calling
Lua.  Maybe later, I cannot rule it out.

I would like to get a skeleton (Lua calling the SDK) up and running asap.  I
think because I am new to Lua the simplest solution might be preferrable,
but which?

***** Also: I looked at the toLua++, and downloaded the file
(tolua++-current.tar.bz2).  Is this file usable on Windows?  How do I unpack