discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GNUstep and SQLite3


From: Ivan Vučica
Subject: Re: GNUstep and SQLite3
Date: Tue, 05 Jun 2018 17:52:12 +0100
User-agent: K-9 Mail for Android

This is on a Mac, judging on the hostname and /Users/ being parent of the homedir. Therefore I will guess that GNUstep is built as a universal binary and the test program is being built as a universal ("fat") binary.

At the very least, force the test program to not be built as a universal binary.

Better is to build sqlite3 as universal.

Best is to use Cocoa if you have it available – in my personal opinion. This is best unless you depend on gnustep-make or other GNUstep specific features. And use GNUstep on a platform where it won't conflict with Cocoa.

On June 5, 2018 2:48:21 PM GMT+01:00, "Andreas Höschler" <ahoesch@smartsoft.de> wrote:
Hi all,

I would like to access a SQLite database with a minimalistic Objective-C (GNUstep) program. I installed SQLite like so

tar xvf sqlite-autoconf-3230100.tar
cd sqlite-autoconf-3230100
./configure
make
make install

and got

/usr/local/bin/sqlite3

/usr/include/php/ext/sqlite3/libsqlite
/usr/lib/libsqlite3.0.dylib
/usr/lib/libsqlite3.dylib
/usr/local/lib/libsqlite3.0.dylib
/usr/local/lib/libsqlite3.a
/usr/local/lib/libsqlite3.dylib
/usr/local/lib/libsqlite3.la

I have now written the following Objective-C test program but don't get it linked! :-(

***************************************************************************************************
#import <Foundation/Foundation.h>
#include <sqlite3.h>

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, const char *argv[])
  {
   NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
   
   // insert your code here
     {
      sqlite3 *db;
      int rc;
      
      rc = sqlite3_open("/Users/ahoesch/Development/SQLite/sqlite-autoconf-3230100/ex1", &db);
      if (rc) 
        {
         NSLog(@"Can't open database: %s\n", sqlite3_errmsg(db));
         sqlite3_close(db);
         return(1);
        }
      
      char *zErrMsg = 0;
      rc = sqlite3_exec(db, "select * from PERSON;", callback, 0, &zErrMsg);
        if (rc != SQLITE_OK)
          {
           fprintf(stderr, "SQL error: %s\n", zErrMsg);
           sqlite3_free(zErrMsg);           
          }
        sqlite3_close(db);
     }
   
   [pool release];
   exit(0);       // insure the process exit status is 0
   return 0;      // ...and make main fit the ANSI spec.
}
***************************************************************************************************
With the GNumakefile


--
Sent from my Android device with K-9 Mail. Please excuse my brevity.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]