I've gotten stuck developing an FFI binding to libspotify. One of the functions I'm trying to bind to, sp_session_create, uses an in-out parameter. Luckily I have an example of its usage here (in the definition of main):
It looks to me like they've allocated a pointer to an sp_session and then passed a pointer to that to sp_session_create.
My best attempt tries to do the same but comes across a missing Storable instance of the equivalent of the sp_session data structure. Because the C definition of this struct is not exposed in the header files I can't work out how to do it myself. The alternative of passing in an empty pointer with the assumption that the procedure will allocate memory for us simply segfaults.
I've put a source distribution up here (hit "raw" to download):
Also if you like libspotify can be downloaded and automatically installed (for *nix users I think at least) from here:
Please, can anyone help?