OpenCL/CPU. Test whether the OpenCL framework is available. Avoiding aborting of opencl application

I’m working on a hybrid OpenCL application that has to decide at run time whether to use or not to use the GPU implementation.

Is there a cross platform (i.e. for intel, nvidia, and ati) way to dermine, whether the computer, where the application is running, has the opencl framework support, without crashing of the application? At the beginning I am only developing for the Windows platform.

#include <CL/cl.h>

#include <iostream>

int main() 


    std::cout << "Start cross paltform testing" << std::endl;

    cl_platform_id platform[1];

    clGetPlatformIDs(1, platform, 0);

    std::cout << "End cross paltform testing" << std::endl;

    return 0;


At the moment I get the error:

The application was unable to start correctly (0xc000007b)...

if I try to start it in the situation that I described above.

NB: Actually, at least for the nvidia it should be possible. I have tested oclDeviceQuery from the nvidia GPU SDK in this scenario and it works correctly. It is only necessary to copy the “opencl.dll” form Windows/System folder into the application folder. I have no idea why my app is crashing under the same circumstances.

Thank you in advance.

A solution can be found there: