lua-users home
lua-l archive

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



On Feb 06, 2005, at 22:45, Mike Pall wrote:

Change this to: -o lsocket.so

Ok:

(info) link: 'gcc -bundle -undefined dynamic_lookup -o lsocket.so auxiliar.o buffer.o except.o inet.o io.o luasocket.o mime.o options.o select.o tcp.o timeout.o udp.o usocket.o'

The 'require' namespace does not separate between Lua and C modules.
But LuaSocket happens to be a mixed-language library. Thus:

require("socket") is supposed to load socket.lua (Lua) which in turn does
require("lsocket") which is supposed to load lsocket.so (C).

Ok.

I.e. install socket.lua into the Lua module path /usr/local/share/lua/5.1
and install lsocket.so into the C module path /usr/local/lib/lua/5.1.

Ok. Still no dice:

lua: ./Library/Lua/socket.lua:15: error loading package `lsocket' (symbol `_luaopen_lsocket' not found)
stack traceback:
        [C]: in function `require'
        ./Library/Lua/socket.lua:15: in main chunk
        [C]: in function `require'
        Example.lua:237: in main chunk
        [C]: ?

I made sure to update luasocket.c to use '_luaopen_lsocket' as an entry point, but still no luck :/

I guess with require("socket") vs. require("lsocket") it's not entirely
obvious what is happening here ...

Hmmm... not that obvious, yes... :P

On a more positive note, I managed to create self-contained modules for both md5 and uuid. I tried the same with gdbm, but, while it did compile and load properly (even created a test db), it then failed with the following exception:

dyld: lua Undefined symbols:
./Library/Modules/gdbm.so undefined reference to _lua_boxpointer expected to be defined in a dynamic image
Trace/BPT trap

What is a "_lua_boxpointer"?

For the record, here is how I have structured my project:

../ProjectX/					<- my stuff
../ProjectX/Library/Lua/		<- external .lua code
../ProjectX/Library/Modules/	<- external .so modules

All in all, works quite nicely and allows me to keep my project self-contained (e.g. no need to mess around with /usr/ or such).

Cheers

--
PA, Onnay Equitursay
http://alt.textdrive.com/