[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [help] undefined symbol when loading shared object module from embedded lua_state
- From: Dirk Feytons <dirk.feytons@...>
- Date: Mon, 29 Mar 2010 18:16:23 +0200
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