slasher53
slasher53

Reputation: 141

OpenCL converting from cl_program to cl::program

I've been working on an OpenCL project using the C++ bindings and now need to use external code which is written using the C OpenCL bindings. To convert C++ OpenCL variables to C I've used the () operator but can't seem to find inverse of this. The variable I need to convert is cl_program to cl::Program.

// calling C OpenCL function with cpp member variables
cl_program programc = aocl_utils::func(m_context(), binary_file.c_str(), &device(), 0);
// converting programc back to C++ OpenCL
cl::Program program(&programc); // this doesn't work

Upvotes: 0

Views: 716

Answers (1)

Paul Varghese
Paul Varghese

Reputation: 1655

Create the object using the constructor.

cl::Program::Program    (   const Context &     context,
                            const vector< Device > &    devices,
                            const Binaries &    binaries,
                            vector< cl_int > *  binaryStatus = NULL,
                            cl_int *    err = NULL 
                        )   

Or use this constructor to convert from cl_program.

cl::Program::Program    (   const cl_program &  program,
                            bool    retainObject = false 
                         )  

Upvotes: 4

Related Questions