Looks like you're sending it a list of symbols 'read-func etc. '(read-func seek-func (null-pointer) tell-func) is a list of two symbols, a list, then another symbol. It needs to be a plist (property list) with alternating slot names and values (list 'read-func read-func 'seek-func seek-func...) (At the moment I can't remember if the slot names are in the keyword package or not, so you might need :read-func instead of 'read-func etc.)
Liam On Thu, Apr 30, 2015 at 7:28 PM, Marshall Mason <marshallmas...@gmail.com> wrote: > 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