lua-users home
lua-l archive

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

Well I got it working, the missing magic was to put an extern "C" in the
Example_Init extern.  Now I'm testing the use of classes, and I'm not able
to call any member function of my C++ class other than the constructor which
does work.

I'm using the example right out of in example.h I have:
class List {
   char Names[5][25];

//   ~List();
//   int  search(char *item);
   void insert(char *item);
//   void remove(char *item);
   char *get(int n);
   int  length;

In bind.i I have:
class List {
  void insert(char *item);
  char *get(int n);
  int  length;

And in the lua script I have:
print("This is a Lua Script");
l = example.List();

The script seems to stop running on the first insert call (first member
function that's not the constructor).  I hit a breakpoint in the constructor
just fine, but no break point in the insert method ("Test1" is the last
output seen), it just goes straight to my breakpoint after the lua_close()
(using the simple main lua interpreter example from the previous post link).

Any ideas on why these class method calls are not functioning? Or things I
should test out?


Message: 11
Date: Tue, 20 Dec 2005 13:48:18 -0700
From: Jason Rego <>
Subject: binding lua-c++ with swig or anything else...
To: "''" <>
Message-ID: <20FBBBCACA21D511B5C400B0D017706A03BC0762@TELETYPE>
Content-Type: text/plain; charset="us-ascii"

Has anyone had success using lua<->c++ bindings with swing 1.3 on ms visual
c++ .net 2003?  I'm building and compiling the example from (although with changing the
parameter type of Example_Init from LuaState to lua_State) with no problem,
but when I link I'm getting an unresolved symbol on Example_Init.

The other thing I'm not sure about is the docs talk about adding in a
#define for LUA_EXTRALIBS but I'm not seeing a reference to this anywhere in
the _wrap.cxx.  Attached are the files involved if that would help.

Any help on this would be greatly appreciated, it seems like I'm running
into walls with all the different lua autobinders.  I'm unable to create the
toluac++ windows executable and now this :)

Jason Rego
Software Engineer
Rainbow Studios