[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [libdl / C/C++ modules] free(): invalid pointer
- From: Rici Lake <lua@...>
- Date: Tue, 26 Dec 2006 22:25:33 -0500
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.