cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

sajis997
Adept I

cl_mem object type

Hi forum,

very preliminary stuff about the cl_mem object.

I saw that it is initialized as follows:

cl_mem pinnedData = NULL;

If i want to create a pointer type , how should it be initialized ?

cl_mem *ptrPinnedData = NULL. Is that ok ?

0 Likes
1 Reply
himanshu_gautam
Grandmaster

If you wanna create an array of cl_mem objects, you can do:

cl_mem *p = (cl_mem *) malloc(N * sizeof(cl_mem));

for(i=0; i<N; i++)

{

   p = clCreateBuffer(...);

}

Or you can also initialize to NULL if you dont want to point to anything at that portion of the code (cl_mem *p = NULL )

0 Likes