In case you have missed this important post by Tim Heuer, SQLIte is now supported on WinRT. As he mentioned, the support for x86 and x64 is there. We still need to wait what ARM story is going to be, but personally I see no reason why this would not work at all.
Once I got the whole process working on my box, I wanted to write done some details to make it easier for me to remember what I did. As Tim mentioned, you must compile x86, x64 and ARM versions of SQLite. How do you do that? The steps Tim describes is exactly the one you need to follow. To compile all those versions, you just need to open corresponding command prompt that ships with Visual Studio. Just switch to metro side, the time “command” to see the list of prompts. Essentially Windows 8 will filter out the list of programs and shortcuts that contain "command” in them.
- Developer Command Prompt can be used to build x86 version,
- x84 Cross Tools Command Command Prompt or x64 Native Tools Command Prompt can be used to build x64 version
- ARM Cross Tools Command Prompt can be used to build ARM version of SQLite.
You will need to delete the results of previous compilation before launching the next one or you will get some strange errors. Just switch to SQLite folder and delete all files that have SQLIte3 in the name that have been modified as of the time you ran nmake command.
You do need to also change the target platform of your project before building it. In my case for testing I am using x64 platform.
VS makes it quite easy for you to setup your solution to be maintainable. Just setup different configurations, one for each target platform.
You can also use pre build events to copy correct sqlite3.dll into the source code folder.
Once you do that, you can create a batch file to build 3 versions of your application using MSBuild or devenv.exe
I am quite excited about SQLIte being supported on WinRT. SQLite team did a great job posting their engine over to WinRT. I think every platform needs some sort of structured storage solution that goes beyond XML files, and SQLite will play this role for Metro Style Applications on Windows 8.
I am planning post full solution after my presentation at Code Stock in 3 weeks. If you need a working example, before that, just let me know.
I’m trying to use SQLite in an app that is being ported from Windows Phone. The WP app uses a lot of LINQ, e.g. EntityRef, EntitySet. These don’t seem to be supported in WinRT so I’m a bit stuck on how to proceed with SQLite :-(.
The procedure suggested by TH is a huge overkill. Below are the 2 lines you need to build sqlite.dll from a command prompt (I stripped folders and some trivial switches such as /nologo):
cl -c /Gm- /W3 /WX- /Gy /EHsc /GS /GL /O2 /Oi /Oy /DWIN32 /DNDEBUG /D_WINDOWS /D_USRDLL /D_WINDLL /D_UNICODE /DUNICODE /MD /DSQLITE_OS_WINRT=1 sqlite3.c dllmain.cpp
link /DLL /OPT:REF /OPT:ICF /LTCG /SUBSYSTEM:WINDOWS /MACHINE:X86 /DEF:SQLiteWinDll.def /IMPLIB:SQLite3.lib sqlite3.obj dllmain.obj /OUT:SQLite3.dll
– sqlite3.c is from SQLite amalgamation release v3.7.13+
– def file is a part of standard SQlite win32 binary release (published along with the dll file)
Above commands are for x86 platform. You need to adjust /MACHINE linker switch for other platforms. For ARM platform use also /APPCONTAINER linker switch.