lua-users home
lua-l archive

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

Hi all,

The installation instructions for luasocket describe how to install it as a dynamic library.  For my application, it would be preferable to just compile luasocket in statically, but this only half working.  I had to change a couple of headers:

--- mime.h      2005-01-15 14:52:38.000000000 -0800
+++  2005-10-19 22:35:46.000000000 -0700
@@ -19,6 +19,6 @@
 #define MIME_API extern
-MIME_API int luaopen_mime(lua_State *L);
+MIME_API int luaopen_lmime(lua_State *L);
 #endif /* MIME_H */

--- luasocket.h 2005-01-15 14:52:38.000000000 -0800
+++     2005-10-19 22:34:54.000000000 -0700
@@ -27,6 +27,6 @@
 * Initializes the library.
-LUASOCKET_API int luaopen_socket(lua_State *L);
+LUASOCKET_API int luaopen_lsocket(lua_State *L);
 #endif /* LUASOCKET_H */

So now it compiles, but here's where I'm stuck.  I added these lines to my lualibs array:

    {"lmime", luaopen_lmime},

however when I run the program, lsocket and lmime are both nil, but socket and mime are defined:

lua> print(lsocket)
lua> print(lmime)

lua> table.foreach(socket,print)
protect function: 0x2153ab0
dns     table: 0x2153c70
gettime function: 0x2153ac0
udp     function: 0x2154b30
newtry  function: 0x2153760
__unload     function: 0x2153af0
VERSION LuaSocket 2.0 (beta3)
select  function: 0x2154b40
tcp     function: 0x21544a0
skip    function: 0x21536e0
sleep   function: 0x21537b0

lua> table.foreach(mime,print)
unqp    function: 0x2155470
eol     function: 0x2155310
unb64   function: 0x2153a60
wrp     function: 0x21554a0
dot     function: 0x21546d0
b64     function: 0x2155270
qpwrp   function: 0x2153a50
qp      function: 0x2155340

The socket table here is incomplete though.  In particular, the try() function is missing from `socket', so I can't use the http module.  So, why did it rename lsocket to socket?  Is there a recommended way to statically link with luasocket?