[cffi-devel] Double pointers
Andy Chambers
achambers.home at googlemail.com
Mon Sep 1 14:47:53 UTC 2008
Hi,
Please excuse the poor use of terminology in the following message.
I'm stabbing around in the dark when
it comes to C. I'll need to get a textbook someday and learn it properly.
How do you pass a "double pointer" to a C function. For example,
here's the signature for sqlite's open
int sqlite3_open(
const char *filename, /* Database filename (UTF-8) */
sqlite3 **ppDb /* OUT: SQLite db handle */
);
I'd like to define a cffi function that lets me call this and keep a
handle on the ppDb object that gets
created as a result.
I've tried various combinations of (foreign-alloc ..) and
(null-pointer) but always got a memory exception
when trying to use the handle in another function.
The sqlite stuff has lots of these functions that modify input
parameters and return error codes
rather than returning some opaque object like the CFFI example does.
Cheers,
Andy
More information about the cffi-devel
mailing list