[Larceny-users] sqlite3 FFI
Peter Keller
psilord at cs.wisc.edu
Sat May 24 18:02:45 EDT 2008
On Sat, May 24, 2008 at 01:06:23AM -0500, Peter Keller wrote:
> (define sqlite3-close
> (let ((_sqlite3_close
> (foreign-procedure "sqlite3_close" '(boxed) 'int)))
> (lambda (db)
> (_sqlite3_close db))))
If I rewrite this call to:
(define sqlite3-close
(let ((_sqlite3_close
(foreign-procedure "sqlite3_close" '(int) 'int)))
(lambda (db)
(_sqlite3_close (%get-pointer db 0)))))
Then the code starts working. I'm not entirely sure this is correct since
the prototype for sqlite3_close expects a pointer, not an int (but due to
the 32-bit platform I'm on at the moment, this will work).
It was my intention that the bytevector passed into sqlite3_open gets
the pointer written into it and that the sqlite3_close uses the pointer
in the bytevector.
Given this method I'm using, I have the basic sqlite3 api (open, close,
prepare_v2, finalize, step, column*) working. I'll do some more testing and
try and get it packaged into an r6rs library.
Thank you.
-pete
More information about the Larceny-users
mailing list