From: Marcos <mar...@ya...> - 2006-03-04 18:12:29
|
Thanks, John I will try. But, I think wxlua.exe must correctly use the require function without recompile libraries, because my goal is to use the binaries disposed on the web. Example is luasql, luazip, luasocket and so.. Another question is: You have a project to build wxLua module(dll,so) for dynamic load with lua.exe? Thanks in advance Marcos W. -------------- Em Tue, 28 Feb 2006 18:23:03 -0300, John Labenski <jla...@gm...> escreveu: > Ok, I hacked away a bit, it's not pretty, but I got it to work in MSW. > I downloaded the sources for luasocket-2.0.tar.gz. Compiled it using > MSVC 2005 express using the sln file, I had to edit the *.vcproj to > point to wxLua/module/lua/include for the include path to lua.h. > > I edited mime.h/c and added > MIME_API int luaopen_mime(lua_State *L); > MIME_API int luaopen_mime(lua_State *L) { > return luaopen_mime_core(L); > } > > edited socket.h/c and added > LUASOCKET_API int luaopen_socket(lua_State *L); > LUASOCKET_API int luaopen_socket(lua_State *L) { > return luaopen_socket_core(L); > } > > *** I don't know why I have to do that? > > I then created a dir called "socket" and "mime" in the > luasocket-2.0/src dir and copied (not moved) all the lua files into > them. I moved src/mime.dll to src/mime/core.dll and src/socket.dll to > src/socket/core.dll. You HAVE TO either delete src/socket.dll and > src/mime.dll or get rid of them somehow, otherwise require tries to > load them instead of mime.lua and socket.lua and they have to both be > called core.dll. > > src/mime.lua -- these two are already there, leave others too > src/socket.lua > src/mime/core.dll > src/socket/core.dll > src/socket/ftp.lua > src/socket/http.lua > src/socket/smtp.lua > src/socket/socket.lua > src/socket/tp.lua > src/socket/url.lua > > I edited src/compat/compat5.1r4/compat5.1.lua to have this > > package.cpath = os.getenv("LUA_CPATH") or > "./?.dll;" .. > instead of ?.so for unix systems. I could have just used the > environment variables, but after some debugging about why it couldn't > find the libs I just left it the way I had it. > > It works! Both using the lua.exe program and wxlua.exe. I ran the > programs from the luasocket-2.0/src dir like this > ../../wxLua/bin/wxlua.exe wxlua_socket.lua (the name I gave your program) > (note also I'm using cygwin in Windows so I use forward slashes) > I made some tweaks to wxLua.exe to make it handle the errors a little > better. > > I'm not sure that this helps at all since I really just trashed > things, but the problem you have is with the paths not being right and > it not being able to find either the lua or dll files for the module's > require. > > To help debug things change src/compat/compat5.1r4/compat5.1.lua > > At the top add the "print" to this list of functions > > local print, assert, error, getfenv, ipairs, loadfile, loadlib, pairs, > setfenv, setmetatable, type = print, assert, error, getfenv, ipairs, > loadfile, loadlib, pairs, setfenv, setmetatable, type > > then later on add some "print" statements > > local function search (path, name) > ... > print("search ", c) > > local function loader_C (name) > print("loader_C ", name) > > local function loader_Lua (name) > print("loader_Lua ", name) > > and whatever else seems necessary to help you understand why it cannot > find what it's looking for. > > Good luck, > John Labenski _______________________________________________________ Yahoo! Acesso Grs - Internet rda e grs. Instale o discador agora! http://br.acesso.yahoo.com |