What is the easiest way to use Sqlite in D program on Ubuntu? -
What is the easiest way to use Sqlite in D program on Ubuntu? -
i suppose using phobos.etc.c.sqlite3
binding. compiling sqlite3.c using c compiler create .o file , link program.
which c compiler should use, , compiler flags? possible link sqlite3.o dmd in 1 step, without calling linker separately?
or there other easier way?
answer: how sqlite going d on 64bit ubuntu
install sqlite dev sudo apt-get install libsqlite3-dev
compile dmd test.d -l-ldl -l/usr/lib/x86_64-linux-gnu/libsqlite3.a
test.d
import std.stdio, std.string, etc.c.sqlite3; void main () { sqlite3* db; auto ret = sqlite3_open (tostringz("mydb.s3db"), &db); writeln (ret); }
-ldl switch needed because of sqlite3 linking problems
you can utilize binding available sqlite
library (of appropriate version, certainly), without having manually compile object file. have done in c: you'd #include <headers>
, add together -llibrary
compiler flags. same here — import
, , link directive.
edit:
on ubuntu can install precompiled sqlite
using next command:
sudo apt-get install libsqlite3-dev
also, see http://prowiki.org/wiki4d/wiki.cgi?databasebindings#sqlite other sqlite
binding variants.
sqlite d
Comments
Post a Comment