OpenCL / OpenGL interop shared context problem

Hello

I am trying to have a shared context between GL and CL. Since I created my GL context using SDL instead of wgl or glx function. I called wglGetCurrentContext and wglGetCurrentDC in the properties


cl_context_properties properties[] = {
		CL_GL_CONTEXT_KHR, (cl_context_properties)wglGetCurrentContext(), // WGL Context
		CL_WGL_HDC_KHR, (cl_context_properties)wglGetCurrentDC(), //WGL HDC
		CL_CONTEXT_PLATFORM, (cl_context_properties)platform,		//OpenCL platform
		0
	};
	size_t info_size;
	clGetGLContextInfoKHR_fn *functionPtr = (clGetGLContextInfoKHR_fn*)clGetExtensionFunctionAddressForPlatform(platform, "clGetGLContextInfoKHR");

	status_cl = (*functionPtr)(properties, CL_DEVICES_FOR_GL_CONTEXT_KHR, sizeof(devices), devices, &info_size);
	CHECK_OPENCL_ERROR(status_cl);
	context = clCreateContextFromType(properties, CL_DEVICE_TYPE_DEFAULT, NULL, NULL, &status_cl);
	CHECK_OPENCL_ERROR(status_cl);

The file compiles but with a warning of unknown pragma


#pragma extension cl_khr_gl_sharing : enable

I have detected that cl_khr_gl_sharing is supported in the extension.

And when I started to run the program, the error message said that
“0xC0000005: Access violation executing location 0x51EC8B55.”

I guess the extension function clGetGLContextInfoKHR, even being compiled successfully, cannot be actually called because of that unknown pragma.

So the question is how to solve that unknown pragma warning and if that is not the cause, what is the real problem.

-------------------------from a rookie in OpenCL/OpenGL interop, C++ and among other things.