I received a report of an error when a function is called from lispbuilder-sdl-mixer on the Mac in both SBCL and CCL.
I think the problem is that CFFI does not allow memory to be freed if that memory has not also been allocated using CFFI.
In my code below, a new 'sdl-version' struct is returned by (sdl-mixer-cffi::linked-version). The error seems to occur when I try to free the struct at the end of the function using foreign-free.
(defun linked-version () "Returns the version number of the SDL_mixer dynamic library in use as #(`MAJOR` `MINOR` `PATCH`)." (let ((sdl-version (sdl-mixer-cffi::linked-version)) (version nil)) (cffi:with-foreign-slots ((sdl-cffi::major sdl-cffi::minor sdl-cffi::patch) sdl-version sdl-cffi::sdl-version) (setf version (vector sdl-cffi::major sdl-cffi::minor sdl-cffi::patch))) (cffi:foreign-free sdl-version) version))
Can I get around this somehow?
-Luke