In OpenCL, when you want to compile (not link) a kernel for some target devices, you call:
cl_int clCompileProgram(
cl_program program,
cl_uint num_devices,
const cl_device_id* device_list,
const char* options,
cl_uint num_input_headers,
const cl_program* input_headers,
const char** header_include_names,
void (CL_CALLBACK* pfn_notify)(cl_program program, void* user_data),
void* user_data);
so, the headers you want to include in your compilation come through an array cl_program
, while, ostensibly, your translation unit's main source comes through a single cl_program
. Yet, the main cl_program you're compiling was (almost certainly) created using:
cl_program clCreateProgramWithSource(
cl_context context,
cl_uint count,
const char** strings,
const size_t* lengths,
cl_int* errcode_ret);
and here there is another, earlier, opportunity to add headers - as more strings in the array of const char*
's. What use therefore are the extra cl_program
's of clCompileProgram
?