public static Kernel[] CreateKernelsInProgram(Program program) { ErrorCode error; uint numKernels; error = NativeMethods.clCreateKernelsInProgram(program.handle, 0, null, out numKernels); if (error != ErrorCode.Success) { throw new OpenClException(error); } IntPtr[] kernels = new IntPtr[numKernels]; error = NativeMethods.clCreateKernelsInProgram(program.handle, numKernels, kernels, out numKernels); if (error != ErrorCode.Success) { throw new OpenClException(error); } return(Kernel.FromIntPtr(kernels)); }