lua-users home
lua-l archive

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

you can check whether your symbols are exported using the 'nm' tool.


On Mon, Mar 29, 2010 at 6:16 PM, Dirk Feytons <> wrote:
> On Mon, Mar 29, 2010 at 18:03, Phoenix Sol <> 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/': /usr/local/lib/lua/5.1/
>> 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