[Larceny-users] sqlite3 FFI

Peter Keller psilord at cs.wisc.edu
Fri May 30 22:56:04 EDT 2008


Hello,

I have another question, if I may ask:

in my sqlite3 library, I have this:

    (define-c-info (include<> "sqlite3.h")
      (const SQLITE_INTEGER     int   "SQLITE_INTEGER")
      (const SQLITE_FLOAT       int   "SQLITE_FLOAT")
      (const SQLITE_BLOB        int   "SQLITE_BLOB")
      (const SQLITE_TEXT        int   "SQLITE_TEXT"))

and then later something like this:

    (define sqlite3-column
      (lambda (stmt colid)
        (case (sqlite3-column-type stmt colid)
          ((SQLITE_INTEGER)
            (sqlite3-column-int stmt colid))
          ((SQLITE_TEXT)
            (sqlite3-column-text stmt colid))
          (else
            'oops)))) ;; <- obviously this is still test code!

It looks like the SQLITE_INTEGER and SQLITE_TEXT in the sqlite3-column
function are not available to me (as the code simply doesn't work and
I get 'oops all the time) while in the library codes. If I replace them
with the real constants 1 and 3 respectively, or use SQLITE_INTEGER and
SQLITE_TEXT in a piece of code which imports the sqlite3 library, then
sqlite3-column behaves properly.

Any ideas?

Thank you.

-pete





More information about the Larceny-users mailing list