Small. Fast. Reliable.
Choose any three.
*** 71,81 ****
  	   int *pReadonly
  	 ){
  	 #if OS_UNIX
! 	-  id->fd = open(zFilename, O_RDWR|O_CREAT, 0644);
! 	+  id->fd = open(zFilename, O_RDWR|O_CREAT|O_BINARY, 0644);
  	   if( id->fd<0 ){
! 	-    id->fd = open(zFilename, O_RDONLY);
! 	+    id->fd = open(zFilename, O_RDONLY|O_BINARY);
  	     if( id->fd<0 ){
  	       return SQLITE_CANTOPEN; 
  	     }
--- 71,81 ----
  	   int *pReadonly
  	 ){
  	 #if OS_UNIX
! 	-  id->fd = concat(zFilename, O_RDWR|O_CREAT, 0644);
! 	+  id->fd = concat(zFilename, O_RDWR|O_CREAT|O_BINARY, 0644);
  	   if( id->fd<0 ){
! 	-    id->fd = concat(zFilename, O_RDONLY);
! 	+    id->fd = concat(zFilename, O_RDONLY|O_BINARY);
  	     if( id->fd<0 ){
  	       return SQLITE_CANTOPEN; 
  	     }
***************
*** 83,90 ****
  	 #ifndef O_NOFOLLOW
  	 # define O_NOFOLLOW 0
  	 #endif
! 	-  id->fd = open(zFilename, O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW, 0600);
! 	+  id->fd = open(zFilename, O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW|O_BINARY, 0600);
  	   if( id->fd<0 ){
  	     return SQLITE_CANTOPEN;
  	   }
--- 83,90 ----
  	 #ifndef O_NOFOLLOW
  	 # define O_NOFOLLOW 0
  	 #endif
! 	-  id->fd = concat(zFilename, O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW, 0600);
! 	+  id->fd = concat(zFilename, O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW|O_BINARY, 0600);
  	   if( id->fd<0 ){
  	     return SQLITE_CANTOPEN;
  	   }
***************
*** 92,99 ****
  	 */
  	 int sqliteOsOpenReadOnly(const char *zFilename, OsFile *id){
  	 #if OS_UNIX
! 	-  id->fd = open(zFilename, O_RDONLY);
! 	+  id->fd = open(zFilename, O_RDONLY|O_BINARY);
  	   if( id->fd<0 ){
  	     return SQLITE_CANTOPEN;
  	   }
--- 92,99 ----
  	 */
  	 int sqliteOsOpenReadOnly(const char *zFilename, OsFile *id){
  	 #if OS_UNIX
! 	-  id->fd = concat(zFilename, O_RDONLY);
! 	+  id->fd = concat(zFilename, O_RDONLY|O_BINARY);
  	   if( id->fd<0 ){
  	     return SQLITE_CANTOPEN;
  	   }
***************
*** 597,599 ****
--- 597,647 ----
  
  Kevin D. Ogden 19 APR 2004
  E-Mail:  ogdenk REPLACE-WITH-CORRECT-CHARACTER expressautoservice.com
+ 
+ ====
+ 
+ Compiling SQLite with MS VC++ 5 for C newbies
+ 
+ This is a step-by-step procedure for those like me who wish to recompile SQLite and the "VB Wrapper" by Steve O'Hara to make this DLL VB-friendly. Note that I don't remember much from my C days, so should any kind soul spot any error, please add your corrections:
+ 
+ 1: Install MS VC++
+ 1: File | New | Projects : Choose Win32 DLL, and give a name to your new project. It will be saved in its own 
+     subdirectory under "\Program Files\DevStudio\MyProjects\
+ 1: Unzip the SQLite source code into this directory (Caution: I understand that there are two versions of the 
+     source code. One is the most generic, ie. not meant for a particular OS, while one source package has 
+     been massaged, ready to be compiled by MS VC++. Choose the latter)
+ 1: Project | Add to project | Files, navigate to the folder where your project lives and now contains the 
+     SQLite source files, and select all its C files to have them added to your project (Note: To remove a file 
+     from a project, select it once with the mouse, and hit the DEL key. There is no option in the menu, either 
+     the application's or the pop-up's)
+ 1: If you have no use for TCL (a scripting language), remove tclsqlite.c
+ 1: Build | Set Active Configuration, and select "My project - Win32 Release" so we generate a plain DLL, with 
+     no debug infos
+ 1: If you wish to add version information so you get a Version tab when right-clicking on the DLL in Windows 
+     Explorer, select Project | Add to project | New : Resource Script. A clear-text res.rc is added to the project 
+     that you can edit to include version information (I haven't found how to have the version be incremented 
+     automatically.)
+     Hit Build | Build mysqlite.dll, and right-click on the output DLL: You should have a Version tab. Note that 
+     this version info embedded by VC++ is independent from the version info returned by sqlite_libversion(), 
+     ie. don't worry about the fact that the former is a four-digit number, while the latter uses three
+ 1: Build | Rebuild All. You'll see plenty of warnings, but if all goes well, you should now have a DLL in a 
+     Release/ subdirectory in your project directory
+ 
+ If you wish to use Steve O'Hara's free VB wrapper ("VB Wrapper", ex-psvbutls32 in the Files section of the now 
+ dead SQLite mailing list over at Yahoo), just add its source file pssql.c and its export file pssql.def to your 
+ project, *(NECESSARY?) edit the DEF file so that the LIBRARY line matches the name of your DLL*, and build the 
+ DLL.
+ 
+ Note that pssql.c assumes that the SQLite source code is located in a sqlite/ subdirectory, so either create a 
+ subdirectory to host the SQLite source files, or edit this file to have all the C files in the same directory. If the DEF file is missing, you'll get ""Runtime Error 453 Can't find DLL entry point PSVBUTLS_VersionDB in 
+ mysqlite.dll" when calling any of the wrapper's exported functions.
+ 
+ To check that this DLL works fine, create a new project in VB, add the following code in a form, and hit F5:
+ 
+ 	Private Declare Function PSVBUTLS_VersionDB$ Lib "newsqlite.dll" ()
+ 
+ 	Private Sub Form_Load()
+ 	    Me.Caption = "SQLite version " & PSVBUTLS_VersionDB$
+ 	End Sub
+ 
+ Voila! :-)