lua-users home
lua-l archive

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



On 26-Dec-06, at 9:40 PM, Mildred wrote:

My compilation commands :

$ g++ -g -shared luamod.cpp -llua -lm -o luamod.so
$ gcc -g testlua.c -ldl -llua -lm -o testlua

My guess is that you're ending up with two instances of liblua. That won't work.

You don't mention whether liblua is liblua.so or liblua.a, but assuming the latter, I think you need to use the following:

g++ -g -shared luamod.cpp -o luamod.so
gcc -g testlua.c -Wl,-E -ldl -llua -lm -o testlua

-Wl,-E passes the -E flag (--export-dynamic) to the linker, which makes symbols in the executable visible to dlopen'd shared objects.