My final solution:   so what I did was forget the dll and statically linked 
sqlite into my test program hw.c.   Here is the source and in the comments at 
the top is the build/run session from the command line session.  - Jon

//bof
  #include <stdio.h>
  #include "sqlite3.h"

/****************************************************************\


C:\sqlite>hw.exe
hello Kevin!
Usage: hw.exe DATABASE SQL-STATEMENT


C:\sqlite>sqlite3.exe
SQLite version 3.8.5 2014-06-04 14:06:34
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> create table tbl1(one varchar(10), two smallint);
sqlite> insert into tbl1 values('hello!',10);
sqlite> insert into tbl1 values('goodbye',20);
sqlite> select * from tbl1;
hello!|10
goodbye|20
sqlite> .seperator ", "
Error: unknown command or invalid arguments:  "seperator". Enter ".help" for 
help
sqlite> .separator ", "
sqlite> select * from tbl1;
hello!, 10
goodbye, 20
sqlite> .save tbl1_test
sqlite> .quit

C:\sqlite>dir
 Volume in drive C has no label.
 Volume Serial Number is F0C1-CFFE

 Directory of C:\sqlite

140711  09:49 AM    <DIR>          .
140711  09:49 AM    <DIR>          ..
140710  05:39 PM            91,961 a.exe
140711  07:55 AM             1,179 hw.c
140711  07:55 AM           821,663 hw.exe
140710  05:41 PM            67,070 hw_cgw.exe
140710  05:41 PM           163,578 libsqlite3.a
140710  02:38 PM                56 session.txt
140604  09:21 PM           124,070 shell.c
140710  05:45 PM    <DIR>          sqlite-amalgamation-3080500
140710  01:40 PM    <DIR>          sqlite-doc-3080500
140604  09:21 PM         5,239,373 sqlite3.c
140630  12:19 PM             4,721 sqlite3.def
140630  12:19 PM         1,238,016 sqlite3.dll
140604  09:22 PM           547,840 sqlite3.exe
140604  09:21 PM           360,297 sqlite3.h
140604  09:21 PM            26,110 sqlite3ext.h
140710  02:40 PM               682 t.lis
140711  09:49 AM             2,048 tbl1_test
140710  02:42 PM               885 test.c
140710  05:08 PM                 0 test.db
140710  04:16 PM               904 test02.c
140710  04:24 PM             1,051 test02.obj
140710  04:29 PM               883 test_a.c
140710  04:41 PM            67,061 test_a.exe
              21 File(s)      8,759,448 bytes
               4 Dir(s)  27,407,122,432 bytes free

C:\sqlite>ren tbl1_test tbl1_test.db

C:\sqlite>sqlite3.exe tbl1_test.db
SQLite version 3.8.5 2014-06-04 14:06:34
Enter ".help" for usage hints.
sqlite> select * from tbl1
   ...> ;
hello!|10
goodbye|20
sqlite> .quit

C:\sqlite>hw.exe
hello Kevin!
Usage: hw.exe DATABASE SQL-STATEMENT


C:\sqlite>hw.exe "select * from tbl1;"
hello Kevin!
Usage: hw.exe DATABASE SQL-STATEMENT

rem   code updated and re-compiled ...

C:\sqlite>
C:\sqlite> rem ok lets forget the DLL and statically link the file
C:\sqlite>gcc hw.c sqlite3.c -ohw.exe

C:\sqlite>hw.exe tbl1_test.db "select * from tbl1;"
hello Kevin!
hello kevin2!
hello kevin3!
one = hello!
two = 10

one = goodbye
two = 20


C:\sqlite>

\****************************************************************/
    static int callback(void *NotUsed, int argc, char **argv, char **azColName){
    int i;
    for(i=0; i<argc; i++){
      printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
    }
    printf("\n");
    return 0;
  }
  
  
  int main(int argc, char **argv){
     sqlite3 *db;
    char *zErrMsg = 0;
    int rc; 
   printf("hello Kevin!\n"); 
  
    if( argc!=3 ){
      fprintf(stderr, "Usage: %s DATABASE SQL-STATEMENT\n", argv[0]);
      return(1);
    }
     printf("hello kevin2!\n"); 
    rc = sqlite3_open(argv[1], &db);
     printf("hello kevin3!\n"); 
    if( rc ){
       fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db));
       sqlite3_close(db);
      return(1);
    }

    rc = sqlite3_exec(db, argv[2], callback, 0, &zErrMsg);
    if( rc!=SQLITE_OK ){
      fprintf(stderr, "SQL error: %s\n", zErrMsg);
      sqlite3_free(zErrMsg);
    }
    sqlite3_close(db);

   return 0; 
  } //main
//eof


On Friday, July 11, 2014 9:15 AM, Jonathan Leslie <jlesli...@yahoo.com> wrote:
 

>
>
>Jan, thank you for your great advise.   - Jon
>
>
>
>
>
>On Friday, July 11, 2014 8:50 AM, Jan Nijtmans <jan.nijtm...@gmail.com> wrote:
> 
>
>>
>>
>>2014-07-11 13:45 GMT+02:00 Jonathan Leslie <jlesli...@yahoo.com>:
>>> Jan,
>>>
>>> Yes, thank you I see.  the download of the x64 mingw is failing behind my 
>>> proxy here.  the
>>> installer wants to phone home for some repository tool.  is there anyway 
>>> around that?
>>
>>Yes, there is a way around that. Yesterday, you wrote:
>>2014-07-10 22:36 GMT+02:00 Jonathan Leslie <jlesli...@yahoo.com>:
>>> Update:  ok this is working in cygwin, so maybe my GCC compiler on the 
>>> windows side cmd.exe side is all higgly piggly?
>>
>>If you have Cygwin already, just install Cygwin's
>>"mingw64-x86_64-gcc-core" package.
>>In stead of "gcc" you
 need to use "x86_64-w64-mingw32-gcc" (and the
>>same for various
>>other tools like "dlltool" and "ld"). This way, you create a fully
>>functional 64-bit environment
>>which works with the 64-bit SQLite dll (and runs outside of Cygwin as well).
>>
>>>           OR....
>>>
>>> can I use the 32-bit sqlite?
>>
>>That's another possibility.
>>
>>
>>Regards,
>>         Jan Nijtmans
>>_______________________________________________
>>sqlite-users mailing list
>>sqlite-users@sqlite.org
>>http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
>>
>>
>
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to