From: John L. <jla...@gm...> - 2006-05-17 17:05:28
|
On 5/17/06, Francesco Montorsi <f18...@ya...> wrote: > Hi, > I'm experimenting with wx module and I've got a few proposals for it: > > 1) the luamodule.wx.lua files in wxLua/apps/luamodule/src is an example, > isn't it ? Shouldn't then go in wxLua/samples ? > wrapmodule.wx.lua is an utility so shouldn't it got in wxLua/utils ? Eh... I think these are pretty specialized. But, you're probably right, once things work they should be moved. I just put them into the dir where I generated the shared lib since I was having trouble with the paths for require. > 2) I'm getting a weird behaviour of lua's require: I'd like to make the > "luamodule" app installable in $prefix/lib/lua/5.1; however, while > everything works as expected if I put the compiled wx.so in > /usr/local/lib/lua/5.1, it doesn't work if I put it in /usr/lib/lua/5.1: This is the path stuff I was talking about, it's a nightmare. > wxlua-lua: luamodule.wx.lua:17: module 'wx' not found: > no field package.preload['wx'] > no file './wx.so' > no file '/usr/local/lib/lua/5.1/wx.so' > no file '/usr/local/lib/lua/5.1/loadall.so' > stack traceback: > [C]: in function 'require' > luamodule.wx.lua:17: in main chunk > [C]: ? > > I tried to set LUA_PATH in luamodule.wx.lua to: > LUA_PATH=3D"/usr/lib/lua/5.1/?.so;" > *before* the require() call but then I get: > > wxlua-lua: error loading module 'wx' from file '/usr/lib/lua/5.1/wx.so': > /usr/lib/lua/5.1/wx.so:1: unexpected symbol near 'char(127)' > stack traceback: > [C]: ? > [C]: in function 'require' > luamodule.wx.lua:17: in main chunk > [C]: ? > > that "unexpected symbol near 'char(127)'" is not clear to me ! > > This strange behaviour (lua bug?) is easy to reproduce also putting the > wx.so file in /usr/local/lib/lua/5.1 and then setting: > > LUA_PATH=3D"/usr/local/lib/lua/5.1/?.so" > > So, it looks that the global variable LUA_PATH, described at > http://www.lua.org/pil/8.1.html, does not work... is anyone able to > reproduce this "bug" ? LUA_PATH, I think, is a 5.0 thing, but recently Ray added some code in our version of lua to handle it. Hopefully he (or anyone else) understands what this is all about? I've spent far too much time trying to understand the PATH thing and got nowhere. I was hoping that the people who requested that require work w/ wxLua would step forward and finish things. :) Regards, John Labenski ps. This was a reply I got on the lua-l about dlls and require, it looks like for gcc in MSW you just link the dlls as you do the .so files in linux. No news about MSVC. On 5/13/06, J=E9r=F4me VUARAND <jer...@gm...> wrote: > With mingw you can do exactly the same to build a wx.dll Lua module : > wx.dll: luamodule.cpp $(OBJECTS) $(LUA_LIBS) wxLuaLib wxLuaDebugLib > wxLuaSocketLib wxLuaBindings > $(CXX) $(CXXFLAGS) $(APPEXTRADEFS) -g -O -shared -o wx.dll -fpic = \ > $(LDLIBS) $(APPEXTRALIBS) \ > luamodule.cpp > > The only extra thing you have to do is to check that all your > -l$(XXXLIB) point to existing libraries. These libraries can either be > static libs, or dll import libraries. Static libs are exactly like on > unix (-lfoo need libfoo.a). Dll import libraries are necessary if you > want to link dynamically to a dll. You can generate libfoo.a from > foo.dll with the following commands : > impdef foo.dll > foo.def > libtool --kill-at --dllname foo.dll --input-def foo.def --output-= lib libfoo.a > rm foo.def > These import libraries may already exist in the wxWidget build tree if > you built it with mingw. > > Feel free to ask if I'm not clear. I had a hard time finding docs on > the subject since everything on mingw site is outdated, but now I > think I know the subject well. |