lua-users home
lua-l archive

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


>>>>> "pierlu" == pierlu  <pierlu@gmail.com> writes:

 pierlu> Given that I don't have such an issue when I use the
 pierlu> interpreter, I ended up thinking that that error is caused by
 pierlu> mysql.so library being compiled as C while lua being compiled
 pierlu> within GnuGk as C++

Before jumping to conclusions you should check the obvious thing: are
you exporting the necessary symbols from the main program?

Here is how to check, on ELF systems at least:

1. First establish if lua is being linked in as a static library or a
dynamic one. You can do this by doing `ldd yourprog` and seeing if the
output mentions a liblua.so / liblua-5.3.so or similar.

If there is a dynamic linked liblua then the symbols are available to
loaded modules and you have to look elsewhere for the cause of the
error.

2. If lua was linked statically, check the output of `nm -D yourprog`
to see if it mentions all of the lua_* symbols (which should appear as
defined, with 'T' and not 'U'). If they do not appear, then the main
program was not compiled with -Wl,--export-dynamic or -Wl,-E to export
its symbols to dynamically loaded libraries. (You'll notice if you look
at the lua sources that the "lua" executable is built this way.)

If on the other hand you see in the nm -D output symbols that look like
the lua_* ones but with added nonsense appended to the end, _then_ you
have a C vs C++ compilation mismatch.

-- 
Andrew.