title: What is the easiest way to use Sqlite in D program on Ubuntu?
body: <p>I suppose using <code>phobos.etc.c.sqlite3</code> binding. Compiling sqlite3.c using a C compiler to make a .o file and then link it with my program.</p>
  
  <p>Which C compiler should I use, and what compiler flags?
  Is it possible link the sqlite3.o with DMD in one step, without calling linker separately?</p>
  
  <p>Or is there some other even easier way?</p>
  
  <p><strong>Answer: How to get Sqlite going with D on 64bit Ubuntu</strong></p>
  
  <ol>
  <li><p>install sqlite dev <code>sudo apt-get install libsqlite3-dev</code></p></li>
  <li><p>compile <code>dmd test.d -L-ldl -L/usr/lib/x86_64-linux-gnu/libsqlite3.a</code></p></li>
  </ol>
  
  <p>test.d</p>
  
  <pre><code>import std.stdio, std.string, etc.c.sqlite3;
  
  void main () {
      sqlite3* db;
      auto ret = sqlite3_open (toStringz("mydb.s3db"), &amp;db);
      writeln (ret);
  }
  </code></pre>
  
  <p>-ldl switch was needed because of <a href="https://stackoverflow.com/questions/3455202/sqlite3-linking-problems">sqlite3 linking problems</a></p>