             [clojure.core.async :refer [go >!]])
   (:import [org.jocl CL cl_platform_id cl_context_properties cl_device_id
             cl_context cl_command_queue cl_mem cl_program cl_kernel cl_sampler
-            cl_event
-            Sizeof Pointer CreateContextFunction EventCallbackFunction]
+            cl_event Sizeof Pointer CreateContextFunction EventCallbackFunction
+            BuildProgramFunction]
            [java.nio ByteBuffer ByteOrder]))
 
 (def ^:dynamic *platform*)

    (with-check err (aget res 0))))

(defn kernels
  ([program ^String name]
   (let [err (int-array 1)
         res (CL/clCreateKernel program name err)]
     (with-check-arr err res)))

   (set-event-callback channel e CL/CL_COMPLETE nil)))

;; ============= Program ==========================================

(defrecord BuildCallbackInfo [program data])

(deftype BuildCallback [ch]
  BuildProgramFunction
  (function [this program data]
    (go (>! ch (->BuildCallbackInfo program data)))))

(defn program-with-source
  ([context source]
