lua-users home
lua-l archive

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


On Mon, Mar 29, 2010 at 18:03, Phoenix Sol <phoenix@burninglabs.com> wrote:
> I have Lua embedded in a C program, and it raises an error when loading
> a script which loads a C module.
>
> I'm compiling the program like this:
> gcc uckfuped.c -Wall -O2 -I/usr/local/include -L/usr/local/lib -llua
> -ldl -lm -o uckfuped
>
> And when I run it, it tells me:
> error loading module 'nixio' from file
> '/usr/local/lib/lua/5.1/nixio.so': /usr/local/lib/lua/5.1/nixio.so:
> undefined symbol: lua_getmetatable
>
>
> Hopefully the problem is obvious to someone more experienced? Thanks.

You need to tell the linker to export the Lua symbols so they are
visible to a dynamic object that is loaded at runtime. With GCC it's
typically the following you need to add to your link command: -Wl,-E
(see also the 'ld' man page).

-- 
Dirk