This is a strange one for me. I'm currently pulling a project from an old repo of mine that I've recently migrated to VS2015. The solution still builds and the executable works, but when running in visual studio I get an access violation in the call to clGetPlatformIDs()
trying to read from 0x000008E0.
I honestly have no clue what it could be as it's very strange: the builds work themselves but not from VS. Debugging through I can confirm all the parameters are as expected but the function still fails. I updated the OpenCL implementation to Intel's OpenCL SDK version 6.3 but that didn't fix the problem and I don't have the symbols to dig any deeper into the function.
Code is simple, but I've posted it below anyway.
//Get Platforms
cl_platform_id * platforms = new cl_platform_id[6];
cl_uint numPlatforms = 0;
cl_uint numPlatformsToCheck = 6;
error = clGetPlatformIDs(numPlatformsToCheck, platforms, &numPlatforms);
printCLError( "Getting Platforms", error );
new
the buffer forplatforms
? e.g.,cl_platform_id platforms[6];
err = clGetPlatformIDs(0, NULL, &numPlatforms);
if(numPlatforms > 0)
{
//we have at least one
cl_platform_id* platforms = new cl_platform_id[numPlatforms];
err = clGetPlatformIDs(numPlatforms, platforms, NULL);
platform_id = platforms[0];
delete[] platforms;
}