[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: binding lua-c++ with swig or anything else...
- From: Jason Rego <JasonR@...>
- Date: Wed, 21 Dec 2005 11:46:40 -0700
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
http://www.swig.org/Doc1.3/Lua.html#Lua_nn14 in example.h I have:
class List {
protected:
char Names[5][25];
public:
List();
// ~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 {
public:
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();
print("Test1");
l.insert("Ale");
print("Test2");
l.insert("Stout");
print("Test3");
l.insert("Lager");
print("Test4");
print(l.get(1));
print(l.length);
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 <JasonR@rainbowstudios.com>
Subject: binding lua-c++ with swig or anything else...
To: "'lua@bazar2.conectiva.com.br'" <lua@bazar2.conectiva.com.br>
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
http://www.swig.org/Doc1.3/Lua.html#Lua_nn4 (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
jasonr@rainbowstudios.com
*/