[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Using Xavante/Lua with SQLite
- From: Doug Currie <doug.currie@...>
- Date: Mon, 27 Feb 2006 20:32:09 -0500
Monday, February 27, 2006, 7:21:30 PM, Jilani Khaldi wrote:
> Indipendently of Xavante, my problem is how to access SQLite3 database
> from Lua (5.0.2 or 5.1) under Windows2000. I downloaded
> |lua-sqlite3-0.3.zip|
> <http://www.nessie.de/mroth/lua-sqlite3/lua-sqlite3-0.3.zip> and I tried
> to compile it to a DLL using MinGW and DevCPP (*) but I failed.
Perhaps you can be a little more specific about the failure.
Using MinGW/MSYS I built sqlite-3.3.4 from sources; you can look at
the sqlite mailing list archives to see the minor changes needed to
build the DLL with MinGW/MSYS
http://article.gmane.org/gmane.comp.db.sqlite.general/17343
or you can just get the pre-built DLL from the sqlite web site.
After making sqlite, I placed sqlite3.dll in /usr/local/bin and
sqlite.h in /usr/local/include (note that these are MSYS paths).
Then I unpacked lua-sqlite3-0.3; in the Makefile I changed five
occurrences of ".so" to ".dll" and in the Makefile.cfg I added
-L$(bindir) to LDFLAGS (*), and used -llua51 for LUA_LIBS.
Then:
$ make
gcc -g -Wall -I/usr/local/include -c -o libluasqlite3.o libluasqlite3.c
gcc -L/usr/local/lib -L/usr/local/bin -Wl,-rpath,/usr/local/lib -shared -o libluasqlite3.dll libluasqlite3.o -llua51 -lsqlite3
m4 -DSHARED_LIB_PATH=/c/Dev/lua/lua-5.1/modules/lua-sqlite3-0.3 \
< libluasqlite3-loader.lua.in > libluasqlite3-loader.lua
m4 -DSHARED_LIB_PATH=/usr/local/lib/lua \
< libluasqlite3-loader.lua.in > libluasqlite3-loader.lua.install
I had to edit libluasqlite3-loader.lua for three reasons:
1. It assumes the ".so" name, so I changed it to ".dll"
2. It puts an MSYS path in the file instead of a Windows path, so I
manually fixed shared_lib_path.
3. For 5.1 I changed loadlib to package.loadlib
Then:
$ make check
/usr/local/bin/lua tests.lua
#### Test Suite with 38 Tests in 15 Test Cases loaded.
#### Running 'open_memory' (1 Tests)...
[...]
#### Test Suite finished.
907 Assertions checked. All Tests passed!
Regards,
e
(*) I have lua51.dll and sqlite3.dll in /usr/local/bin because the
Windows path to /usr/local/bin is in my PATH so Windows can find the
DLLs to load them