summaryrefslogtreecommitdiff
path: root/alien.lisp
blob: 5e870ec178ab220540901e08482220b2f6712c83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
(in-package #:alien)

(defmacro call (fname rtype &rest types-n-values)
  (let ((tlist (queue:new))
        (vlist (queue:new)))
    (do () ((null types-n-values) nil)
      (queue:add tlist (pop types-n-values))
      (queue:add vlist (pop types-n-values)))
    `(alien-funcall (extern-alien ,fname
                                  (sb-alien:function ,rtype
                                            ,@(queue:to-list tlist)))
                    ,@(queue:to-list vlist))))