c++ - OpenCL clGetPlatformIDs causes access violation only when ran from Visual Studio -


this strange 1 me. i'm pulling project old repo of mine i've migrated vs2015. solution still builds , executable works, when running in visual studio access violation in call clgetplatformids() trying read 0x000008e0.

i have no clue it's strange: builds work not vs. debugging through can confirm parameters expected function still fails. updated opencl implementation intel's opencl sdk version 6.3 didn't fix problem , don't have symbols dig deeper function.

code simple, i've posted 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 ); 

i think using clgetplatformids wrong. first, call clgetplatformids(numplatformstocheck, null, &numplatforms);

then: cl_platform_id * platforms = new cl_platform_id[numplatforms];

finally: error = clgetplatformids(numplatformstocheck, platforms, null); printclerror( "getting platforms", error );

in general opencl query commands are:

  • query number of items in list
  • allocate memory list
  • populate list

the issue either trying find 6 platforms there not 6 platforms or funky in library when parameters entered.


Comments