the function pasted by kevinfish on Fri Mar 3 09:22:30 2017

(define
  (cpuid name code . types)
  (apply
   (cut define <> <> . <>)     ; this defines 
         (#~~ (#~QueryInterface <> )  <...>))
         name code types))

(cpuid  ci #x21452459  return: pointer:)

Example macro pasted by sjamaan on Fri Mar 3 09:25:39 2017

(define-syntax cpuid
  (syntax-rules ()
    ((_ ?name ?code ?type0 ...)
     (define (?name ?code ?type0 ...)
       (#~~ (#~QueryInterface ?name) ?type0 ...)))))

(cpuid  ci #x21452459  return: pointer:)

types are passed to the FFI but not to the defined proceure pasted by sjamaan on Fri Mar 3 10:15:24 2017

(define-syntax cpuid
  (syntax-rules ()
    ((_ ?name ?code ?type0 ...)
     (define (?name ?code)
       (#~~ (#~QueryInterface ?name) ?type0 ...)))))

(cpuid  ci #x21452459  return: pointer:)

Moving code to call-time instead of define-time added by sjamaan on Fri Mar 3 10:31:08 2017

(define-syntax cpuid
  (syntax-rules ()
    ((_ ?name ?type0 ...)
     (define (?name code)
       (#~~ (#~QueryInterface code) ?type0 ...)))))

(cpuid  ci return: pointer:)

;; Usage:
(ci #x21452459)