From: John L. <jla...@gm...> - 2006-06-08 19:57:20
|
On 6/8/06, Darwin Slattery <dar...@ho...> wrote: > Just to clarify what I'm trying to do first: > I have a class called MyClass in a namespace called nsa. Its a very simple You can easily fake using the namespaces by adding this in the in the rules file. -- in lua access as nsa.MyClass hook_lua_namespace = "nsa" -- in C++ the code is compiled in namespace nsa hook_cpp_binding_post_includes = "namespace nsa;\n" > class with 2 member functions SetX and GetX which set and return an int. I > would eventually like to move this > class into sub-namespace of nsa called nsb. My main problem is that I don't > want to move the > class into the global C++ namepsace. Ideally I would also like to access Ugh, this is not something I really want to get involved in. You're talking about a class like this class MyClass { public: class MyClass2 { public: int GetX(); void SetX(int x); int x; } Stuff for MyClass } > this class in lua by > using nsa.nsb.MyClass but I don't mind using nsa_nsb.MyClass. I think you will need to use the latter. To allow you to access nsa.nsb.MyClass would require significant changes to the binding code generator and how wxLua deals with looking things up in the bindings. BUT! see below send me the sample code and if it's not too bad I'll do it. > I tried adding "#include \"MyClass.h\"; using nsa::MyClass" in the > hook_cpp_binding option but this > produced the following errors: > wxluanstest.cpp:21: error: 'MyClass' is already declared in this scope > wxluanstest.cpp: In function 'int wxLua_MyClass_constructor(lua_State*)': > wxluanstest.cpp:40: error: no matching function for call to > 'wxLua_AddToTrackedMemoryList(wxLuaState&, nsa::MyClass*)' > /usr/local/include/wxlua/include/wxlbind.h:189: note: candidates are: void > ... I'd really have to be able to see the input and output code to make any sense of this. It looks like you have a nice little sample class and the interface file, could you just post the two of those and I can take a look at it this weekend. > Using nsa::MyClass instead of just MyClass in the .i file without the > hook_cpp_binding > value above produced: > > wxluanstest.h:48: error: 'wxObject_nsa' has not been declared > wxluanstest.h:48: error: expected unqualified-id before ':' token > wxluanstest.cpp:110: error: 'wxLua_nsa' has not been declared > wxluanstest.cpp:111: error: 'wxLua_nsa' has not been declared > make: *** [wxluanstest.o] Error 1 See above, I'd have to see the output, but I'm guessing that the generator is not expecting :: to be in a classname and so it's just doing weird things. -John Labenski |