diff --git a/pyopencl/c_wrapper/wrap_cl_core.h b/pyopencl/c_wrapper/wrap_cl_core.h
index 5427fa3c3aa10cbff0491bf48f014bebff899c3a..efd836fddfe24872792453c79e93754d6107ae17 100644
--- a/pyopencl/c_wrapper/wrap_cl_core.h
+++ b/pyopencl/c_wrapper/wrap_cl_core.h
@@ -88,7 +88,8 @@ error *create_program_with_source(clobj_t *program, clobj_t context,
                                   const char *src);
 error *create_program_with_binary(clobj_t *program, clobj_t context,
                                   cl_uint num_devices, const clobj_t *devices,
-                                  char **binaries, size_t *binary_sizes);
+                                  const unsigned char **binaries,
+                                  size_t *binary_sizes);
 error *program__build(clobj_t program, const char *options,
                       cl_uint num_devices, const clobj_t *devices);
 error *program__kind(clobj_t program, int *kind);
diff --git a/pyopencl/cffi_cl.py b/pyopencl/cffi_cl.py
index e4bd87b7207040138c6dc99c6481c2922e29ffc4..9138b46e006859ca13e3b9b8cff464ce92cece07 100644
--- a/pyopencl/cffi_cl.py
+++ b/pyopencl/cffi_cl.py
@@ -749,14 +749,14 @@ class _Program(_Common):
                                "device and binary counts don't match")
 
         ptr_program = _ffi.new('clobj_t*')
-        ptr_devices = _ffi.new('clobj_t[]', [device.ptr for device in devices])
-        ptr_binaries = [_ffi.new('char[]', binary) for binary in binaries]
-        binary_sizes = _ffi.new('size_t[]', map(len, binaries))
+        ptr_devices = [device.ptr for device in devices]
+        ptr_binaries = [_ffi.new('unsigned char[]', binary)
+                        for binary in binaries]
+        binary_sizes = [len(b) for b in binaries]
 
-        # TODO correct type for binaries
         _handle_error(_lib.create_program_with_binary(
             ptr_program, context.ptr, len(ptr_devices), ptr_devices,
-            _ffi.new('char*[]', ptr_binaries), binary_sizes))
+            ptr_binaries, binary_sizes))
 
         self.ptr = ptr_program[0]
 
diff --git a/src/c_wrapper/program.cpp b/src/c_wrapper/program.cpp
index 2aa6efe71347ba316bf09bb1473ad0d3a2f1efb1..2500fd63ddaa1bef189b1e90ec4fe483edaf3bf8 100644
--- a/src/c_wrapper/program.cpp
+++ b/src/c_wrapper/program.cpp
@@ -113,7 +113,7 @@ create_program_with_source(clobj_t *prog, clobj_t _ctx, const char *src)
 error*
 create_program_with_binary(clobj_t *prog, clobj_t _ctx,
                            cl_uint num_devices, const clobj_t *devices,
-                           char **binaries, size_t *binary_sizes)
+                           const unsigned char **binaries, size_t *binary_sizes)
 {
     auto ctx = static_cast<context*>(_ctx);
     const auto devs = buf_from_class<device>(devices, num_devices);
@@ -121,8 +121,7 @@ create_program_with_binary(clobj_t *prog, clobj_t _ctx,
     return c_handle_error([&] {
             cl_program result = pyopencl_call_guarded(
                 clCreateProgramWithBinary, ctx, devs,
-                binary_sizes, reinterpret_cast<const unsigned char**>(
-                    const_cast<const char**>(binaries)), binary_statuses.get());
+                binary_sizes, binaries, binary_statuses.get());
             // for (cl_uint i = 0; i < num_devices; ++i)
             //   std::cout << i << ":" << binary_statuses[i] << std::endl;
             *prog = new_program(result, KND_BINARY);