Results 1 to 5 of 5

Thread: How to add header?

  1. #1
    Junior Member
    Join Date
    Apr 2010
    Posts
    9

    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,&sourc e,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)\n"
    how to include my header file for recognized the struct type?
    thanks in advance.

  2. #2

    Re: How to add header?

    There a basically two ways.

    Code :
    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.

  3. #3
    Junior Member
    Join Date
    Apr 2010
    Posts
    9

    Re: How to add header?

    the second way is for example:
    const char*opt="-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,...);
    ?

  4. #4
    Senior Member
    Join Date
    Nov 2009
    Posts
    118

    Re: How to add header?

    You can use #include directive in opencl sources.

  5. #5
    Junior Member
    Join Date
    Apr 2010
    Posts
    9

    Re: How to add header?

    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,&sourc e,NULL,NULL);
    and

    source="#include <aes.h>\n"
    "__kernel void encrypt(__global const AES_KEY *key,__global const unsigned int *ivec,unsigned int loop_count,__global unsigned int *device_output)\n"...
    this way work correctly
    thanks for hint

Similar Threads

  1. Carry in/out add and borrow in/out sub
    By sean.settle in forum Suggestions for next release
    Replies: 2
    Last Post: 04-12-2011, 06:03 AM
  2. add header file using clCreateProgramWithSource
    By opencl_JEDI in forum OpenCL
    Replies: 1
    Last Post: 03-10-2010, 10:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •