[Larceny-users] sqlite3 FFI

Felix Klock felixluser at pnkfx.org
Thu May 22 02:12:42 EDT 2008


On May 22, 2008, at 1:57 AM, Felix Klock wrote:

> (You do still need to go
> through the process of extracting the relevant structure information
> from the relevant header files; sorry about that.)

Actually I should not have said "sorry" above, but instead crowed  
happily about this as a *feature* of foreign-ctools.

The key word here is "relevant": you can *ignore* irrelevant fields  
(such as extensions to the struct definition that are specific to a  
particular host platform), and you do not have to transcribe any part  
of the header file that is not related to the struct fields that you  
happen to care about accessing.

That is, the beauty of foreign-ctools is that you don't need to pull  
all of the structure information out.  The library does not need to  
know about all of the fields of your structure (unlike the C compiler,  
which does need that information to determine field offsets and  
typcially grabs it from an included header file).

Instead, you just need to know the struct type's name and the names of  
the fields you want to access in that struct.

-Felix





More information about the Larceny-users mailing list