Open eschaton opened 7 years ago
The issue is definitely with the definition of source-type
using cenum
, which doesn’t appear to handle pointer values. These values actually should be looked up at run time, just like DISPATCH_QUEUE_SERIAL
maps to +serial-queue-address+
which maps to *serial-queue*
which maps to :serial
.
It might make sense to have CFFI-level support for the "enum-like" pattern since dispatch—and many other libraries & frameworks—use it in several places, something like:
(cenumlike (queue-concurrency :base-type :pointer)
((:serial "DISPATCH_QUEUE_SERIAL"))
((:concurrent "DISPATCH_QUEUE_CONCURRENT")))
Then the import definition of dispatch_queue_create
could be something like
(defcfun "dispatch_queue_create" queue (label :string) (attr (or queue-attribute queue-concurrency))
and the make-queue
wrapper could avoid the ecase
.
I filed https://bugs.launchpad.net/cffi/+bug/1660084 against CFFI to cover supporting this kind of "enum-like global."
I put a symlink to
cl-dispatch
in my Quicklisplocal-projects
directory, launched the CCL IDE (Clozure CL64.app, built from CCL trunk r16809, the latest current), and ran(ql:quickload :dispatch)
in the Listener.That resulted in the following error:
I suspect that
grovel.lisp
may need to be adjusted for the very different dispatch type declarations present in a more modern operating system than the one for which this was originally written; I’m using the macOS Sierra 10.12 SDK.It might also be possible to greatly simplify some of the definitions, and redesign
grovel.lisp
around the shape of the API definition rather than the declarations in the headers.