lua-users home
lua-l archive

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

On Fri, 2009-05-08 at 11:00 +0200, steve donovan wrote:
> My initial search only revealed that other people have had this
> problem.  My application on Linux links against liblua, and all goes
> well until a script tries to load lfs, and then gives the dreaded
> 'undefined symbol: lua_touserdata', which obviously means that the
> linker is not pulling in everything from liblua.
> Naturally, I could just drop lfs.c into my project, but is there a
> general way of forcing the GCC linker to bring in all the symbols from
> a library? -rdynamic seems rather drastic, since my understanding is
> that this makes _everything_ visible dynamically.

The *correct* way to do this, and the way it *MUST* be done to work
reliably, is to ensure that the C side of any Lua extension is *LINKED*

The basic rule of "If it uses the symbols, it should link against it" is
true here.

I encountered the same issue when I was trying to load libdbi in an
addon to Aranha. I had Aranha dlopen()s extension which is linked to
libdbi which dlopen()s a dbd driver. The dbd driver used symbols in
libdbi but didn't link to it, and so couldn't be opened properly. Link
the dbd to libdbi and the runtime linker works it all out nicely.


Daniel Silverstone               
PGP mail accepted and encouraged.            Key Id: 2BC8 4016 2068 7895