Thanks for your proposals, I slightly modified them and came up with an approach that works for me. Basically it does the following:
*) define a template function "fixReferenceCount()" which does nothing
*) overload this function for all relevant types (e.g., cl::Context), and call their retain() method
*) call "fixReferenceCount()" for data returned by the native OpenCL functions (in GetInfoHelper::get())

It might be incomplete and not fitting into cl.hpp style, but you get the idea. I made Wrapper<T>::retain() public to simplify things, but it can probably be done without this.

What do you think about this method?

Thanks & kind regards,
Markus


Here is the patch against cl.hpp as of 2010-04-23 10:16:50 -0500:
Code :
--- R:/ATI Stream/include/CL/cl-1.0.hpp	Thu Apr 29 11:46:57 2010
+++ R:/ATI Stream/include/CL/cl.hpp	Thu Apr 29 13:44:44 2010
@@ -824,7 +824,9 @@
     static cl_int
     get(Functor f, cl_uint name, T* param)
     {
-        return f(name, sizeof(T), param, NULL);
+        cl_int ret = f(name, sizeof(T), param, NULL);
+		fixReferenceCount(param);
+		return ret;
     }
 };
 
@@ -1205,8 +1207,6 @@
 
     cl_type& operator ()() { return object_; }
 
-protected:
-
     cl_int retain() const
     {
         return ReferenceHandler<cl_type>::retain(object_);
@@ -7336,6 +7336,27 @@
 
     return event;
 }
+
+template <typename T>
+static inline void fixReferenceCount(T *param)
+{
+};
+
+#define FIX_REFERENCE_COUNT(T) \
+static inline void fixReferenceCount(T *param) \
+{ \
+	param->retain(); \
+}
+
+FIX_REFERENCE_COUNT(Context);
+FIX_REFERENCE_COUNT(CommandQueue);
+FIX_REFERENCE_COUNT(Memory);
+FIX_REFERENCE_COUNT(Sampler);
+FIX_REFERENCE_COUNT(Program);
+FIX_REFERENCE_COUNT(Kernel);
+FIX_REFERENCE_COUNT(Event);
+
+#undef FIX_REFERENCE_COUNT
 
 #undef __ERR_STR
 #if !defined(__CL_USER_OVERRIDE_ERROR_STRINGS)