title: Statically linking SQLite with DMD (Windows x86)
body: <p>I've tried to statically link with sqlite3 without success. I'm using the 'etc.c.sqlite3' header, and the sqlite3 amalgamation. To create the .lib file I've tried both VC++ and MinGW-gcc, both of these compile the source file successfully - but they both generate COFF object format (optlink, which DMD uses, works with OMF). After reading tons of posts on 'digitalmars.D', I've tried several different solutions.</p>
  
  <p><a href="http://www.agner.org/optimize/#objconv" rel="noreferrer">objconv:</a></p>
  
  <ul>
  <li><p>tried to convert lib file created with GCC, resulted in undefined symbols such as __divdi3 and __muldi3, wasn't able to solve this.</p></li>
  <li><p>Also tried this to convert the sqlite3.o file to *.obj, and then use digitalmars 'lib.exe' - unsuccessful as well</p></li>
  <li><p>Attempting objconv on a VC++ generated lib fails because: "SQLite.lib is an import library"</p></li>
  </ul>
  
  <p><a href="http://www.digitalmars.com/ctg/implib.html" rel="noreferrer">implib:</a></p>
  
  <ul>
  <li>If I download the precompiled DLL from sqlite.org and use implib, it generates a lib file, but the name mangling does not seem to match, because even though I link with the static library, I still receive the same sqlite errors (e.g undefined symbol <code>_sqlite3_open</code>, <code>_sqlite3_errmsg</code>, <code>_sqlite3_close</code>...</li>
  </ul>
  
  <p><a href="http://www.digitalmars.com/ctg/coffimplib.html" rel="noreferrer">coffimplib:</a></p>
  
  <ul>
  <li><p>If I use coffimplib on the VC++ created library file, the program generates a nearly empty file (~2KB) which only contains garbage (i.e no symbols at all and mostly just 'null' values).</p></li>
  <li><p>If I do the same with the GCC created library, coffimplib complains about "not an import library" and no converted library file is generated.</p></li>
  </ul>
  
  <p>If I use DMC to compile the sqlite3 amalgamation, the compilation fails complaining about <em>tons</em> of errors. So here I am, stuck in nowhere, does anyone have any ideas or tips what might solve this?</p>
  
  <p>NOTE: I do not want to use a DLL, but statically link with sqlite (for executable size concerns). </p>