lua-users home
lua-l archive

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

On Tue, 18 Jan 2011, Thomas Harning Jr. wrote:

> On Tue, Jan 18, 2011 at 4:01 PM, Iain Hibbert <> wrote:
> > Hi,
> >
> > I'm using Lua 5.1.4 [now imported in NetBSD] and trying to have a C
> > function create an array of items, but have found that it is causing the
> > Lua interpreter to coredump on exit.
> >
> > I've googled a bit but found no comments about that and am wondering if
> > this is a generic thing or just local?  My basic test module is attached,
> > triggering a failure is as easy as calling the function and exiting..
> Are you linking against lua in your test library, or are you letting
> it find the symbols of the already-executing Lua executable?
> If you are linking against Lua for your module, you are not doing it
> right...  The Lua executable and many tools that use Lua and "might"
> use your module are statically linked to Lua and when you link against
> it, you cause problems due to slightly mismatched symbols.


I was not sure what you were talking about here but it did give me the
clue I needed, thanks.. as-is the lua executable needs to be linked with
"-Wl,-E" as during a dlopen() if there are unmatched symbols they will be
looked for externally - in this case I guess, finding them in
/usr/lib/ and loading code from there..

.. and I guess that what happens is that the loaded code will end up
referring to a different global symbol somewhere (or cause a global symbol
to be re-initialized)


(linking the lua executable with the shared library in the first place
does also fix this - will discuss which method is best for the NetBSD