Bruce Butterfield bruce@open-tek.com writes:
// in include file: struct _TidyBuffer; typedef struct _TidyBuffer TidyBuffer; typedef void* TidyDoc;
// example caller: TidyBuffer output = {0}; TidyDoc tdoc = tidyCreate(); ... tidySaveBuffer(tdoc, &output) ...
This C code (you don't show the declarations for tidyCreate() and tidySaveBuffer() though) translates to something like this:
(use-package :cffi)
(defcstruct tidy-buffer ...)
(defctype tidy-doc :pointer) ; if you prefer...
(defcfun ("tidyCreate" tidy-create) :tidy-doc)
(defcfun ("tidySaveBuffer" tidy-save-buffer) :void ;;? (doc tidy-doc) (out tidy-buffer))
;; caller (with-foreign-object (output tidy-buffer) (let ((tdoc (tidy-create))) (tidy-save-buffer tdoc output)))
HTH