Hello,
I'm using SBCL version 1.2.4, CFFI version 0.14.0, and libffi version 3.1. I've been trying to pass a struct by value using CFFI and libffi. I'm a newbie to both CFFI and Lisp so I had to piece this together from the manual as well as some of the unit tests that come with CFFI. I'm getting an error that I just can't get past:
The value READ-FUNC is not of type SB-SYS:SYSTEM-AREA-POINTER
The library I'm trying to wrap is libvorbisfile, which decodes Ogg Vorbis files. It has an init function called ov_open_callbacks:
int ov_open_callbacks(void *datasource, OggVorbis_File *vf, const char *initial, long ibytes, ov_callbacks callbacks);
The part it's choking on is the last argument, a struct, passed by value, of callback functions:
typedef struct {
size_t (*read_func) (void *ptr, size_t size, size_t nmemb, void *datasource);
int (*seek_func) (void *datasource, ogg_int64_t offset, int whence);
int (*close_func) (void *datasource);
long (*tell_func) (void *datasource);
} ov_callbacks;
The library is designed to use one of a few static structs defined in a header file. Since it's defined in the header file and not in libvorbisfile.so, I must create CFFI translation code. There were a lot of other structs I had to wrap with CFFI as well. Here is my code:
http://pastie.org/10122885
Does anyone have any clues about what I'm doing wrong here?
(Regarding my previous email about getting CFFI working on Debian jessie, it turns out the Debian version of cl-alexandria is missing a file and cl-cffi is buggy, so I just added the missing file and installed the CFFI source by hand. Thanks for the response, Fau.)
Marshall