How to add header?

I have a Struct named AES_KEY defined in OpenCL_AES_wrapper.h i use:
cl_program program=clCreateProgramWithSource(context,1,&source,NULL,NULL);
source is:
source="__kernel void encrypt_constant(__global const AES_KEY *key,__global const unsigned int *ivec,unsigned int loop_count,__global unsigned int *device_output)
"
how to include my header file for recognized the struct type?
thanks in advance.

There a basically two ways.


char* sources[2];
sources[0] = readFile("OpenCL_AES_wrapper.h"); // Use whatever you use now to read files
sources[1] = source;
...WithSource(context, 2, sources, ...

and the second is to use build options. See specification 5.4.2 and 5.4.3. In particular 5.4.3.1 (-I) dir.

the second way is for example:
const charopt="-I .\my header directory"
sources[0] = “OpenCL_AES_wrapper.h”;
sources[1] = source;
with clCreateProgram(context,2,sources
and clBuildProgram (…,opt
or i have to use only
const char
opt="-I .\my header directory"
with clBuildProgram (…,
opt,…);
?

You can use #include directive in opencl sources.

thanks i have resolve it with:
const char *options="-I ./lib";//if i don’t use it make error
cl_program program=clCreateProgramWithSource(context,1,&source,NULL,NULL);
and

source="#include <aes.h>

"
"__kernel void encrypt(__global const AES_KEY *key,__global const unsigned int *ivec,unsigned int loop_count,__global unsigned int *device_output)
"…
this way work correctly
thanks for hint