lua-users home
lua-l archive

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

>>>>> "Chris" == Chris Smith <> writes:

 Chris> If I understand correctly, the two caveats you detail only apply
 Chris> because the main application is dynamically linked to the Lua
 Chris> library? If I statically linked both application and module to
 Chris> their respective Lua libraries then I wouldn’t expect any
 Chris> issues, correct?

Incorrect at least on ELF platforms (I don't know about MacOS), and this
is exactly the problem that bit us in PostgreSQL.

Our scenario went like this: libpgcommon.a (a static library) comes in
multiple versions: libpgcommon.a is for the frontend, libpgcommon_srv.a
is for the backend. They define the same functions but with different

The main application, "postgres", is linked statically to
libpgcommon_srv.a. "postgres" can (on request) dynamically load the
module "" with dlopen; is dynamically
linked against, which is statically linked against

What we found is that on platforms where we weren't using a version
script to hide symbols,'s calls to functions in libpgcommon
were actually being resolved not to the ones statically linked into, but to the copies from the "postgres" binary which of course
came from libpgcommon_srv.a; we had crashes as a result. See e.g.