How to link to OpenCL binary library created with clLinkProgram "-create-library"

Can someone please tell me how to link to the program library created in the following way:



lib = clLinkProgram(context, NULL, NULL, "-create-library ", 1, &prog, NULL, NULL, &err);

I can happily produce this object for our static OpenCL library functions at start up but there seems to be no way to link to it with our dynamically generated kernel program.

I’m not sure exactly how we are supposed to use the OpenCL binary library type created as above as it is rejected by any further attempts to link to compiled kernel programs with CL_LINK_FAILURE.

Any advice much appreciated - thanks!