From afd8b077b5c17ddb7fc4e73e7feb4fc2b3abfbd8 Mon Sep 17 00:00:00 2001
From: Yichao Yu <yyc1992@gmail.com>
Date: Thu, 19 Jun 2014 00:54:27 +0800
Subject: [PATCH] print_buf

---
 src/c_wrapper/utils.h     | 13 +++++++++++++
 src/c_wrapper/wrap_cl.cpp | 16 ++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/src/c_wrapper/utils.h b/src/c_wrapper/utils.h
index 40eacbcc..c2f01c8e 100644
--- a/src/c_wrapper/utils.h
+++ b/src/c_wrapper/utils.h
@@ -90,6 +90,19 @@ print_buf(std::ostream &stm, const T *p, size_t len,
         }
     }
 }
+extern template void print_buf<char>(std::ostream&, const char*, size_t,
+                                     ArgType, bool, bool);
+extern template void print_buf<cl_int>(std::ostream&, const cl_int*, size_t,
+                                       ArgType, bool, bool);
+extern template void print_buf<cl_uint>(std::ostream&, const cl_uint*, size_t,
+                                        ArgType, bool, bool);
+extern template void print_buf<cl_long>(std::ostream&, const cl_long*, size_t,
+                                        ArgType, bool, bool);
+extern template void print_buf<cl_ulong>(std::ostream&, const cl_ulong*, size_t,
+                                         ArgType, bool, bool);
+extern template void print_buf<cl_image_format>(std::ostream&,
+                                                const cl_image_format*, size_t,
+                                                ArgType, bool, bool);
 
 // TODO
 template<typename T, class = void>
diff --git a/src/c_wrapper/wrap_cl.cpp b/src/c_wrapper/wrap_cl.cpp
index e9069c37..b7d1ddb9 100644
--- a/src/c_wrapper/wrap_cl.cpp
+++ b/src/c_wrapper/wrap_cl.cpp
@@ -14,6 +14,22 @@
 #include "program.h"
 #include "kernel.h"
 
+namespace pyopencl {
+template void print_buf<char>(std::ostream&, const char*, size_t,
+                              ArgType, bool, bool);
+template void print_buf<cl_int>(std::ostream&, const cl_int*, size_t,
+                                ArgType, bool, bool);
+template void print_buf<cl_uint>(std::ostream&, const cl_uint*, size_t,
+                                 ArgType, bool, bool);
+template void print_buf<cl_long>(std::ostream&, const cl_long*, size_t,
+                                 ArgType, bool, bool);
+template void print_buf<cl_ulong>(std::ostream&, const cl_ulong*, size_t,
+                                  ArgType, bool, bool);
+template void print_buf<cl_image_format>(std::ostream&,
+                                         const cl_image_format*, size_t,
+                                         ArgType, bool, bool);
+}
+
 // {{{ c wrapper
 
 // Import all the names in pyopencl namespace for c wrappers.
-- 
GitLab