don't rename the .so file; the require('xx') function call does a loadlib('xx.so','luaopen_xx'). that means that to open the library, Lua has to call a function with a name based on the library name.
Hi, thank you but actually if I do not rename it, when make install it will symlink the library to mysql.so anyway, ; it created a dir called luasql and put the so there, symlink it to mysql.so. If I change to that dir and run lua, then do a
require'mysql' same error
it can load the mysql.so but unresolve symbol.
lua automatically use the current dir as the PATH to load the so file.
> luaopen_luasqlmysql so I guess the lib name should be
> And just symbolic link to it solve the problem. So somehow the default configuration in the Makefile which defines LIBNAME and LOADLIB is incorrect; at least in mycase.
It is incorrect now, because the definition changed :-)
This code was written to the previous version of the package model,
for Lua 5.0, not for Lua 5.1. Your solution is correct, by the way.