1) I would like to propose a better format for the standard header cl.h.
Reason: The usual building and running problems, including the issue having to depent on OpenCL.dll (/.so/whatever lib format) statically, unable to support more than one platform.
Solution: Minor changes in the way 'cl.h' declares the functions. Simply declare function pointers instead of function prototypes. Additionally there has to be a 'cl.c' that is able to fill the pointers.
extern CL_API_ENTRY cl_int CL_API_CALL
fn_clReleaseEvent(cl_event /* event */) CL_API_SUFFIX__VERSION_1_0;
typedef CL_API_ENTRY cl_int
(CL_API_CALL *fn_clReleaseEvent)(cl_event /* event */) CL_API_SUFFIX__VERSION_1_0;
extern fn_clSomeProc clReleaseEvent;
or the direct way b)
extern CL_API_ENTRY cl_int
(CL_API_CALL *clReleaseEvent)(cl_event /* event */) CL_API_SUFFIX__VERSION_1_0;
// small changes, big impact...
// Working on the VC series, it should be no problem to get this working
// on other major compilers, at least with minor changes
There is no good reason that in the year 2009 Headers have to look like in times of K&R. Nearly all compilers will eat function pointer, i guess that those who dont wont get a special lib from Khronos to link to - i.e. those are out the game anyway. So everybody who is not happy with static linking or with using some specific toolchain has to write its own import header. Is this really nescessary?
Maybe there is a additional overhead with calling function pointers, but this overhead is a) small and b) inevitable for dynamic binding. On the other hand there is no problem to circumvent this with some preprocessor magic.
for (vector = begin,vector!=end;++vector) // <-- note the prefix op
for (vector = begin,vector!=end;vector++) // <-- note the postfix op
Semantically both versions do the same. At least a note that the postfix op is broken would be nice.