In the spec with the separate compile and link steps, it implies we can build a header file and output the binary, and then load in this binary in a second program, and link our kernel (which make calls to functions in the library) to it.
I have tried to get this working but have struggled. A simple header file is loaded as a string. I run clCreateProgramWithSource, and then
clCompileProgram(program, 1, &device_id, NULL, 0, NULL, NULL, NULL, NULL); program = clLinkProgram(context, 1, &device_id, "-enable-link-options -create-library ", 1, &program, NULL, NULL, &err);
The binary is then grabbed with clGetProgramInfo and written to file.
My kernel then #include <the_header_file.h>.
How do I compile my kernel and link the library in the second program, assuming I was only given the library binary aside from my second program's source?